This is an automated email from the ASF dual-hosted git repository.
kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new 3b84627557c [fix](ccr) Mark
getBinlog,getBinlogLag,getMeta,getBackendMeta as from master (#27211) (#27227)
3b84627557c is described below
commit 3b84627557ca57dfdbaa5c67805a66e0cdf3a6f5
Author: Jack Drogon <[email protected]>
AuthorDate: Sat Nov 18 23:56:03 2023 +0800
[fix](ccr) Mark getBinlog,getBinlogLag,getMeta,getBackendMeta as from
master (#27211) (#27227)
Signed-off-by: Jack Drogon <[email protected]>
---
.../apache/doris/service/FrontendServiceImpl.java | 35 ++++++++++++++++++++++
gensrc/thrift/FrontendService.thrift | 4 +++
2 files changed, 39 insertions(+)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
b/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
index 792d00bd63d..938282c7644 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
@@ -2610,6 +2610,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) {
@@ -2955,6 +2964,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) {
@@ -3063,6 +3080,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) {
@@ -3163,6 +3189,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) {
diff --git a/gensrc/thrift/FrontendService.thrift
b/gensrc/thrift/FrontendService.thrift
index f2769add699..3d881099de7 100644
--- a/gensrc/thrift/FrontendService.thrift
+++ b/gensrc/thrift/FrontendService.thrift
@@ -1015,6 +1015,7 @@ struct TGetBinlogResult {
3: optional list<TBinlog> binlogs
4: optional string fe_version
5: optional i64 fe_meta_version
+ 6: optional Types.TNetworkAddress master_address
}
struct TGetTabletReplicaInfosRequest {
@@ -1093,6 +1094,7 @@ typedef TGetBinlogRequest TGetBinlogLagRequest
struct TGetBinlogLagResult {
1: optional Status.TStatus status
2: optional i64 lag
+ 3: optional Types.TNetworkAddress master_address
}
struct TUpdateFollowerStatsCacheRequest {
@@ -1191,6 +1193,7 @@ struct TGetMetaDBMeta {
struct TGetMetaResult {
1: required Status.TStatus status
2: optional TGetMetaDBMeta db_meta
+ 3: optional Types.TNetworkAddress master_address
}
struct TGetBackendMetaRequest {
@@ -1205,6 +1208,7 @@ struct TGetBackendMetaRequest {
struct TGetBackendMetaResult {
1: required Status.TStatus status
2: optional list<Types.TBackend> backends
+ 3: optional Types.TNetworkAddress master_address
}
service FrontendService {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]