Skip to content

Commit 0237e9b

Browse files
committed
MDEV-26041 Recovery failure due to delete-marked SYS_FIELDS record
trx_t::drop_table(): Delete-mark the SYS_TABLES and SYS_INDEXES record before delete-marking any SYS_COLUMNS or SYS_FIELDS records. Otherwise, dict_load_indexes() could fail on recovery. This fixes up commit 1bd681c (MDEV-25506).
1 parent e04bbf7 commit 0237e9b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

storage/innobase/dict/drop.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,18 +205,19 @@ dberr_t trx_t::drop_table(const dict_table_t &table)
205205
"WHERE TABLE_ID=:id FOR UPDATE;\n"
206206

207207
"BEGIN\n"
208+
209+
"DELETE FROM SYS_TABLES WHERE ID=:id;\n"
210+
"DELETE FROM SYS_COLUMNS WHERE TABLE_ID=:id;\n"
211+
208212
"OPEN idx;\n"
209213
"WHILE 1 = 1 LOOP\n"
210214
" FETCH idx INTO iid;\n"
211215
" IF (SQL % NOTFOUND) THEN EXIT; END IF;\n"
212-
" DELETE FROM SYS_FIELDS WHERE INDEX_ID=iid;\n"
213216
" DELETE FROM SYS_INDEXES WHERE CURRENT OF idx;\n"
217+
" DELETE FROM SYS_FIELDS WHERE INDEX_ID=iid;\n"
214218
"END LOOP;\n"
215219
"CLOSE idx;\n"
216220

217-
"DELETE FROM SYS_COLUMNS WHERE TABLE_ID=:id;\n"
218-
"DELETE FROM SYS_TABLES WHERE ID=:id;\n"
219-
220221
"END;\n", FALSE, this);
221222
}
222223

0 commit comments

Comments
 (0)