[fix](ccr) Mark getBinlog,getBinlogLag,getMeta,getBackendMeta as from master (#27211)

Signed-off-by: Jack Drogon <jack.xsuperman@gmail.com>
This commit is contained in:
Jack Drogon
2023-11-18 00:25:11 +08:00
committed by GitHub
parent 0aec436ef8
commit 38e4779fde
2 changed files with 39 additions and 0 deletions

View File

@ -2796,6 +2796,15 @@ public class FrontendServiceImpl implements FrontendService.Iface {
TGetBinlogResult result = new TGetBinlogResult();
TStatus status = new TStatus(TStatusCode.OK);
result.setStatus(status);
if (!Env.getCurrentEnv().isMaster()) {
status.setStatusCode(TStatusCode.NOT_MASTER);
status.addToErrorMsgs(NOT_MASTER_ERR_MSG);
result.setMasterAddress(getMasterAddress());
LOG.error("failed to get beginTxn: {}", NOT_MASTER_ERR_MSG);
return result;
}
try {
result = getBinlogImpl(request, clientAddr);
} catch (UserException e) {
@ -3137,6 +3146,14 @@ public class FrontendServiceImpl implements FrontendService.Iface {
TStatus status = new TStatus(TStatusCode.OK);
result.setStatus(status);
if (!Env.getCurrentEnv().isMaster()) {
status.setStatusCode(TStatusCode.NOT_MASTER);
status.addToErrorMsgs(NOT_MASTER_ERR_MSG);
result.setMasterAddress(getMasterAddress());
LOG.error("failed to get beginTxn: {}", NOT_MASTER_ERR_MSG);
return result;
}
try {
result = getBinlogLagImpl(request, clientAddr);
} catch (UserException e) {
@ -3385,6 +3402,15 @@ public class FrontendServiceImpl implements FrontendService.Iface {
TGetMetaResult result = new TGetMetaResult();
TStatus status = new TStatus(TStatusCode.OK);
result.setStatus(status);
if (!Env.getCurrentEnv().isMaster()) {
status.setStatusCode(TStatusCode.NOT_MASTER);
status.addToErrorMsgs(NOT_MASTER_ERR_MSG);
result.setMasterAddress(getMasterAddress());
LOG.error("failed to get beginTxn: {}", NOT_MASTER_ERR_MSG);
return result;
}
try {
result = getMetaImpl(request, clientAddr);
} catch (UserException e) {
@ -3524,6 +3550,15 @@ public class FrontendServiceImpl implements FrontendService.Iface {
TGetBackendMetaResult result = new TGetBackendMetaResult();
TStatus status = new TStatus(TStatusCode.OK);
result.setStatus(status);
if (!Env.getCurrentEnv().isMaster()) {
status.setStatusCode(TStatusCode.NOT_MASTER);
status.addToErrorMsgs(NOT_MASTER_ERR_MSG);
result.setMasterAddress(getMasterAddress());
LOG.error("failed to get beginTxn: {}", NOT_MASTER_ERR_MSG);
return result;
}
try {
result = getBackendMetaImpl(request, clientAddr);
} catch (UserException e) {