Skip to content

Commit c5f36d5

Browse files
committed
Bug#34971807 Assertion failure: btr0load.cc:401:in_order
Avoid flushing Page_extent when index build is interrupted. The Page_extent could be in an inconsistent state. The Bulk_flusher should avoid further flushing once the trx has been interrupted. Change-Id: Ia4bb1314d622500145b1b51cfb876071302163bc
1 parent 2c9f5ba commit c5f36d5

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

storage/innobase/btr/btr0load.cc

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,11 @@ dberr_t Page_extent::flush() {
375375
dberr_t err{DB_SUCCESS};
376376
const page_no_t n_pages = m_page_loads.size();
377377

378+
/* No need to flush any pages if index build has been interrupted. */
379+
if (m_btree_load->is_interrupted()) {
380+
return err;
381+
}
382+
378383
if (n_pages == 0) {
379384
/* Nothing to do. */
380385
return err;
@@ -389,16 +394,10 @@ dberr_t Page_extent::flush() {
389394
std::sort(m_page_loads.begin(), m_page_loads.end(), Page_load_compare());
390395

391396
#ifdef UNIV_DEBUG
392-
bool in_order = true;
393397
for (size_t i = m_range.first, j = 0;
394398
i < m_range.second && j < m_page_loads.size(); ++i, ++j) {
395-
if (in_order) {
396-
if (i != m_page_loads[j]->get_page_no()) {
397-
in_order = false;
398-
}
399-
}
399+
ut_ad(i == m_page_loads[j]->get_page_no());
400400
}
401-
ut_ad(in_order);
402401
#endif /* UNIV_DEBUG */
403402

404403
for (auto &page_load : m_page_loads) {
@@ -3513,3 +3512,7 @@ dberr_t Btree_load::Merger::root_page_commit(Page_load *root_load) {
35133512
}
35143513
return err;
35153514
}
3515+
3516+
bool Btree_load::is_interrupted() const {
3517+
return (m_trx != nullptr && trx_is_interrupted(m_trx));
3518+
}

storage/innobase/include/btr0load.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,10 @@ class Btree_load : private ut::Non_copyable {
572572
@return DB_SUCCESS on success or an error code on failure. */
573573
dberr_t init();
574574

575+
/** Check if the index build operation has been interrupted.
576+
@return true if the index build operation is interrupted, false otherwise.*/
577+
bool is_interrupted() const;
578+
575579
/** Get the index object.
576580
@return index object. */
577581
dict_index_t *index() const { return m_index; }

0 commit comments

Comments
 (0)