Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unstable test changefeed_dup_error_restart #1079

Merged
merged 4 commits into from
Mar 12, 2025
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
6 changes: 4 additions & 2 deletions pkg/sink/mysql/mysql_writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,15 @@ func TestMysqlWriter_FlushDML(t *testing.T) {
dmlEvent := helper.DML2Event("test", "t", "insert into t values (1, 'test')", "insert into t values (2, 'test2');")
dmlEvent.CommitTs = 2
dmlEvent.ReplicatingTs = 1
dmlEvent.DispatcherID = common.NewDispatcherID()

dmlEvent2 := helper.DML2Event("test", "t", "insert into t values (3, 'test3');")
dmlEvent2.CommitTs = 3
dmlEvent2.ReplicatingTs = 4
dmlEvent2.ReplicatingTs = 1
dmlEvent2.DispatcherID = dmlEvent.DispatcherID

mock.ExpectBegin()
mock.ExpectExec("INSERT INTO `test`.`t` (`id`,`name`) VALUES (?,?),(?,?);REPLACE INTO `test`.`t` (`id`,`name`) VALUES (?,?)").
mock.ExpectExec("INSERT INTO `test`.`t` (`id`,`name`) VALUES (?,?),(?,?),(?,?)").
WithArgs(1, "test", 2, "test2", 3, "test3").
WillReturnResult(sqlmock.NewResult(1, 1))
mock.ExpectCommit()
Expand Down
8 changes: 4 additions & 4 deletions tests/integration_tests/changefeed_dup_error_restart/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ function run() {
run_cdc_cli changefeed create --start-ts=$start_ts --sink-uri="$SINK_URI"

run_sql "CREATE TABLE changefeed_dup_error_restart.finish_mark_1 (a int primary key);"
check_table_exists "changefeed_dup_error_restart.finish_mark_1" ${DOWN_TIDB_HOST} ${DOWN_TIDB_PORT} 120
check_sync_diff $WORK_DIR $CUR/conf/diff_config.toml
check_table_exists "changefeed_dup_error_restart.finish_mark_1" ${DOWN_TIDB_HOST} ${DOWN_TIDB_PORT} 300
check_sync_diff $WORK_DIR $CUR/conf/diff_config.toml 300

go-ycsb load mysql -P $CUR/conf/workload -p mysql.host=${UP_TIDB_HOST} -p mysql.port=${UP_TIDB_PORT} -p mysql.user=root -p mysql.db=changefeed_dup_error_restart
run_sql "CREATE TABLE changefeed_dup_error_restart.finish_mark_2 (a int primary key);"
check_table_exists "changefeed_dup_error_restart.finish_mark_2" ${DOWN_TIDB_HOST} ${DOWN_TIDB_PORT} 120
check_sync_diff $WORK_DIR $CUR/conf/diff_config.toml 180
check_table_exists "changefeed_dup_error_restart.finish_mark_2" ${DOWN_TIDB_HOST} ${DOWN_TIDB_PORT} 300
check_sync_diff $WORK_DIR $CUR/conf/diff_config.toml 300

cleanup_process $CDC_BINARY
}
Expand Down
Loading