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

Commit

Permalink
syncer: table no need exist when drop (#985) (#990)
Browse files Browse the repository at this point in the history
Co-authored-by: gmhdbjd <[email protected]>
  • Loading branch information
ti-srebot and GMHDBJD authored Sep 4, 2020
1 parent 18852db commit b13adb9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
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

0 comments on commit b13adb9

Please sign in to comment.