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 fffdca677d4 [fix](case) Enhance the robustness of 
`set_config_temporary_action` (#42306)
fffdca677d4 is described below

commit fffdca677d49a1965520817179dd2f519be14f92
Author: deardeng <565620...@qq.com>
AuthorDate: Thu Oct 24 14:00:06 2024 +0800

    [fix](case) Enhance the robustness of `set_config_temporary_action` (#42306)
---
 .../org/apache/doris/regression/Config.groovy      |  8 ++++++
 .../doris/regression/suite/SuiteContext.groovy     | 31 ++++++++++++++++++++++
 .../demo_p0/set_config_temporary_action.groovy     |  1 +
 3 files changed, 40 insertions(+)

diff --git 
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/Config.groovy
 
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/Config.groovy
index 4487d76beaa..7f971e83bfb 100644
--- 
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/Config.groovy
+++ 
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/Config.groovy
@@ -1136,6 +1136,14 @@ class Config {
         return urlWithDb
     }
 
+    public static String buildUrlWithDb(String host, int queryPort, String 
dbName) {
+        def url = String.format(
+            
"jdbc:mysql://%s:%s/?useLocalSessionState=true&allowLoadLocalInfile=false",
+            host, queryPort)
+        url = buildUrlWithDb(url, dbName)
+        return url
+    }
+
     private static String addSslUrl(String url) {
         if (url.contains("TLS")) {
             return url
diff --git 
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/SuiteContext.groovy
 
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/SuiteContext.groovy
index fe875af8a47..d2d49efa1a8 100644
--- 
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/SuiteContext.groovy
+++ 
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/SuiteContext.groovy
@@ -28,6 +28,7 @@ import java.sql.Connection
 import java.sql.DriverManager
 import java.util.concurrent.ExecutorService
 import java.util.function.Function
+import org.apache.doris.regression.util.JdbcUtils
 
 class ConnectionInfo {
     Connection conn
@@ -315,6 +316,36 @@ class SuiteContext implements Closeable {
         }
     }
 
+    def reconnectToMasterFe = { ->
+        log.info("Reconnecting to a new master frontend...")
+        def result = JdbcUtils.executeToMapArray(getConnection(), "SHOW 
FRONTENDS")
+        def master = null
+        for (def row : result) {
+            if (row.IsMaster == "true") {
+                master = row
+                break
+            }
+        }
+        if (master) {
+            log.info("master found: ${master.Host}:${master.HttpPort}")
+            def url = Config.buildUrlWithDb(master.Host as String, 
master.QueryPort as Integer, dbName)
+            ConnectionInfo connInfo = threadLocalConn.get()
+            def userName = null
+            def userPass = null
+            if (connInfo) {
+                userName = connInfo.username
+                userPass = connInfo.password
+            } else {
+                userName = config.jdbcUser
+                userPass = config.jdbcPassword
+            }
+            connectTo(url, connInfo.username, connInfo.password)
+            log.info("Successfully reconnected to the master")
+        } else {
+            throw new Exception("No master found to reconnect")
+        }
+    }
+
     public void reconnectFe() {
         ConnectionInfo connInfo = threadLocalConn.get()
         if (connInfo == null) {
diff --git a/regression-test/suites/demo_p0/set_config_temporary_action.groovy 
b/regression-test/suites/demo_p0/set_config_temporary_action.groovy
index b4677f7369d..452a5d8aa2c 100644
--- a/regression-test/suites/demo_p0/set_config_temporary_action.groovy
+++ b/regression-test/suites/demo_p0/set_config_temporary_action.groovy
@@ -16,6 +16,7 @@
 // under the License.
 
 suite('set_config_temporary_action', 'nonConcurrent') {
+    context.reconnectToMasterFe()
     def key = 'schedule_slot_num_per_ssd_path'
     setFeConfig(key, 8)
     assertEquals(8, getFeConfig(key) as int)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to