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

Merged
merged 5 commits into from
Sep 4, 2020
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 0 additions & 2 deletions syncer/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2100,8 +2100,6 @@ func (s *Syncer) trackDDL(usedSchema string, sql string, tableNames [][]*filter.
shouldSchemaExist = true
case *ast.DropTableStmt:
shouldExecDDLOnSchemaTracker = true
shouldSchemaExist = true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to handle shouldSchemaExist for case *ast.DropDatabaseStmt?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We create it if not exist below. But actually no need. Address in 56bf87f

shouldTableExist = true
if err := s.checkpoint.DeleteTablePoint(ec.tctx, srcTable.Schema, srcTable.Name); err != nil {
return err
}
Expand Down
10 changes: 10 additions & 0 deletions tests/all_mode/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,16 @@ 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\`;"
sleep 2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about retry and check downstream table dropped, maybe quicker than 2s

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to check no error exist.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just want to replace sleep 2s this line 🤣

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check log in 5bb5f63

run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \
"query-status $ILLEGAL_CHAR_NAME" \
"\"stage\": \"Running\"" 2

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