Skip to content

Commit b203557

Browse files
dynamic lookup _ghk
1 parent dd6d32a commit b203557

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

  • localtests/move-tables
    • resume-panic-before-drain-complete
    • resume-panic-on-row-copy

localtests/move-tables/resume-panic-before-drain-complete/test.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,22 @@ if [ $? -gt 0 ]; then
7676
return 1
7777
fi
7878

79-
# validate last checkpoint (cutover started and drain GTID are set)
80-
cutover_started=$(mysql-exec target primary $database -Ne "SELECT gh_ost_move_tables_cutover_started FROM _${table_name}_ghk ORDER BY gh_ost_chk_id DESC LIMIT 1;")
79+
# validate last checkpoint (cutover started and drain GTID are set). The
80+
# checkpoint table is named from the run token (_gho_<token>_ghk), so look it up
81+
# by pattern rather than a static per-table name.
82+
checkpoint_table=$(mysql-exec target primary $database -sNe "SELECT table_name FROM information_schema.tables WHERE table_schema='${database}' AND table_name LIKE '\\_gho\\_%\\_ghk' LIMIT 1;")
83+
if [ -z "$checkpoint_table" ]; then
84+
echo "ERROR: Checkpoint table does not exist."
85+
return 1
86+
fi
87+
88+
cutover_started=$(mysql-exec target primary $database -Ne "SELECT gh_ost_move_tables_cutover_started FROM \`${checkpoint_table}\` ORDER BY gh_ost_chk_id DESC LIMIT 1;")
8189
if [ "$cutover_started" != 1 ]; then
8290
echo "ERROR: Expected cutover started to be set in last checkpoint."
8391
return 1
8492
fi
8593

86-
drain_gtid=$(mysql-exec target primary $database -Ne "SELECT gh_ost_move_tables_drain_gtid FROM _${table_name}_ghk ORDER BY gh_ost_chk_id DESC LIMIT 1;")
94+
drain_gtid=$(mysql-exec target primary $database -Ne "SELECT gh_ost_move_tables_drain_gtid FROM \`${checkpoint_table}\` ORDER BY gh_ost_chk_id DESC LIMIT 1;")
8795
if [ "$drain_gtid" == "" ]; then
8896
echo "ERROR: Expected drain GTID to be set in last checkpoint."
8997
return 1

localtests/move-tables/resume-panic-on-row-copy/test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ if [ $? -gt 0 ]; then
6666
fi
6767

6868
# validate we processed a single row-copy chunk (10 rows) and there are 20 total to process
69-
rows_copied=$(mysql-exec target primary $database -Ne "SELECT gh_ost_rows_copied FROM _${table_name}_ghk ORDER BY gh_ost_chk_id DESC LIMIT 1;")
69+
rows_copied=$(mysql-exec target primary $database -Ne "SELECT gh_ost_rows_copied FROM \`${checkpoint_table}\` ORDER BY gh_ost_chk_id DESC LIMIT 1;")
7070
if [ $rows_copied -ne 10 ]; then
7171
echo "ERROR: Expected last checkpoint to show 10 rows copied."
7272
return 1
@@ -110,7 +110,7 @@ echo -e "\n\n\n\n\n"
110110
echo "⚙️ Validating checkpointed state after resumed migration..."
111111

112112
# validate we processed a single row-copy chunk (10 rows) and there are 20 total to process
113-
rows_copied=$(mysql-exec target primary $database -Ne "SELECT gh_ost_rows_copied FROM _${table_name}_ghk ORDER BY gh_ost_chk_id DESC LIMIT 1;")
113+
rows_copied=$(mysql-exec target primary $database -Ne "SELECT gh_ost_rows_copied FROM \`${checkpoint_table}\` ORDER BY gh_ost_chk_id DESC LIMIT 1;")
114114
if [ $rows_copied -ne 20 ]; then
115115
echo "ERROR: Expected last checkpoint to show 20 rows copied."
116116
return 1

0 commit comments

Comments
 (0)