mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-23801 Assertion failed in btr_pcur_store_position()
btr_lift_page_up(): If the leaf page only contains a hidden metadata record for MDEV-11369 instant ADD COLUMN, convert the table to the canonical format like we are supposed to do whenever the table becomes empty.
This commit is contained in:
@ -201,4 +201,36 @@ SELECT * FROM t1;
|
||||
c1 c2 c3
|
||||
1 0 10
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-23801 Assertion index->table->instant... failed
|
||||
# in btr_pcur_store_position()
|
||||
#
|
||||
SET @save_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
|
||||
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
|
||||
CREATE TABLE t (
|
||||
pk int auto_increment,
|
||||
c01 char(255) not null default repeat('a',255),
|
||||
c02 char(255) default repeat('a',255),
|
||||
c03 char(255) default repeat('a',255),
|
||||
c04 char(255) default repeat('a',255),
|
||||
c05 char(255) not null default repeat('a',255),
|
||||
c06 char(255) default repeat('a',255),
|
||||
c07 char(255) default repeat('a',255),
|
||||
c08 char(255) not null default repeat('a',255),
|
||||
c09 char(255) default repeat('a',255),
|
||||
c10 char(255) default repeat('a',255),
|
||||
c11 char(255) default repeat('a',255),
|
||||
c12 char(255) not null default repeat('a',255),
|
||||
primary key (pk)
|
||||
) ENGINE=InnoDB CHARACTER SET ucs2;
|
||||
INSERT INTO t () VALUES ();
|
||||
ALTER TABLE t ADD c INT;
|
||||
BEGIN;
|
||||
INSERT INTO t () VALUES (),();
|
||||
ROLLBACK;
|
||||
DELETE FROM t;
|
||||
InnoDB 0 transactions not purged
|
||||
SET GLOBAL innodb_purge_rseg_truncate_frequency = @save_frequency;
|
||||
CREATE TABLE tt ENGINE=InnoDB AS SELECT c FROM t;
|
||||
DROP TABLE t, tt;
|
||||
# End of 10.3 tests
|
||||
|
@ -204,4 +204,45 @@ ALTER TABLE t1 IMPORT TABLESPACE;
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-23801 Assertion index->table->instant... failed
|
||||
--echo # in btr_pcur_store_position()
|
||||
--echo #
|
||||
|
||||
SET @save_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
|
||||
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
|
||||
|
||||
CREATE TABLE t (
|
||||
pk int auto_increment,
|
||||
c01 char(255) not null default repeat('a',255),
|
||||
c02 char(255) default repeat('a',255),
|
||||
c03 char(255) default repeat('a',255),
|
||||
c04 char(255) default repeat('a',255),
|
||||
c05 char(255) not null default repeat('a',255),
|
||||
c06 char(255) default repeat('a',255),
|
||||
c07 char(255) default repeat('a',255),
|
||||
c08 char(255) not null default repeat('a',255),
|
||||
c09 char(255) default repeat('a',255),
|
||||
c10 char(255) default repeat('a',255),
|
||||
c11 char(255) default repeat('a',255),
|
||||
c12 char(255) not null default repeat('a',255),
|
||||
primary key (pk)
|
||||
) ENGINE=InnoDB CHARACTER SET ucs2;
|
||||
|
||||
INSERT INTO t () VALUES ();
|
||||
ALTER TABLE t ADD c INT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO t () VALUES (),();
|
||||
ROLLBACK;
|
||||
DELETE FROM t;
|
||||
|
||||
--source include/wait_all_purged.inc
|
||||
SET GLOBAL innodb_purge_rseg_truncate_frequency = @save_frequency;
|
||||
|
||||
CREATE TABLE tt ENGINE=InnoDB AS SELECT c FROM t;
|
||||
DROP TABLE t, tt;
|
||||
|
||||
--echo # End of 10.3 tests
|
||||
|
@ -3331,6 +3331,7 @@ btr_lift_page_up(
|
||||
|
||||
ut_ad(!page_has_siblings(page));
|
||||
ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
|
||||
ut_ad(!page_is_empty(page));
|
||||
|
||||
page_level = btr_page_get_level(page);
|
||||
root_page_no = dict_index_get_page(index);
|
||||
@ -3419,6 +3420,16 @@ btr_lift_page_up(
|
||||
if (index->is_instant()
|
||||
&& father_block->page.id.page_no() == root_page_no) {
|
||||
ut_ad(!father_page_zip);
|
||||
if (page_is_leaf(page)) {
|
||||
ut_d(const rec_t* rec
|
||||
= page_rec_get_next(page_get_infimum_rec(page)));
|
||||
ut_ad(rec_is_metadata(rec, index));
|
||||
if (page_get_n_recs(page) == 1) {
|
||||
index->remove_instant();
|
||||
goto copied;
|
||||
}
|
||||
}
|
||||
|
||||
byte* page_type = father_block->frame + FIL_PAGE_TYPE;
|
||||
ut_ad(mach_read_from_2(page_type) == FIL_PAGE_INDEX);
|
||||
mlog_write_ulint(page_type, FIL_PAGE_TYPE_INSTANT,
|
||||
@ -3427,8 +3438,6 @@ btr_lift_page_up(
|
||||
index->n_core_fields, mtr);
|
||||
}
|
||||
|
||||
page_level++;
|
||||
|
||||
/* Copy the records to the father page one by one. */
|
||||
if (0
|
||||
#ifdef UNIV_ZIP_COPY
|
||||
@ -3460,6 +3469,7 @@ btr_lift_page_up(
|
||||
}
|
||||
}
|
||||
|
||||
copied:
|
||||
if (!dict_table_is_locking_disabled(index->table)) {
|
||||
/* Free predicate page locks on the block */
|
||||
if (dict_index_is_spatial(index)) {
|
||||
@ -3471,6 +3481,8 @@ btr_lift_page_up(
|
||||
lock_update_copy_and_discard(father_block, block);
|
||||
}
|
||||
|
||||
page_level++;
|
||||
|
||||
/* Go upward to root page, decrementing levels by one. */
|
||||
for (i = lift_father_up ? 1 : 0; i < n_blocks; i++, page_level++) {
|
||||
page_t* page = buf_block_get_frame(blocks[i]);
|
||||
|
Reference in New Issue
Block a user