Skip to content

Commit

Permalink
fix wrong engine=Distributed creation queries to pass 1.1.54 test ver…
Browse files Browse the repository at this point in the history
…sion, fix #820
  • Loading branch information
Slach committed Jan 31, 2024
1 parent f968e30 commit e23e5f1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
3 changes: 0 additions & 3 deletions pkg/backup/table_pattern.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,6 @@ func changeTableQueryToAdjustDatabaseMapping(originTables *ListOfTables, dbMapRu
underlyingDB := matches[0][3]
underlyingDBClean := strings.NewReplacer(" ", "", "'", "").Replace(underlyingDB)
if underlyingTargetDB, isUnderlyingMapped := dbMapRule[underlyingDBClean]; isUnderlyingMapped {
if !usualIdentifier.MatchString(underlyingTargetDB) {
underlyingTargetDB = "`" + underlyingTargetDB + "`"
}
substitution = fmt.Sprintf("${1}(${2},%s,${4})", strings.Replace(underlyingDB, underlyingDBClean, underlyingTargetDB, 1))
originTable.Query = distributedRE.ReplaceAllString(originTable.Query, substitution)
}
Expand Down
2 changes: 1 addition & 1 deletion test/integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1775,7 +1775,7 @@ func TestRestoreDatabaseMapping(t *testing.T) {

ch.queryWithNoError(r, "CREATE DATABASE database1")
ch.queryWithNoError(r, "CREATE TABLE database1.t1 (dt DateTime, v UInt64) ENGINE=ReplicatedMergeTree('/clickhouse/tables/database1/t1','{replica}') PARTITION BY toYYYYMM(dt) ORDER BY dt")
ch.queryWithNoError(r, "CREATE TABLE database1.d1 AS database1.t1 ENGINE=Distributed('{cluster}',database1, t1)")
ch.queryWithNoError(r, "CREATE TABLE database1.d1 AS database1.t1 ENGINE=Distributed('{cluster}', 'database1', 't1')")
if compareVersion(os.Getenv("CLICKHOUSE_VERSION"), "22.3") < 0 {
ch.queryWithNoError(r, "CREATE TABLE database1.t2 AS database1.t1 ENGINE=ReplicatedMergeTree('/clickhouse/tables/database1/t2','{replica}') PARTITION BY toYYYYMM(dt) ORDER BY dt")
} else {
Expand Down

0 comments on commit e23e5f1

Please sign in to comment.