Commit 0ea625b3 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-15916 Change buffer crash during TRUNCATE or DROP TABLE

ibuf_restore_pos(): Do not issue any messages if the tablespace
is being dropped or truncated. In MariaDB 10.2, TRUNCATE TABLE
would not change the tablespace ID, and therefore the tablespace
would be found, even though TRUNCATE is in progress.

Furthermore, do not commit suicide if restoring the change buffer
cursor fails. The worst that could happen is that a secondary index
becomes corrupted due to incomplete change buffer merge.
parent bd1d152d
......@@ -4274,15 +4274,12 @@ ibuf_restore_pos(
return(TRUE);
}
if (fil_space_get_flags(space) == ULINT_UNDEFINED) {
/* The tablespace has been dropped. It is possible
that another thread has deleted the insert buffer
entry. Do not complain. */
ibuf_btr_pcur_commit_specify_mtr(pcur, mtr);
} else {
ib::error() << "ibuf cursor restoration fails!."
if (fil_space_t* s = fil_space_acquire_silent(space)) {
ib::error() << "ibuf cursor restoration fails!"
" ibuf record inserted to page "
<< space << ":" << page_no;
<< space << ":" << page_no
<< " in file " << s->chain.start->name;
fil_space_release(s);
ib::error() << BUG_REPORT_MSG;
......@@ -4292,10 +4289,9 @@ ibuf_restore_pos(
rec_print_old(stderr,
page_rec_get_next(btr_pcur_get_rec(pcur)));
ib::fatal() << "Failed to restore ibuf position.";
}
ibuf_btr_pcur_commit_specify_mtr(pcur, mtr);
return(FALSE);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment