Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

syncer: table no need exist when drop (#985) #990

Merged
merged 3 commits into from
Sep 4, 2020
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
3 changes: 0 additions & 3 deletions syncer/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2089,7 +2089,6 @@ func (s *Syncer) trackDDL(usedSchema string, sql string, tableNames [][]*filter.
shouldSchemaExist = true
case *ast.DropDatabaseStmt:
shouldExecDDLOnSchemaTracker = true
shouldSchemaExist = true
if s.cfg.ShardMode == "" {
if err := s.checkpoint.DeleteSchemaPoint(ec.tctx, srcTable.Schema); err != nil {
return err
Expand All @@ -2100,8 +2099,6 @@ func (s *Syncer) trackDDL(usedSchema string, sql string, tableNames [][]*filter.
shouldSchemaExist = true
case *ast.DropTableStmt:
shouldExecDDLOnSchemaTracker = true
shouldSchemaExist = true
shouldTableExist = true
if err := s.checkpoint.DeleteTablePoint(ec.tctx, srcTable.Schema, srcTable.Name); err != nil {
return err
}
Expand Down
8 changes: 8 additions & 0 deletions tests/all_mode/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,14 @@ function run() {
check_log_not_contains $WORK_DIR/worker1/log/dm-worker.log "123456"
check_log_not_contains $WORK_DIR/worker2/log/dm-worker.log "123456"

# test drop table if exists
run_sql_source1 "drop table if exists \`all_mode\`.\`tb1\`;"
run_sql_source1 "drop table if exists \`all_mode\`.\`tb1\`;"
run_sql_source2 "drop table if exists \`all_mode\`.\`tb2\`;"
run_sql_source2 "drop table if exists \`all_mode\`.\`tb2\`;"
check_log_not_contains $WORK_DIR/worker1/log/dm-worker.log "Error .* Table .* doesn't exist"
check_log_not_contains $WORK_DIR/worker2/log/dm-worker.log "Error .* Table .* doesn't exist"

export GO_FAILPOINTS=''

run_sql_both_source "SET @@GLOBAL.SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'"
Expand Down