Commit c1e695c9 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-17763 Assertion `len == 20U' failed in rec_convert_dtuple_to_rec_comp on DROP COLUMN

btr_cur_pessimistic_insert(): Convert the metadata field of the metadata
record into BLOB before inserting, just like btr_cur_optimistic_insert()
does.
parent 2681ca04
......@@ -578,6 +578,40 @@ id f
1 NULL
2 NULL
DROP TABLE t1;
CREATE TABLE t1 (
pk INT PRIMARY KEY,
f1 INT,
f2 CHAR(255),
f3 BIGINT,
f4 INT,
f5 CHAR(255),
f6 CHAR(255),
f7 CHAR(255) NOT NULL,
f8 INT,
f9 CHAR(10)
) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
INSERT INTO t1 VALUES
(1, 1, 'a', 1, 1, 'a', 'a', 'a', 1, 'a'),
(2, 2, 'b', 2, 2, 'b', 'b', 'b', 2, 'b'),
(3, 3, 'c', 3, 3, 'c', 'c', 'c', 3, 'c'),
(4, 4, 'd', 4, 4, 'd', 'd', 'd', 4, 'd'),
(5, 5, 'e', 5, 5, 'e', 'e', 'e', 5, 'e'),
(6, 6, 'f', 6, 6, 'f', 'f', 'f', 6, 'f'),
(7, 7, 'g', 7, 7, 'g', 'g', 'g', 7, 'g'),
(8, 8, 'h', 8, 8, 'h', 'h', 'h', 8, 'h'),
(9, 9, 'i', 9, 9, 'i', 'i', 'i', 9, 'i'),
(10, 0, 'j', 0, 0, 'j', 'j', 'j', 0, 'j'),
(11, 1, 'k', 1, 1, 'k', 'k', 'k', 1, 'k'),
(12, 2, 'l', 2, 2, 'l', 'l', 'l', 2, 'l'),
(13, 3, 'm', 3, 3, 'm', 'm', 'm', 3, 'm'),
(14, 4, 'n', 4, 4, 'n', 'n', 'n', 4, 'n'),
(15, 5, 'o', 5, 5, 'o', 'o', 'o', 5, 'o');
DELETE FROM t1 WHERE pk=1;
InnoDB 0 transactions not purged
INSERT INTO t1 VALUES
(1, 1, 'a', 1, 1, 'a', 'a', 'a', 1, 'a');
ALTER TABLE t1 DROP COLUMN f1;
DROP TABLE t1;
CREATE TABLE t1
(id INT PRIMARY KEY, c2 INT UNIQUE,
c3 POINT NOT NULL DEFAULT ST_GeomFromText('POINT(3 4)'),
......@@ -1102,6 +1136,40 @@ id f
1 NULL
2 NULL
DROP TABLE t1;
CREATE TABLE t1 (
pk INT PRIMARY KEY,
f1 INT,
f2 CHAR(255),
f3 BIGINT,
f4 INT,
f5 CHAR(255),
f6 CHAR(255),
f7 CHAR(255) NOT NULL,
f8 INT,
f9 CHAR(10)
) ENGINE=InnoDB ROW_FORMAT=COMPACT;
INSERT INTO t1 VALUES
(1, 1, 'a', 1, 1, 'a', 'a', 'a', 1, 'a'),
(2, 2, 'b', 2, 2, 'b', 'b', 'b', 2, 'b'),
(3, 3, 'c', 3, 3, 'c', 'c', 'c', 3, 'c'),
(4, 4, 'd', 4, 4, 'd', 'd', 'd', 4, 'd'),
(5, 5, 'e', 5, 5, 'e', 'e', 'e', 5, 'e'),
(6, 6, 'f', 6, 6, 'f', 'f', 'f', 6, 'f'),
(7, 7, 'g', 7, 7, 'g', 'g', 'g', 7, 'g'),
(8, 8, 'h', 8, 8, 'h', 'h', 'h', 8, 'h'),
(9, 9, 'i', 9, 9, 'i', 'i', 'i', 9, 'i'),
(10, 0, 'j', 0, 0, 'j', 'j', 'j', 0, 'j'),
(11, 1, 'k', 1, 1, 'k', 'k', 'k', 1, 'k'),
(12, 2, 'l', 2, 2, 'l', 'l', 'l', 2, 'l'),
(13, 3, 'm', 3, 3, 'm', 'm', 'm', 3, 'm'),
(14, 4, 'n', 4, 4, 'n', 'n', 'n', 4, 'n'),
(15, 5, 'o', 5, 5, 'o', 'o', 'o', 5, 'o');
DELETE FROM t1 WHERE pk=1;
InnoDB 0 transactions not purged
INSERT INTO t1 VALUES
(1, 1, 'a', 1, 1, 'a', 'a', 'a', 1, 'a');
ALTER TABLE t1 DROP COLUMN f1;
DROP TABLE t1;
CREATE TABLE t1
(id INT PRIMARY KEY, c2 INT UNIQUE,
c3 POINT NOT NULL DEFAULT ST_GeomFromText('POINT(3 4)'),
......@@ -1626,10 +1694,44 @@ id f
1 NULL
2 NULL
DROP TABLE t1;
CREATE TABLE t1 (
pk INT PRIMARY KEY,
f1 INT,
f2 CHAR(255),
f3 BIGINT,
f4 INT,
f5 CHAR(255),
f6 CHAR(255),
f7 CHAR(255) NOT NULL,
f8 INT,
f9 CHAR(10)
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
INSERT INTO t1 VALUES
(1, 1, 'a', 1, 1, 'a', 'a', 'a', 1, 'a'),
(2, 2, 'b', 2, 2, 'b', 'b', 'b', 2, 'b'),
(3, 3, 'c', 3, 3, 'c', 'c', 'c', 3, 'c'),
(4, 4, 'd', 4, 4, 'd', 'd', 'd', 4, 'd'),
(5, 5, 'e', 5, 5, 'e', 'e', 'e', 5, 'e'),
(6, 6, 'f', 6, 6, 'f', 'f', 'f', 6, 'f'),
(7, 7, 'g', 7, 7, 'g', 'g', 'g', 7, 'g'),
(8, 8, 'h', 8, 8, 'h', 'h', 'h', 8, 'h'),
(9, 9, 'i', 9, 9, 'i', 'i', 'i', 9, 'i'),
(10, 0, 'j', 0, 0, 'j', 'j', 'j', 0, 'j'),
(11, 1, 'k', 1, 1, 'k', 'k', 'k', 1, 'k'),
(12, 2, 'l', 2, 2, 'l', 'l', 'l', 2, 'l'),
(13, 3, 'm', 3, 3, 'm', 'm', 'm', 3, 'm'),
(14, 4, 'n', 4, 4, 'n', 'n', 'n', 4, 'n'),
(15, 5, 'o', 5, 5, 'o', 'o', 'o', 5, 'o');
DELETE FROM t1 WHERE pk=1;
InnoDB 0 transactions not purged
INSERT INTO t1 VALUES
(1, 1, 'a', 1, 1, 'a', 'a', 'a', 1, 'a');
ALTER TABLE t1 DROP COLUMN f1;
DROP TABLE t1;
disconnect analyze;
SELECT variable_value-@old_instant instants
FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';
instants
114
117
SET GLOBAL innodb_purge_rseg_truncate_frequency= @saved_frequency;
......@@ -447,6 +447,45 @@ ALTER TABLE t1 ADD COLUMN id INT NOT NULL AUTO_INCREMENT FIRST, ADD KEY(id);
SELECT * FROM t1;
DROP TABLE t1;
# MDEV-17763 Assertion `len == 20U' failed in rec_convert_dtuple_to_rec_comp
# upon DROP COLUMN
eval CREATE TABLE t1 (
pk INT PRIMARY KEY,
f1 INT,
f2 CHAR(255),
f3 BIGINT,
f4 INT,
f5 CHAR(255),
f6 CHAR(255),
f7 CHAR(255) NOT NULL,
f8 INT,
f9 CHAR(10)
) $engine;
INSERT INTO t1 VALUES
(1, 1, 'a', 1, 1, 'a', 'a', 'a', 1, 'a'),
(2, 2, 'b', 2, 2, 'b', 'b', 'b', 2, 'b'),
(3, 3, 'c', 3, 3, 'c', 'c', 'c', 3, 'c'),
(4, 4, 'd', 4, 4, 'd', 'd', 'd', 4, 'd'),
(5, 5, 'e', 5, 5, 'e', 'e', 'e', 5, 'e'),
(6, 6, 'f', 6, 6, 'f', 'f', 'f', 6, 'f'),
(7, 7, 'g', 7, 7, 'g', 'g', 'g', 7, 'g'),
(8, 8, 'h', 8, 8, 'h', 'h', 'h', 8, 'h'),
(9, 9, 'i', 9, 9, 'i', 'i', 'i', 9, 'i'),
(10, 0, 'j', 0, 0, 'j', 'j', 'j', 0, 'j'),
(11, 1, 'k', 1, 1, 'k', 'k', 'k', 1, 'k'),
(12, 2, 'l', 2, 2, 'l', 'l', 'l', 2, 'l'),
(13, 3, 'm', 3, 3, 'm', 'm', 'm', 3, 'm'),
(14, 4, 'n', 4, 4, 'n', 'n', 'n', 4, 'n'),
(15, 5, 'o', 5, 5, 'o', 'o', 'o', 5, 'o');
DELETE FROM t1 WHERE pk=1;
--source include/wait_all_purged.inc
INSERT INTO t1 VALUES
(1, 1, 'a', 1, 1, 'a', 'a', 'a', 1, 'a');
ALTER TABLE t1 DROP COLUMN f1;
DROP TABLE t1;
dec $format;
}
disconnect analyze;
......
......@@ -3661,10 +3661,16 @@ btr_cur_pessimistic_insert(
}
}
DBUG_ASSERT(!entry->is_alter_metadata()
|| !dfield_is_ext(
dtuple_get_nth_field(entry,
index->first_user_field())));
if (page_zip_rec_needs_ext(rec_get_converted_size(index, entry, n_ext),
dict_table_is_comp(index->table),
dtuple_get_n_fields(entry),
dict_table_page_size(index->table))) {
dict_table_page_size(index->table))
|| UNIV_UNLIKELY(entry->is_alter_metadata())) {
/* The record is so big that we have to store some fields
externally on separate database pages */
......
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