This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 3e8d2f69866 [fix](regression-test) Fix regiressin test syncer suit
use master fe directly (#26456)
3e8d2f69866 is described below
commit 3e8d2f698660c5bb8d4d44b1df93aa98bf221057
Author: Jack Drogon <[email protected]>
AuthorDate: Mon Nov 6 22:51:54 2023 +0800
[fix](regression-test) Fix regiressin test syncer suit use master fe
directly (#26456)
Signed-off-by: Jack Drogon <[email protected]>
---
.../org/apache/doris/regression/suite/Suite.groovy | 22 +++++++++++++
.../apache/doris/regression/suite/Syncer.groovy | 2 +-
.../doris/regression/suite/SyncerContext.groovy | 37 ++++++++++++++++++++--
3 files changed, 57 insertions(+), 4 deletions(-)
diff --git
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
index 4f56c75b828..d56521b7d95 100644
---
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
+++
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
@@ -272,6 +272,28 @@ class Suite implements GroovyInterceptable {
return result
}
+ def sql_return_maparray(String sqlStr) {
+ logger.info("Execute sql: ${sqlStr}".toString())
+ def (result, meta) = JdbcUtils.executeToList(context.getConnection(),
sqlStr)
+
+ // get all column names as list
+ List<String> columnNames = new ArrayList<>()
+ for (int i = 0; i < meta.getColumnCount(); i++) {
+ columnNames.add(meta.getColumnName(i + 1))
+ }
+
+ // add result to res map list, each row is a map with key is column
name
+ List<Map<String, Object>> res = new ArrayList<>()
+ for (int i = 0; i < result.size(); i++) {
+ Map<String, Object> row = new HashMap<>()
+ for (int j = 0; j < columnNames.size(); j++) {
+ row.put(columnNames.get(j), result.get(i).get(j))
+ }
+ res.add(row)
+ }
+ return res;
+ }
+
List<List<Object>> target_sql(String sqlStr, boolean isOrder = false) {
logger.info("Execute ${isOrder ? "order_" : ""}target_sql:
${sqlStr}".toString())
def (result, meta) =
JdbcUtils.executeToList(context.getTargetConnection(this), sqlStr)
diff --git
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Syncer.groovy
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Syncer.groovy
index 62b257b1bc8..fff5c1c26cf 100644
---
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Syncer.groovy
+++
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Syncer.groovy
@@ -55,7 +55,7 @@ class Syncer {
Syncer(Suite suite, Config config) {
this.suite = suite
- context = new SyncerContext(suite.context.dbName, config)
+ context = new SyncerContext(suite, suite.context.dbName, config)
}
enum ccrCluster {
diff --git
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/SyncerContext.groovy
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/SyncerContext.groovy
index eb5823e9a01..388904ec2da 100644
---
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/SyncerContext.groovy
+++
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/SyncerContext.groovy
@@ -23,7 +23,11 @@ import
org.apache.doris.regression.suite.client.BackendClientImpl
import org.apache.doris.regression.suite.client.FrontendClientImpl
import org.apache.doris.thrift.TTabletCommitInfo
import org.apache.doris.thrift.TGetSnapshotResult
+import org.apache.doris.thrift.TNetworkAddress;
import com.google.gson.annotations.SerializedName
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import groovy.util.logging.Slf4j
import java.sql.Connection
@@ -93,6 +97,9 @@ class ExtraInfo {
}
class SyncerContext {
+ final Logger logger = LoggerFactory.getLogger(this.class)
+
+ final Suite suite
protected Connection targetConnection
protected FrontendClientImpl sourceFrontendClient
protected FrontendClientImpl targetFrontendClient
@@ -121,7 +128,8 @@ class SyncerContext {
public long txnId
public long seq
- SyncerContext(String dbName, Config config) {
+ SyncerContext(Suite suite, String dbName, Config config) {
+ this.suite = suite
this.sourceDbId = -1
this.targetDbId = -1
this.db = dbName
@@ -139,16 +147,39 @@ class SyncerContext {
return info
}
+ FrontendClientImpl getMasterFrontClient() {
+ def result = suite.sql_return_maparray "select Host, RpcPort, IsMaster
from frontends();"
+ logger.info("get master fe: ${result}")
+
+ def masterHost = ""
+ def masterPort = 0
+ for (def row : result) {
+ if (row.IsMaster == "true") {
+ masterHost = row.Host
+ masterPort = row.RpcPort.toInteger()
+ break
+ }
+ }
+
+ if (masterHost == "" || masterPort == 0) {
+ throw new Exception("can not find master fe")
+ }
+
+ def masterNetworkAddr = new TNetworkAddress(masterHost, masterPort)
+ logger.info("master fe network addr: ${masterNetworkAddr}")
+ return new FrontendClientImpl(masterNetworkAddr)
+ }
+
FrontendClientImpl getSourceFrontClient() {
if (sourceFrontendClient == null) {
- sourceFrontendClient = new
FrontendClientImpl(config.feSourceThriftNetworkAddress)
+ sourceFrontendClient = getMasterFrontClient()
}
return sourceFrontendClient
}
FrontendClientImpl getTargetFrontClient() {
if (targetFrontendClient == null) {
- targetFrontendClient = new
FrontendClientImpl(config.feTargetThriftNetworkAddress)
+ targetFrontendClient = getMasterFrontClient()
}
return targetFrontendClient
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]