This is an automated email from the ASF dual-hosted git repository. morningman 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 558e9e82496 [fix](test) fix unstable jdbc test case (#48223) 558e9e82496 is described below commit 558e9e8249646f65bcb6a804c861287ddf5c97ef Author: Mingyu Chen (Rayner) <morning...@163.com> AuthorDate: Mon Feb 24 18:35:41 2025 +0800 [fix](test) fix unstable jdbc test case (#48223) ### What problem does this PR solve? When `use_meta_cache=false`, should wait table list to be synced --- .../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: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org