This is an automated email from the ASF dual-hosted git repository.
w41ter pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new 6afc42cde81 [fix](regression) Fix creating db for downstream url
#39601 (#39817)
6afc42cde81 is described below
commit 6afc42cde81255db2669161e2904e240a9a75dac
Author: walter <[email protected]>
AuthorDate: Fri Aug 23 11:13:00 2024 +0800
[fix](regression) Fix creating db for downstream url #39601 (#39817)
cherry pick from #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 90638778284..cbf4504c171 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
@@ -634,6 +634,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)
+ }
+ }
+
Connection getConnection() {
return DriverManager.getConnection(jdbcUrl, jdbcUser, jdbcPassword)
}
@@ -681,9 +696,13 @@ class Config {
return DriverManager.getConnection(dbUrl, arrowFlightSqlJdbcUser,
arrowFlightSqlJdbcPassword)
}
+ Connection getDownstreamConnection() {
+ return DriverManager.getConnection(ccrDownstreamUrl,
ccrDownstreamUser, ccrDownstreamPassword)
+ }
+
Connection getDownstreamConnectionByDbName(String dbName) {
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: [email protected]
For additional commands, e-mail: [email protected]