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 6f3ab9cae06 [fix](regression) Fix creating db for downstream url (#39601) 6f3ab9cae06 is described below commit 6f3ab9cae06413b2d5ffed44e0caf77c5373537a Author: walter <w41te...@gmail.com> AuthorDate: Wed Aug 21 10:51:30 2024 +0800 [fix](regression) Fix creating db for downstream url (#39601) --- .../org/apache/doris/regression/Config.groovy | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) 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 b7c3090e0b8..b97511992d5 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 @@ -927,6 +927,21 @@ class Config { } } + void tryCreateDownstreamDbIfNotExist(String dbName = defaultDb) { + // connect without specify default db + try { + String sql = "CREATE DATABASE IF NOT EXISTS ${dbName}" + log.info("Try to create db, sql: ${sql}".toString()) + if (!dryRun) { + getDownstreamConnection().withCloseable { conn -> + JdbcUtils.executeToList(conn, sql) + } + } + } catch (Throwable t) { + throw new IllegalStateException("Create database failed, ccrDownstreamUrl: ${ccrDownstreamUrl}", t) + } + } + boolean fetchRunMode() { if (isCloudMode == RunMode.UNKNOWN) { try { @@ -970,11 +985,15 @@ class Config { return DriverManager.getConnection(dbUrl, arrowFlightSqlJdbcUser, arrowFlightSqlJdbcPassword) } + Connection getDownstreamConnection() { + return DriverManager.getConnection(ccrDownstreamUrl, ccrDownstreamUser, ccrDownstreamPassword) + } + Connection getDownstreamConnectionByDbName(String dbName) { log.info("get downstream connection, url: ${ccrDownstreamUrl}, db: ${dbName}, " + "user: ${ccrDownstreamUser}, passwd: ${ccrDownstreamPassword}") String dbUrl = buildUrlWithDb(ccrDownstreamUrl, dbName) - tryCreateDbIfNotExist(dbName) + tryCreateDownstreamDbIfNotExist(dbName) log.info("connect to ${dbUrl}".toString()) return DriverManager.getConnection(dbUrl, ccrDownstreamUser, ccrDownstreamPassword) } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org