Commit 4c800788 authored by Marko Mäkelä's avatar Marko Mäkelä

Fix a harmless debug assertion failure

btr_page_reorganize_low(): Call lock_move_reorganize_page()
only after restoring the "infimum" and "supremum" records,
to avoid an assertion failure that these records differ.
parent 927ceb14
......@@ -509,6 +509,12 @@ SELECT * FROM t1;
b c a
NULL NULL NULL
DROP TABLE t1;
CREATE TABLE t1 (t TEXT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
SET @t=REPEAT('x',@@innodb_page_size / 2);
INSERT INTO t1 VALUES (@t),(@t),(@t),(@t),(@t),(@t),(NULL),(@t),(@t),(@t),(@t);
ALTER TABLE t1 ADD COLUMN a INT FIRST;
UPDATE t1 SET a = 0;
DROP TABLE t1;
CREATE TABLE t1
(id INT PRIMARY KEY, c2 INT UNIQUE,
c3 POINT NOT NULL DEFAULT ST_GeomFromText('POINT(3 4)'),
......@@ -964,6 +970,12 @@ SELECT * FROM t1;
b c a
NULL NULL NULL
DROP TABLE t1;
CREATE TABLE t1 (t TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT;
SET @t=REPEAT('x',@@innodb_page_size / 2);
INSERT INTO t1 VALUES (@t),(@t),(@t),(@t),(@t),(@t),(NULL),(@t),(@t),(@t),(@t);
ALTER TABLE t1 ADD COLUMN a INT FIRST;
UPDATE t1 SET a = 0;
DROP TABLE t1;
CREATE TABLE t1
(id INT PRIMARY KEY, c2 INT UNIQUE,
c3 POINT NOT NULL DEFAULT ST_GeomFromText('POINT(3 4)'),
......@@ -1419,10 +1431,16 @@ SELECT * FROM t1;
b c a
NULL NULL NULL
DROP TABLE t1;
CREATE TABLE t1 (t TEXT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
SET @t=REPEAT('x',@@innodb_page_size / 2);
INSERT INTO t1 VALUES (@t),(@t),(@t),(@t),(@t),(@t),(NULL),(@t),(@t),(@t),(@t);
ALTER TABLE t1 ADD COLUMN a INT FIRST;
UPDATE t1 SET a = 0;
DROP TABLE t1;
disconnect analyze;
SELECT variable_value-@old_instant instants
FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';
instants
69
72
SET GLOBAL innodb_purge_rseg_truncate_frequency= @saved_frequency;
......@@ -383,6 +383,13 @@ ALTER TABLE t1 ADD COLUMN b INT FIRST, ADD COLUMN c INT AFTER b;
SELECT * FROM t1;
DROP TABLE t1;
eval CREATE TABLE t1 (t TEXT) $engine;
SET @t=REPEAT('x',@@innodb_page_size / 2);
INSERT INTO t1 VALUES (@t),(@t),(@t),(@t),(@t),(@t),(NULL),(@t),(@t),(@t),(@t);
ALTER TABLE t1 ADD COLUMN a INT FIRST;
UPDATE t1 SET a = 0;
DROP TABLE t1;
dec $format;
}
disconnect analyze;
......
......@@ -1660,11 +1660,6 @@ btr_page_reorganize_low(
goto func_exit;
}
if (!recovery && !dict_table_is_locking_disabled(index->table)) {
/* Update the record lock bitmaps */
lock_move_reorganize_page(block, temp_block);
}
data_size2 = page_get_data_size(page);
max_ins_size2 = page_get_max_insert_size_after_reorganize(page, 1);
......@@ -1688,33 +1683,41 @@ btr_page_reorganize_low(
ut_ad(cursor->rec == page_get_infimum_rec(page));
}
func_exit:
#ifdef UNIV_ZIP_DEBUG
ut_a(!page_zip || page_zip_validate(page_zip, page, index));
#endif /* UNIV_ZIP_DEBUG */
if (!recovery && page_is_root(temp_page)
&& fil_page_get_type(temp_page) == FIL_PAGE_TYPE_INSTANT) {
/* Preserve the PAGE_INSTANT information. */
ut_ad(!page_zip);
ut_ad(index->is_instant());
memcpy(FIL_PAGE_TYPE + page, FIL_PAGE_TYPE + temp_page, 2);
memcpy(PAGE_HEADER + PAGE_INSTANT + page,
PAGE_HEADER + PAGE_INSTANT + temp_page, 2);
if (!index->table->instant) {
} else if (page_is_comp(page)) {
memcpy(PAGE_NEW_INFIMUM + page,
PAGE_NEW_INFIMUM + temp_page, 8);
memcpy(PAGE_NEW_SUPREMUM + page,
PAGE_NEW_SUPREMUM + temp_page, 8);
} else {
memcpy(PAGE_OLD_INFIMUM + page,
PAGE_OLD_INFIMUM + temp_page, 8);
memcpy(PAGE_OLD_SUPREMUM + page,
PAGE_OLD_SUPREMUM + temp_page, 8);
if (!recovery) {
if (page_is_root(temp_page)
&& fil_page_get_type(temp_page) == FIL_PAGE_TYPE_INSTANT) {
/* Preserve the PAGE_INSTANT information. */
ut_ad(!page_zip);
ut_ad(index->is_instant());
memcpy(FIL_PAGE_TYPE + page,
FIL_PAGE_TYPE + temp_page, 2);
memcpy(PAGE_HEADER + PAGE_INSTANT + page,
PAGE_HEADER + PAGE_INSTANT + temp_page, 2);
if (!index->table->instant) {
} else if (page_is_comp(page)) {
memcpy(PAGE_NEW_INFIMUM + page,
PAGE_NEW_INFIMUM + temp_page, 8);
memcpy(PAGE_NEW_SUPREMUM + page,
PAGE_NEW_SUPREMUM + temp_page, 8);
} else {
memcpy(PAGE_OLD_INFIMUM + page,
PAGE_OLD_INFIMUM + temp_page, 8);
memcpy(PAGE_OLD_SUPREMUM + page,
PAGE_OLD_SUPREMUM + temp_page, 8);
}
}
if (!dict_table_is_locking_disabled(index->table)) {
/* Update the record lock bitmaps */
lock_move_reorganize_page(block, temp_block);
}
}
func_exit:
buf_block_free(temp_block);
/* Restore logging mode */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment