diff --git a/pkg/ccr/job.go b/pkg/ccr/job.go index 32434778..181de852 100644 --- a/pkg/ccr/job.go +++ b/pkg/ccr/job.go @@ -931,7 +931,7 @@ func (j *Job) handleDropPartition(binlog *festruct.TBinlog) error { } // dropPartitionSql = "ALTER TABLE " + sql - dropPartitionSql := fmt.Sprintf("ALTER TABLE %s.%s %s", destDbName, destTableName, dropPartition.Sql) + dropPartitionSql := fmt.Sprintf("ALTER TABLE %s.%s %s", utils.FormatKeywordName(destDbName), utils.FormatKeywordName(destTableName), dropPartition.Sql) log.Infof("dropPartitionSql: %s", dropPartitionSql) return j.IDest.Exec(dropPartitionSql) } @@ -1047,9 +1047,9 @@ func (j *Job) handleAlterJob(binlog *festruct.TBinlog) error { // drop table dropTableSql var dropTableSql string if j.SyncType == TableSync { - dropTableSql = fmt.Sprintf("DROP TABLE %s FORCE", j.Dest.Table) + dropTableSql = fmt.Sprintf("DROP TABLE %s FORCE", utils.FormatKeywordName(j.Dest.Table)) } else { - dropTableSql = fmt.Sprintf("DROP TABLE %s FORCE", alterJob.TableName) + dropTableSql = fmt.Sprintf("DROP TABLE %s FORCE", utils.FormatKeywordName(alterJob.TableName)) } log.Infof("dropTableSql: %s", dropTableSql) @@ -1107,9 +1107,9 @@ func (j *Job) handleTruncateTable(binlog *festruct.TBinlog) error { var sql string if truncateTable.RawSql == "" { - sql = fmt.Sprintf("TRUNCATE TABLE %s", destTableName) + sql = fmt.Sprintf("TRUNCATE TABLE %s", utils.FormatKeywordName(destTableName)) } else { - sql = fmt.Sprintf("TRUNCATE TABLE %s %s", destTableName, truncateTable.RawSql) + sql = fmt.Sprintf("TRUNCATE TABLE %s %s", utils.FormatKeywordName(destTableName), truncateTable.RawSql) } log.Infof("truncateTableSql: %s", sql) diff --git a/regression-test/suites/table-sync/test_keyword_name.groovy b/regression-test/suites/table-sync/test_keyword_name.groovy index 52de4b76..3d9a0d24 100644 --- a/regression-test/suites/table-sync/test_keyword_name.groovy +++ b/regression-test/suites/table-sync/test_keyword_name.groovy @@ -168,11 +168,11 @@ suite("test_keyword_name") { """, checkNewPartition, 30, "target")) - logger.info("=== Test 3: Drop table ===") - sql "DROP TABLE `${tableName}`" + logger.info("=== Test 3: Truncate table ===") + sql "TRUNCATE TABLE `${tableName}`" assertTrue(checkShowTimesOf(""" - SHOW CREATE TABLE `TEST_${context.dbName}`.`${tableName}` + SELECT * FROM `TEST_${context.dbName}`.`${tableName}` """, notExist, 30, "target")) } \ No newline at end of file diff --git a/regression-test/suites/table-sync/test_rename.groovy b/regression-test/suites/table-sync/test_rename.groovy index f6fdb816..d3f0bafa 100644 --- a/regression-test/suites/table-sync/test_rename.groovy +++ b/regression-test/suites/table-sync/test_rename.groovy @@ -16,6 +16,9 @@ // under the License. suite("test_rename") { + logger.info("exit because test_rename is not supported yet") + return + def tableName = "tbl_rename_" + UUID.randomUUID().toString().replace("-", "") def syncerAddress = "127.0.0.1:9190" def test_num = 0