Commit 34f2f4fa authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-14660 Assertion failure in lock_move_rec_list_start() after instant ADD COLUMN

lock_move_rec_list_start(): Relax a too strict assertion.
This function can be invoked on the leftmost leaf page, after all.
So, the first record of each page can be a 'default row' record,
but the 'default row' record must never be locked.
parent e4efbfd9
......@@ -353,6 +353,22 @@ id c2 c4 c5 c6 c8 phrase b
3 3 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 1970-01-01 The quick brown fox jumps over the lazy dog
4 0 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 1970-01-01 The quick brown fox jumps over the lazy dog 😱
5 9 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 1970-01-01 ääH binary line of business
CREATE TABLE t4
(id INT, foo INT DEFAULT 0, c1 VARCHAR(4000),
p GEOMETRY NOT NULL DEFAULT ST_GeomFromText('LINESTRING(0 0,0 1,1 1)'),
PRIMARY KEY(id,foo))
ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
INSERT INTO t4 (id,c1) VALUES (1, REPEAT('a', 4000)), (2, REPEAT('a', 4000));
ALTER TABLE t4 ADD COLUMN d1 INT;
BEGIN;
UPDATE t4 SET c1 = repeat('1', 4000), foo=1 WHERE id=1;
INSERT INTO t4 (id,c1) VALUES (1, REPEAT('a', 4000));
UPDATE t4 SET c1 = repeat('2', 4000), foo=1 WHERE id=2;
ROLLBACK;
BEGIN;
UPDATE t4 SET d1 = 1,foo=2 WHERE id=1;
INSERT INTO t4 (id,foo,c1) VALUES (1, 1, REPEAT('1', 4000));
COMMIT;
CREATE TABLE big
(id INT PRIMARY KEY, c1 VARCHAR(4000), c2 VARCHAR(4000), c3 VARCHAR(1000),
p POINT NOT NULL DEFAULT ST_GeomFromText('POINT(0 0)'), SPATIAL INDEX(p))
......@@ -413,7 +429,7 @@ clust_index_size
3
connection default;
InnoDB 0 transactions not purged
DROP TABLE t1,t2,t3,big;
DROP TABLE t1,t2,t3,t4,big;
CREATE TABLE t1
(id INT PRIMARY KEY, c2 INT UNIQUE,
c3 POINT NOT NULL DEFAULT ST_GeomFromText('POINT(3 4)'),
......@@ -713,6 +729,22 @@ id c2 c4 c5 c6 c8 phrase b
3 3 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 1970-01-01 The quick brown fox jumps over the lazy dog
4 0 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 1970-01-01 The quick brown fox jumps over the lazy dog 😱
5 9 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 1970-01-01 ääH binary line of business
CREATE TABLE t4
(id INT, foo INT DEFAULT 0, c1 VARCHAR(4000),
p GEOMETRY NOT NULL DEFAULT ST_GeomFromText('LINESTRING(0 0,0 1,1 1)'),
PRIMARY KEY(id,foo))
ENGINE=InnoDB ROW_FORMAT=COMPACT;
INSERT INTO t4 (id,c1) VALUES (1, REPEAT('a', 4000)), (2, REPEAT('a', 4000));
ALTER TABLE t4 ADD COLUMN d1 INT;
BEGIN;
UPDATE t4 SET c1 = repeat('1', 4000), foo=1 WHERE id=1;
INSERT INTO t4 (id,c1) VALUES (1, REPEAT('a', 4000));
UPDATE t4 SET c1 = repeat('2', 4000), foo=1 WHERE id=2;
ROLLBACK;
BEGIN;
UPDATE t4 SET d1 = 1,foo=2 WHERE id=1;
INSERT INTO t4 (id,foo,c1) VALUES (1, 1, REPEAT('1', 4000));
COMMIT;
CREATE TABLE big
(id INT PRIMARY KEY, c1 VARCHAR(4000), c2 VARCHAR(4000), c3 VARCHAR(1000),
p POINT NOT NULL DEFAULT ST_GeomFromText('POINT(0 0)'), SPATIAL INDEX(p))
......@@ -773,7 +805,7 @@ clust_index_size
3
connection default;
InnoDB 0 transactions not purged
DROP TABLE t1,t2,t3,big;
DROP TABLE t1,t2,t3,t4,big;
CREATE TABLE t1
(id INT PRIMARY KEY, c2 INT UNIQUE,
c3 POINT NOT NULL DEFAULT ST_GeomFromText('POINT(3 4)'),
......@@ -1073,6 +1105,22 @@ id c2 c4 c5 c6 c8 phrase b
3 3 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 1970-01-01 The quick brown fox jumps over the lazy dog
4 0 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 1970-01-01 The quick brown fox jumps over the lazy dog 😱
5 9 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 1970-01-01 ääH binary line of business
CREATE TABLE t4
(id INT, foo INT DEFAULT 0, c1 VARCHAR(4000),
p GEOMETRY NOT NULL DEFAULT ST_GeomFromText('LINESTRING(0 0,0 1,1 1)'),
PRIMARY KEY(id,foo))
ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
INSERT INTO t4 (id,c1) VALUES (1, REPEAT('a', 4000)), (2, REPEAT('a', 4000));
ALTER TABLE t4 ADD COLUMN d1 INT;
BEGIN;
UPDATE t4 SET c1 = repeat('1', 4000), foo=1 WHERE id=1;
INSERT INTO t4 (id,c1) VALUES (1, REPEAT('a', 4000));
UPDATE t4 SET c1 = repeat('2', 4000), foo=1 WHERE id=2;
ROLLBACK;
BEGIN;
UPDATE t4 SET d1 = 1,foo=2 WHERE id=1;
INSERT INTO t4 (id,foo,c1) VALUES (1, 1, REPEAT('1', 4000));
COMMIT;
CREATE TABLE big
(id INT PRIMARY KEY, c1 VARCHAR(4000), c2 VARCHAR(4000), c3 VARCHAR(1000),
p POINT NOT NULL DEFAULT ST_GeomFromText('POINT(0 0)'), SPATIAL INDEX(p))
......@@ -1133,11 +1181,11 @@ clust_index_size
3
connection default;
InnoDB 0 transactions not purged
DROP TABLE t1,t2,t3,big;
DROP TABLE t1,t2,t3,t4,big;
disconnect analyze;
SELECT variable_value-@old_instant instants
FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';
instants
30
33
SET GLOBAL innodb_purge_rseg_truncate_frequency= @saved_frequency;
......@@ -236,6 +236,26 @@ ALTER TABLE t3 DROP c3, DROP c7;
--disable_info
SELECT * FROM t3;
eval CREATE TABLE t4
(id INT, foo INT DEFAULT 0, c1 VARCHAR(4000),
p GEOMETRY NOT NULL DEFAULT ST_GeomFromText('LINESTRING(0 0,0 1,1 1)'),
PRIMARY KEY(id,foo))
$engine;
INSERT INTO t4 (id,c1) VALUES (1, REPEAT('a', 4000)), (2, REPEAT('a', 4000));
ALTER TABLE t4 ADD COLUMN d1 INT;
BEGIN;
UPDATE t4 SET c1 = repeat('1', 4000), foo=1 WHERE id=1;
INSERT INTO t4 (id,c1) VALUES (1, REPEAT('a', 4000));
UPDATE t4 SET c1 = repeat('2', 4000), foo=1 WHERE id=2;
ROLLBACK;
BEGIN;
UPDATE t4 SET d1 = 1,foo=2 WHERE id=1;
INSERT INTO t4 (id,foo,c1) VALUES (1, 1, REPEAT('1', 4000));
COMMIT;
eval CREATE TABLE big
(id INT PRIMARY KEY, c1 VARCHAR(4000), c2 VARCHAR(4000), c3 VARCHAR(1000),
p POINT NOT NULL DEFAULT ST_GeomFromText('POINT(0 0)'), SPATIAL INDEX(p))
......@@ -279,7 +299,7 @@ WHERE name = 'test/big';
connection default;
--source include/wait_all_purged.inc
DROP TABLE t1,t2,t3,big;
DROP TABLE t1,t2,t3,t4,big;
dec $format;
}
......
......@@ -3833,8 +3833,9 @@ lock_move_rec_list_start(
reset the lock bits on the old */
while (rec1 != rec) {
ut_ad(!page_rec_is_default_row(rec1));
ut_ad(!page_rec_is_default_row(rec2));
ut_ad(page_rec_is_default_row(rec1)
== page_rec_is_default_row(rec2));
ut_d(const rec_t* const prev = rec1);
ulint rec1_heap_no;
ulint rec2_heap_no;
......@@ -3858,6 +3859,8 @@ lock_move_rec_list_start(
if (rec1_heap_no < lock->un_member.rec_lock.n_bits
&& lock_rec_reset_nth_bit(lock, rec1_heap_no)) {
ut_ad(!page_rec_is_default_row(prev));
if (type_mode & LOCK_WAIT) {
lock_reset_lock_and_trx_wait(lock);
}
......
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