diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2017-08-24 10:13:07 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2017-08-24 10:19:17 +0300 |
commit | e7bf8bca2fca1f0794485d8cb78b816f3ba6b142 (patch) | |
tree | 3b75238c3fd0c101d63e9f317380679d8049faef /mysql-test/suite/innodb | |
parent | ae0759ad45b9b5d7c67000f8095f7f693e2187b7 (diff) | |
download | mariadb-git-e7bf8bca2fca1f0794485d8cb78b816f3ba6b142.tar.gz |
MDEV-13534 InnoDB STATS_PERSISTENT fails to ignore garbage delete-mark flag on node pointer pages
This bug was a regression caused by MDEV-12698.
On non-leaf pages, the delete-mark flag in the node pointer records is
basically garbage. (Delete-marking only makes sense at the leaf level
anyway. The purpose of the delete-mark is to tell MVCC, locking and purge
that a leaf-level record does not exist in the READ UNCOMMITTED view,
but it used to exist.)
Node pointer records and non-leaf pages are glue that attaches multiple
leaf pages to an index. This glue is supposed to be transparent to the
transactional layer.
When a page is split, InnoDB creates a node pointer record out of the
child page record that the cursor is positioned on. The node pointer record
for the parent page will be a copy of the child page record, amended with
the child page number. If the child page record happened to carry the
delete-mark flag, then the node pointer record would also carry this flag
(even though the flag makes no sense outside child pages).
(On a related note, for the first node pointer record in the first
node pointer page of each tree level, if the MIN_REC_FLAG is set,
the rest of the record contents (except the child page number)
is basically garbage. From this garbage you could deduce at which point
the child was originally split.)
page_scan_method_t: Replace with bool, as there are only 2 values.
dict_stats_scan_page(): Replace the parameter scan_method with is_leaf.
Ignore the bogus (garbage) delete-mark flag if !is_leaf.
Diffstat (limited to 'mysql-test/suite/innodb')
-rw-r--r-- | mysql-test/suite/innodb/r/innodb_stats_persistent_debug.result | 23 | ||||
-rw-r--r-- | mysql-test/suite/innodb/t/innodb_stats_persistent_debug.test | 32 |
2 files changed, 55 insertions, 0 deletions
diff --git a/mysql-test/suite/innodb/r/innodb_stats_persistent_debug.result b/mysql-test/suite/innodb/r/innodb_stats_persistent_debug.result new file mode 100644 index 00000000000..9f93f05fd56 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_stats_persistent_debug.result @@ -0,0 +1,23 @@ +# +# MDEV-13534 InnoDB STATS_PERSISTENT fails to ignore +# garbage delete-mark flag on node pointer pages +# +CREATE TABLE t(a INT UNSIGNED PRIMARY KEY) +ENGINE=InnoDB STATS_PERSISTENT=1 STATS_SAMPLE_PAGES=1; +BEGIN; +SET @save_debug = @@GLOBAL.innodb_limit_optimistic_insert_debug; +SET GLOBAL innodb_limit_optimistic_insert_debug=2; +INSERT t VALUES(1),(5); +DELETE FROM t; +INSERT t VALUES(4); +DELETE FROM t; +INSERT t VALUES(3); +DELETE FROM t; +SET GLOBAL innodb_limit_optimistic_insert_debug = @save_debug; +connect con1, localhost, root,,; +ANALYZE TABLE t; +Table Op Msg_type Msg_text +test.t analyze status OK +disconnect con1; +connection default; +DROP TABLE t; diff --git a/mysql-test/suite/innodb/t/innodb_stats_persistent_debug.test b/mysql-test/suite/innodb/t/innodb_stats_persistent_debug.test new file mode 100644 index 00000000000..7b16fa15f73 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_stats_persistent_debug.test @@ -0,0 +1,32 @@ +--source include/have_innodb.inc +--source include/have_debug.inc + +--echo # +--echo # MDEV-13534 InnoDB STATS_PERSISTENT fails to ignore +--echo # garbage delete-mark flag on node pointer pages +--echo # + +CREATE TABLE t(a INT UNSIGNED PRIMARY KEY) +ENGINE=InnoDB STATS_PERSISTENT=1 STATS_SAMPLE_PAGES=1; + +BEGIN; +# Create an index tree of height 3. +# This is adapted from innodb.innodb_bug14676111. + +SET @save_debug = @@GLOBAL.innodb_limit_optimistic_insert_debug; +SET GLOBAL innodb_limit_optimistic_insert_debug=2; + +INSERT t VALUES(1),(5); +DELETE FROM t; +INSERT t VALUES(4); +DELETE FROM t; +INSERT t VALUES(3); +DELETE FROM t; +SET GLOBAL innodb_limit_optimistic_insert_debug = @save_debug; + +connect(con1, localhost, root,,); +ANALYZE TABLE t; +disconnect con1; + +connection default; +DROP TABLE t; |