Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pkg/ccr/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions regression-test/suites/table-sync/test_keyword_name.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
}
3 changes: 3 additions & 0 deletions regression-test/suites/table-sync/test_rename.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down