mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-6076: Preserve PAGE_ROOT_AUTO_INC when emptying pages.
Thanks to Zhangyuan from Alibaba for pointing out this bug. btr_page_empty(): When a clustered index root page is emptied, preserve PAGE_ROOT_AUTO_INC. This would occur during a page split. page_create_empty(): Preserve PAGE_ROOT_AUTO_INC when a clustered index root page becomes empty. Use a faster method for writing the field. page_zip_copy_recs(): Reset PAGE_MAX_TRX_ID when copying clustered index pages. We must clear the field when the root page was a leaf page and it is being split, so that PAGE_MAX_TRX_ID will continue to be 0 in clustered index non-root pages. page_create_zip(): Add debug assertions for validating PAGE_MAX_TRX_ID and PAGE_ROOT_AUTO_INC.
This commit is contained in:
@ -382,6 +382,23 @@ ALTER TABLE mdev6076a ADD COLUMN a SERIAL FIRST, LOCK=NONE;
|
||||
ALTER TABLE mdev6076a ADD COLUMN a SERIAL FIRST, ALGORITHM=INPLACE;
|
||||
ALTER TABLE mdev6076b ADD COLUMN a SERIAL FIRST, AUTO_INCREMENT=100,
|
||||
ALGORITHM=INPLACE;
|
||||
--echo # MDEV-6076: Test root page split and page_create_empty()
|
||||
CREATE TABLE mdev6076empty (b SERIAL, pad CHAR(255) NOT NULL DEFAULT '')
|
||||
ENGINE=InnoDB;
|
||||
BEGIN;
|
||||
--echo # Insert records in descending order of AUTO_INCREMENT,
|
||||
--echo # causing a page split on the very last insert.
|
||||
--echo # Without the fix in btr_page_empty() this would lose the counter value.
|
||||
--echo # Without the fix in page_create_empty() the counter value would be lost
|
||||
--echo # when ROLLBACK deletes the last row.
|
||||
--disable_query_log
|
||||
let $i= 55;
|
||||
while ($i) {
|
||||
eval INSERT INTO mdev6076empty SET b=$i;
|
||||
dec $i;
|
||||
}
|
||||
--enable_query_log
|
||||
ROLLBACK;
|
||||
|
||||
--source include/kill_and_restart_mysqld.inc
|
||||
|
||||
@ -392,7 +409,9 @@ INSERT INTO mdev6076a SET b=NULL;
|
||||
SELECT * FROM mdev6076a;
|
||||
INSERT INTO mdev6076b SET b=NULL;
|
||||
SELECT * FROM mdev6076b;
|
||||
DROP TABLE mdev6076a, mdev6076b;
|
||||
INSERT INTO mdev6076empty SET b=NULL;
|
||||
SELECT * FROM mdev6076empty;
|
||||
DROP TABLE mdev6076a, mdev6076b, mdev6076empty;
|
||||
|
||||
INSERT INTO t3 VALUES(0), (0), (200), (210);
|
||||
|
||||
|
Reference in New Issue
Block a user