Skip to content

Commit

Permalink
Fix unstable test changefeed_dup_error_restart (#1079)
Browse files Browse the repository at this point in the history
  • Loading branch information
hongyunyan authored Mar 12, 2025
1 parent 22af79a commit 27845b8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
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

0 comments on commit 27845b8

Please sign in to comment.