This is an automated email from the ASF dual-hosted git repository. dataroaring pushed a commit to branch branch-3.0 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0 by this push: new 092f8d6a7cb branch-3.0: [fix](test) fix unstable jdbc test case #48223 (#48248) 092f8d6a7cb is described below commit 092f8d6a7cb2afa1d0ad27a8d0a159e51394c990 Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> AuthorDate: Sat Mar 1 10:13:36 2025 +0800 branch-3.0: [fix](test) fix unstable jdbc test case #48223 (#48248) Cherry-picked from #48223 Co-authored-by: Mingyu Chen (Rayner) <morning...@163.com> --- .../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 92c8ab1be3a..2c68a244e28 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} """ @@ -79,19 +92,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: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org