Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
hongyunyan committed Jan 24, 2025
1 parent e173488 commit 26386ee
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 9 deletions.
14 changes: 5 additions & 9 deletions pkg/sink/mysql/mysql_writer_for_ddl_ts.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,6 @@ func (w *MysqlWriter) SendDDLTsPre(event commonEvent.BlockEvent) error {
if relatedTableID == 0 {
if len(tableIds) > 1 {
relatedTableID = tableIds[1]
} else {
log.Panic("relatedTableID is 0 and tableIds is empty, FIX IT", zap.Any("event", event))
}
}
// generate query
Expand Down Expand Up @@ -298,12 +296,10 @@ func (w *MysqlWriter) SendDDLTs(event commonEvent.BlockEvent) error {

if len(tableIds) > 0 {
// choose one related table_id to help table trigger event dispatcher to find the ddl jobs.
relatedTableID := tableIds[0]
relatedTableID := tableIds[0] // TODO: 这个 related table id 要合理挑选一下,主要是 partition 要选 physical table 才行?主要是看 tableID 用的是哪个
if relatedTableID == 0 {
if len(tableIds) > 1 {
relatedTableID = tableIds[1]
} else {
log.Panic("relatedTableID is 0 and tableIds is empty, FIX IT", zap.Any("event", event))
}
}
// generate query
Expand Down Expand Up @@ -464,10 +460,10 @@ func (w *MysqlWriter) GetStartTsList(tableIDs []int64) ([]int64, error) {
continue
}
// query the ddl_jobs table to find whether the ddl is executed
if tableId == 0 {
tableId = relatedTableId
}
query := fmt.Sprintf(queryDDLJobs, strconv.FormatInt(tableId, 10))
// if tableId == 0 {
// tableId = relatedTableId
// }
query := fmt.Sprintf(queryDDLJobs, strconv.FormatInt(relatedTableId, 10))
log.Info("query ddl jobs", zap.String("query", query))

start := time.Now()
Expand Down
31 changes: 31 additions & 0 deletions tests/integration_tests/_utils/run_sql_ignore_error
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh
# parameter 1: sql
# parameter 2: database host
# parameter 3: database port
# parameter 4: other mysql client settings

sql=${1}

host=127.0.0.1
if [ $# -gt 1 ]; then
shift
host=${1}
fi

port=4000
if [ $# -gt 1 ]; then
shift
port=${1}
fi

if [ $# -gt 1 ]; then
shift
other=${*}
fi

prepare="set global tidb_enable_clustered_index = 'int_only';"

echo "[$(date)] Executing SQL: ${sql}" >"$OUT_DIR/sql_res.$TEST_NAME.txt"

mysql -uroot -h${host} -P${port} ${other} --default-character-set utf8mb4 -E -e "${prepare}" >"$OUT_DIR/sql_res.$TEST_NAME.txt"
mysql -uroot -h${host} -P${port} ${other} --default-character-set utf8mb4 -E -e "${sql}" >"$OUT_DIR/sql_res.$TEST_NAME.txt"
2 changes: 2 additions & 0 deletions tests/integration_tests/fail_over_ddl_mix/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ main() {

check_sync_diff $WORK_DIR $CUR/conf/diff_config.toml 300

sleep 100

cleanup_process $CDC_BINARY
}

Expand Down

0 comments on commit 26386ee

Please sign in to comment.