Commit 301bd62b authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-17820 Assertion failed on instant DROP COLUMN

btr_cur_pessimistic_insert(): Do not attempt to convert the
metadata BLOB to external storage if it has already been converted.
It could have been converted by btr_cur_pessimistic_update().
Relax some over-zealous assertions.

dtuple_convert_big_rec(): Assert that the metadata BLOB has
not been converted yet.
parent 6bd5c555
......@@ -498,6 +498,70 @@ INSERT INTO t1 VALUES
ALTER TABLE t1 DROP COLUMN f1;
DROP TABLE t1;
# MDEV-17820 Assertion failures on DROP COLUMN
eval CREATE TABLE t1 (
pk INT PRIMARY KEY,
f1 INT, f2 CHAR(32) NOT NULL,
f3 INT NOT NULL, f4 INT NOT NULL, f5 INT, f6 CHAR(32) NOT NULL,
f7 CHAR(32), f8 CHAR(32)
) $engine;
INSERT INTO t1 VALUES
(1,9,'',2,88,88,'','',''),(2,48,'',8,68,92,'','',''),
(3,41,'',56,84,37,'','',''),(4,NULL,'',6,6,NULL,'','',''),
(5,52,'',37,44,20,'','',''),(6,44,'',53,4,NULL,'','',''),
(7,24,'',54,8,54,'','',''),(8,80,'',3,52,20,'','',''),
(9,71,'',34,32,NULL,'','',''),(10,14,'',6,64,88,'','',''),
(11,48,'',8,25,42,'','',''),(12,16,'',8,7,NULL,'','',''),
(13,NULL,'',22,0,95,'','',''),(14,4,'',72,48,NULL,'','',''),
(15,4,'',5,64,2,'','',''),(16,NULL,'',9,40,30,'','',''),
(17,92,'',48,2,NULL,'','',''),(18,36,'',48,51,7,'','',''),
(19,NULL,'',80,96,NULL,'','',''),(20,96,'',9,80,NULL,'','',''),
(21,50,'',16,40,NULL,'','',''),(22,NULL,'',7,84,8,'','',''),
(23,28,'',93,80,NULL,'','',''),(24,31,'',40,38,NULL,'','',''),
(25,85,'',8,5,88,'','',''),(26,66,'',8,32,4,'','',''),
(51,52,'',6,92,15,'','',''),(52,77,'',24,24,28,'','',''),
(53,8,'',75,31,NULL,'','',''),(54,48,'',5,8,1,'','',''),
(55,90,'',56,12,5,'','',''),(56,92,'',4,9,88,'','',''),
(57,83,'',23,40,72,'','',''),(58,7,'',4,40,32,'','',''),
(59,28,'',2,3,32,'','',''),(60,16,'',80,4,NULL,'','',''),
(61,44,'',88,24,NULL,'','',''),(62,4,'',5,25,3,'','',''),
(63,NULL,'',7,24,76,'','',''),(64,0,'',13,40,73,'','',''),
(101,NULL,'',1,49,75,'','',''),(102,34,'',10,17,20,'','',''),
(103,8,'',2,2,NULL,'','',''),(104,12,'',44,48,52,'','',''),
(105,8,'',4,19,38,'','',''),(106,20,'',6,80,9,'','',''),
(107,72,'',72,16,56,'','',''),(108,76,'',98,24,21,'','',''),
(109,67,'',16,91,NULL,'','',''),(110,72,'',72,3,48,'','',''),
(151,8,'',3,86,NULL,'','',''),(152,NULL,'',52,72,0,'','',''),
(153,NULL,'',46,30,92,'','',''),(154,80,'',1,40,48,'','',''),
(155,24,'',68,68,8,'','',''),(156,85,'',85,72,60,'','',''),
(157,7,'',7,12,6,'','',''),(158,NULL,'',48,48,80,'','',''),
(159,12,'',0,36,0,'','',''),(160,2,'',6,52,NULL,'','',''),
(201,0,'',1,3,NULL,'','',''),(202,NULL,'',3,53,14,'','',''),
(203,84,'',6,20,NULL,'','',''),(204,38,'',25,13,88,'','',''),
(205,1,'',2,69,5,'','',''),(206,7,'',60,22,NULL,'','',''),
(207,NULL,'',5,4,NULL,'','',''),(251,7,'',0,4,40,'','',''),
(252,4,'',16,8,NULL,'','',''),(253,14,'',60,12,99,'','',''),
(254,84,'',68,16,5,'','',''),(255,3,'',70,36,61,'','',''),
(256,7,'',18,48,NULL,'','',''),(257,NULL,'',68,53,NULL,'','',''),
(258,29,'',52,16,64,'','',''),(259,NULL,'',80,92,40,'','',''),
(301,68,'',1,48,48,'','',''),(302,2,'',1,1,32,'','',''),
(303,44,'',60,96,16,'','',''),(304,32,'',52,64,32,'','',''),
(305,88,'',37,72,NULL,'','',''),(306,5,'',35,60,20,'','',''),
(307,35,'',4,48,NULL,'','',''),(308,4,'',92,44,80,'','',''),
(351,48,'',60,4,40,'','',''),(352,7,'',9,61,13,'','',''),
(353,0,'',5,93,53,'','',''),(354,7,'',1,20,NULL,'','',''),
(355,84,'',5,48,96,'','',''),(356,NULL,'',39,92,36,'','',''),
(357,88,'',9,76,44,'','',''),(358,66,'',34,67,80,'','',''),
(359,8,'',8,52,NULL,'','',''),(360,3,'',53,83,NULL,'','',''),
(361,23,'',44,9,48,'','',''),(362,4,'',0,54,48,'','',''),
(363,75,'',66,76,52,'','','');
ALTER TABLE t1 ADD COLUMN x VARCHAR(255) DEFAULT ' foobar ';
UPDATE t1 SET f1 = 0;
ALTER TABLE t1 DROP COLUMN x;
DROP TABLE t1;
eval CREATE TABLE t1 (f1 VARCHAR(1), f2 VARCHAR(2)) $engine;
ALTER TABLE t1 MODIFY f2 VARCHAR (8) FIRST;
DROP TABLE t1;
......
......@@ -3,7 +3,7 @@
Copyright (c) 1994, 2018, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2015, 2018, MariaDB Corporation.
Copyright (c) 2015, 2019, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
......@@ -3693,16 +3693,15 @@ 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),
index->table->not_redundant(),
dtuple_get_n_fields(entry),
btr_cur_get_block(cursor)->page.size)
|| UNIV_UNLIKELY(entry->is_alter_metadata())) {
|| UNIV_UNLIKELY(entry->is_alter_metadata()
&& !dfield_is_ext(
dtuple_get_nth_field(
entry,
index->first_user_field())))) {
/* The record is so big that we have to store some fields
externally on separate database pages */
......@@ -3777,8 +3776,8 @@ btr_cur_pessimistic_insert(
if (entry->info_bits & REC_INFO_MIN_REC_FLAG) {
ut_ad(entry->is_metadata());
ut_ad(index->is_instant());
ut_ad((flags & ulint(~BTR_KEEP_IBUF_BITMAP))
== BTR_NO_LOCKING_FLAG);
ut_ad(flags & BTR_NO_LOCKING_FLAG);
ut_ad(!(flags & BTR_CREATE_FLAG));
} else {
btr_search_update_hash_on_insert(
cursor, btr_get_search_latch(index));
......
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2018, MariaDB Corporation.
Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
......@@ -643,6 +643,7 @@ dtuple_convert_big_rec(
longest_i = index->first_user_field();
dfield = dtuple_get_nth_field(entry, longest_i);
local_len = BTR_EXTERN_FIELD_REF_SIZE;
ut_ad(!dfield_is_ext(dfield));
goto ext_write;
}
......
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