summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Kosov <claprix@yandex.ru>2019-10-02 22:47:45 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-10-09 08:29:26 +0300
commited0793e096a17955c5a03844b248bcf8303dd335 (patch)
tree1498faf2b46e55c85d4d7e6dae8bfb924f6c5828
parent99dc40d6ac2234fa4c990665cc1914c1925cd641 (diff)
downloadmariadb-git-ed0793e096a17955c5a03844b248bcf8303dd335.tar.gz
MDEV-19783: Add more REC_INFO_MIN_REC_FLAG checks
btr_cur_pessimistic_delete(): code changed in a way that allows to put more REC_INFO_MIN_REC_FLAG assertions inside btr_set_min_rec_mark(). Without that change tests innodb.innodb-table-online, innodb.temp_table_savepoint and innodb_zip.prefix_index_liftedlimit fail. Removed basically duplicated page_zip_validate() calls which fails because of temporary(!) invariant violation. That fixed innodb_zip.wl5522_debug_zip and innodb_zip.prefix_index_liftedlimit
-rw-r--r--storage/innobase/btr/btr0btr.cc21
-rw-r--r--storage/innobase/btr/btr0cur.cc26
-rw-r--r--storage/innobase/include/btr0btr.h12
-rw-r--r--storage/innobase/include/page0page.ic4
-rw-r--r--storage/innobase/page/page0cur.cc4
-rw-r--r--storage/innobase/page/page0zip.cc4
6 files changed, 33 insertions, 38 deletions
diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc
index 1bd49fa048e..473e4248656 100644
--- a/storage/innobase/btr/btr0btr.cc
+++ b/storage/innobase/btr/btr0btr.cc
@@ -3309,25 +3309,22 @@ btr_parse_set_min_rec_mark(
return(ptr + 2);
}
-/****************************************************************//**
-Sets a record as the predefined minimum record. */
-void
-btr_set_min_rec_mark(
-/*=================*/
- rec_t* rec, /*!< in: record */
- mtr_t* mtr) /*!< in: mtr */
+/** Sets a record as the predefined minimum record. */
+void btr_set_min_rec_mark(rec_t* rec, mtr_t* mtr)
{
- ulint info_bits;
+ const bool comp = page_rec_is_comp(rec);
- if (page_rec_is_comp(rec)) {
- info_bits = rec_get_info_bits(rec, TRUE);
+ ut_ad(rec == page_rec_get_next_const(page_get_infimum_rec(
+ page_align(rec))));
+ ut_ad(!(rec_get_info_bits(page_rec_get_next(rec), comp)
+ & REC_INFO_MIN_REC_FLAG));
+ size_t info_bits = rec_get_info_bits(rec, comp);
+ if (comp) {
rec_set_info_bits_new(rec, info_bits | REC_INFO_MIN_REC_FLAG);
btr_set_min_rec_mark_log(rec, MLOG_COMP_REC_MIN_MARK, mtr);
} else {
- info_bits = rec_get_info_bits(rec, FALSE);
-
rec_set_info_bits_old(rec, info_bits | REC_INFO_MIN_REC_FLAG);
btr_set_min_rec_mark_log(rec, MLOG_REC_MIN_MARK, mtr);
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index d0d453ed828..3060865bc8e 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/btr/btr0cur.cc
@@ -5277,8 +5277,15 @@ btr_cur_pessimistic_delete(
#endif /* UNIV_ZIP_DEBUG */
}
- if (flags == 0) {
- lock_update_delete(block, rec);
+ rec_t* next_rec = NULL;
+ bool min_mark_next_rec = false;
+
+ if (page_is_leaf(page)) {
+ ut_ad(!(rec_get_info_bits(rec, page_rec_is_comp(rec))
+ & REC_INFO_MIN_REC_FLAG));
+ if (flags == 0) {
+ lock_update_delete(block, rec);
+ }
}
if (UNIV_UNLIKELY(page_get_n_recs(page) < 2)
@@ -5297,20 +5304,14 @@ btr_cur_pessimistic_delete(
if (page_is_leaf(page)) {
btr_search_update_hash_on_delete(cursor);
} else if (UNIV_UNLIKELY(page_rec_is_first(rec, page))) {
- rec_t* next_rec = page_rec_get_next(rec);
+ next_rec = page_rec_get_next(rec);
if (!page_has_prev(page)) {
-
/* If we delete the leftmost node pointer on a
non-leaf level, we must mark the new leftmost node
pointer as the predefined minimum record */
- /* This will make page_zip_validate() fail until
- page_cur_delete_rec() completes. This is harmless,
- because everything will take place within a single
- mini-transaction and because writing to the redo log
- is an atomic operation (performed by mtr_commit()). */
- btr_set_min_rec_mark(next_rec, mtr);
+ min_mark_next_rec = true;
} else if (dict_index_is_spatial(index)) {
/* For rtree, if delete the leftmost node pointer,
we need to update parent page. */
@@ -5379,6 +5380,11 @@ btr_cur_pessimistic_delete(
block->page.size, mtr);
page_cur_delete_rec(btr_cur_get_page_cur(cursor), index,
offsets, mtr);
+
+ if (min_mark_next_rec) {
+ btr_set_min_rec_mark(next_rec, mtr);
+ }
+
#ifdef UNIV_ZIP_DEBUG
ut_a(!page_zip || page_zip_validate(page_zip, page, index));
#endif /* UNIV_ZIP_DEBUG */
diff --git a/storage/innobase/include/btr0btr.h b/storage/innobase/include/btr0btr.h
index e00b2545708..604890ed03c 100644
--- a/storage/innobase/include/btr0btr.h
+++ b/storage/innobase/include/btr0btr.h
@@ -508,14 +508,10 @@ btr_insert_on_non_leaf_level_func(
mtr_t* mtr); /*!< in: mtr */
#define btr_insert_on_non_leaf_level(f,i,l,t,m) \
btr_insert_on_non_leaf_level_func(f,i,l,t,__FILE__,__LINE__,m)
-/****************************************************************//**
-Sets a record as the predefined minimum record. */
-void
-btr_set_min_rec_mark(
-/*=================*/
- rec_t* rec, /*!< in/out: record */
- mtr_t* mtr) /*!< in: mtr */
- MY_ATTRIBUTE((nonnull));
+
+/** Sets a record as the predefined minimum record. */
+void btr_set_min_rec_mark(rec_t* rec, mtr_t* mtr) MY_ATTRIBUTE((nonnull));
+
/** Seek to the parent page of a B-tree page.
@param[in,out] index b-tree
@param[in] block child page
diff --git a/storage/innobase/include/page0page.ic b/storage/innobase/include/page0page.ic
index 05774daac50..3956ecce0ee 100644
--- a/storage/innobase/include/page0page.ic
+++ b/storage/innobase/include/page0page.ic
@@ -659,6 +659,10 @@ page_rec_get_next_low(
return(NULL);
}
+ ut_ad(page_rec_is_infimum(rec)
+ || !(rec_get_info_bits(page + offs, comp)
+ & REC_INFO_MIN_REC_FLAG));
+
return(page + offs);
}
diff --git a/storage/innobase/page/page0cur.cc b/storage/innobase/page/page0cur.cc
index 4071db7b4d9..90c0dd377e1 100644
--- a/storage/innobase/page/page0cur.cc
+++ b/storage/innobase/page/page0cur.cc
@@ -2421,10 +2421,6 @@ page_cur_delete_rec(
if (cur_n_owned <= PAGE_DIR_SLOT_MIN_N_OWNED) {
page_dir_balance_slot(page, page_zip, cur_slot_no);
}
-
-#ifdef UNIV_ZIP_DEBUG
- ut_a(!page_zip || page_zip_validate(page_zip, page, index));
-#endif /* UNIV_ZIP_DEBUG */
}
#ifdef UNIV_COMPILE_TEST_FUNCS
diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc
index 9e3e58efa3a..d6abec57821 100644
--- a/storage/innobase/page/page0zip.cc
+++ b/storage/innobase/page/page0zip.cc
@@ -4291,10 +4291,6 @@ page_zip_clear_rec(
} else {
ut_ad(!rec_offs_any_extern(offsets));
}
-
-#ifdef UNIV_ZIP_DEBUG
- ut_a(page_zip_validate(page_zip, page, index));
-#endif /* UNIV_ZIP_DEBUG */
}
/**********************************************************************//**