This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new 769eca534d9 branch-2.1: [fix](test) fix unstable jdbc test case #48223
(#48249)
769eca534d9 is described below
commit 769eca534d97a89a9876c7c5a0499d81bd393b55
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Feb 25 20:34:25 2025 +0800
branch-2.1: [fix](test) fix unstable jdbc test case #48223 (#48249)
Cherry-picked from #48223
Co-authored-by: Mingyu Chen (Rayner) <[email protected]>
---
.../jdbc/test_jdbc_catalog_ddl.groovy | 36 +++++++++++++++++-----
1 file changed, 28 insertions(+), 8 deletions(-)
diff --git
a/regression-test/suites/external_table_p0/jdbc/test_jdbc_catalog_ddl.groovy
b/regression-test/suites/external_table_p0/jdbc/test_jdbc_catalog_ddl.groovy
index 1750f732baf..1d93c715391 100644
--- a/regression-test/suites/external_table_p0/jdbc/test_jdbc_catalog_ddl.groovy
+++ b/regression-test/suites/external_table_p0/jdbc/test_jdbc_catalog_ddl.groovy
@@ -38,9 +38,22 @@ suite("test_jdbc_catalog_ddl",
"p0,external,mysql,external_docker,external_docke
}
}
}
+
+ def wait_table_sync = { String db ->
+ Awaitility.await().atMost(10, TimeUnit.SECONDS).pollInterval(1,
TimeUnit.SECONDS).until{
+ try {
+ def res = sql "show tables from ${db}"
+ return res.size() > 0;
+ } catch (Exception e) {
+ e.printStackTrace();
+ return false;
+ }
+ }
+ }
// String driver_url = "mysql-connector-java-5.1.49.jar"
if (enabled != null && enabled.equalsIgnoreCase("true")) {
String catalog_name = "test_jdbc_catalog_ddl";
+ String temp_db = "test_jdbc_catalog_ddl_tmp_db"
for (String useMetaCache : ["true", "false"]) {
sql """drop catalog if exists ${catalog_name} """
@@ -80,19 +93,26 @@ suite("test_jdbc_catalog_ddl",
"p0,external,mysql,external_docker,external_docke
}
// create a database in mysql
- sql """CALL EXECUTE_STMT("${catalog_name}", "drop database if
exists temp_database")"""
- sql """CALL EXECUTE_STMT("${catalog_name}", "create database
temp_database")"""
- sql """CALL EXECUTE_STMT("${catalog_name}", "drop table if exists
temp_database.temp_table")"""
- sql """CALL EXECUTE_STMT("${catalog_name}", "create table
temp_database.temp_table (k1 int)")"""
- sql """CALL EXECUTE_STMT("${catalog_name}", "insert into
temp_database.temp_table values(12345)")"""
+ sql """CALL EXECUTE_STMT("${catalog_name}", "drop database if
exists ${temp_db}")"""
+ sql """CALL EXECUTE_STMT("${catalog_name}", "create database
${temp_db}")"""
+ sql """CALL EXECUTE_STMT("${catalog_name}", "drop table if exists
${temp_db}.temp_table")"""
+ sql """CALL EXECUTE_STMT("${catalog_name}", "create table
${temp_db}.temp_table (k1 int)")"""
+ sql """CALL EXECUTE_STMT("${catalog_name}", "insert into
${temp_db}.temp_table values(12345)")"""
if (useMetaCache.equals("false")) {
- sql """refresh catalog ${catalog_name}"""
+ // if use_meta_cache is false, there is a bug that refresh
catalog is not able to see newly created database.
+ // but `alter catalog` can uninitialize entire catalog and get
newly created database.
+ // so here we use `alter catalog` to let this case pass,
+ // no plan to fix it, because in new Doris version,
use_meta_cache is true
+ sql """ALTER CATALOG `${catalog_name}` SET PROPERTIES
('password'='123456')"""
wait_db_sync("${catalog_name}")
}
- sql "use ${catalog_name}.temp_database"
+ sql "use ${catalog_name}.${temp_db}"
+ if (useMetaCache.equals("false")) {
+ wait_table_sync("${catalog_name}.${temp_db}")
+ }
qt_sql01 """select * from temp_table"""
- sql """CALL EXECUTE_STMT("${catalog_name}", "drop database if
exists temp_database")"""
+ sql """CALL EXECUTE_STMT("${catalog_name}", "drop database if
exists ${temp_db}")"""
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]