diff --git a/syncer/syncer.go b/syncer/syncer.go index 4d796670c0..505f5d71a8 100644 --- a/syncer/syncer.go +++ b/syncer/syncer.go @@ -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 @@ -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 } diff --git a/tests/all_mode/run.sh b/tests/all_mode/run.sh index 5acb9fcf08..5d23f2aa4a 100755 --- a/tests/all_mode/run.sh +++ b/tests/all_mode/run.sh @@ -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'"