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; ...@@ -509,6 +509,12 @@ SELECT * FROM t1;
b c a b c a
NULL NULL NULL NULL NULL NULL
DROP TABLE t1; 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 CREATE TABLE t1
(id INT PRIMARY KEY, c2 INT UNIQUE, (id INT PRIMARY KEY, c2 INT UNIQUE,
c3 POINT NOT NULL DEFAULT ST_GeomFromText('POINT(3 4)'), c3 POINT NOT NULL DEFAULT ST_GeomFromText('POINT(3 4)'),
...@@ -964,6 +970,12 @@ SELECT * FROM t1; ...@@ -964,6 +970,12 @@ SELECT * FROM t1;
b c a b c a
NULL NULL NULL NULL NULL NULL
DROP TABLE t1; 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 CREATE TABLE t1
(id INT PRIMARY KEY, c2 INT UNIQUE, (id INT PRIMARY KEY, c2 INT UNIQUE,
c3 POINT NOT NULL DEFAULT ST_GeomFromText('POINT(3 4)'), c3 POINT NOT NULL DEFAULT ST_GeomFromText('POINT(3 4)'),
...@@ -1419,10 +1431,16 @@ SELECT * FROM t1; ...@@ -1419,10 +1431,16 @@ SELECT * FROM t1;
b c a b c a
NULL NULL NULL NULL NULL NULL
DROP TABLE t1; 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; disconnect analyze;
SELECT variable_value-@old_instant instants SELECT variable_value-@old_instant instants
FROM information_schema.global_status FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column'; WHERE variable_name = 'innodb_instant_alter_column';
instants instants
69 72
SET GLOBAL innodb_purge_rseg_truncate_frequency= @saved_frequency; 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; ...@@ -383,6 +383,13 @@ ALTER TABLE t1 ADD COLUMN b INT FIRST, ADD COLUMN c INT AFTER b;
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE 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; dec $format;
} }
disconnect analyze; disconnect analyze;
......
...@@ -1660,11 +1660,6 @@ btr_page_reorganize_low( ...@@ -1660,11 +1660,6 @@ btr_page_reorganize_low(
goto func_exit; 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); data_size2 = page_get_data_size(page);
max_ins_size2 = page_get_max_insert_size_after_reorganize(page, 1); max_ins_size2 = page_get_max_insert_size_after_reorganize(page, 1);
...@@ -1688,33 +1683,41 @@ btr_page_reorganize_low( ...@@ -1688,33 +1683,41 @@ btr_page_reorganize_low(
ut_ad(cursor->rec == page_get_infimum_rec(page)); ut_ad(cursor->rec == page_get_infimum_rec(page));
} }
func_exit:
#ifdef UNIV_ZIP_DEBUG #ifdef UNIV_ZIP_DEBUG
ut_a(!page_zip || page_zip_validate(page_zip, page, index)); ut_a(!page_zip || page_zip_validate(page_zip, page, index));
#endif /* UNIV_ZIP_DEBUG */ #endif /* UNIV_ZIP_DEBUG */
if (!recovery && page_is_root(temp_page) if (!recovery) {
&& fil_page_get_type(temp_page) == FIL_PAGE_TYPE_INSTANT) { if (page_is_root(temp_page)
/* Preserve the PAGE_INSTANT information. */ && fil_page_get_type(temp_page) == FIL_PAGE_TYPE_INSTANT) {
ut_ad(!page_zip); /* Preserve the PAGE_INSTANT information. */
ut_ad(index->is_instant()); ut_ad(!page_zip);
memcpy(FIL_PAGE_TYPE + page, FIL_PAGE_TYPE + temp_page, 2); ut_ad(index->is_instant());
memcpy(PAGE_HEADER + PAGE_INSTANT + page, memcpy(FIL_PAGE_TYPE + page,
PAGE_HEADER + PAGE_INSTANT + temp_page, 2); FIL_PAGE_TYPE + temp_page, 2);
if (!index->table->instant) { memcpy(PAGE_HEADER + PAGE_INSTANT + page,
} else if (page_is_comp(page)) { PAGE_HEADER + PAGE_INSTANT + temp_page, 2);
memcpy(PAGE_NEW_INFIMUM + page, if (!index->table->instant) {
PAGE_NEW_INFIMUM + temp_page, 8); } else if (page_is_comp(page)) {
memcpy(PAGE_NEW_SUPREMUM + page, memcpy(PAGE_NEW_INFIMUM + page,
PAGE_NEW_SUPREMUM + temp_page, 8); PAGE_NEW_INFIMUM + temp_page, 8);
} else { memcpy(PAGE_NEW_SUPREMUM + page,
memcpy(PAGE_OLD_INFIMUM + page, PAGE_NEW_SUPREMUM + temp_page, 8);
PAGE_OLD_INFIMUM + temp_page, 8); } else {
memcpy(PAGE_OLD_SUPREMUM + page, memcpy(PAGE_OLD_INFIMUM + page,
PAGE_OLD_SUPREMUM + temp_page, 8); 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); buf_block_free(temp_block);
/* Restore logging mode */ /* 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