Skip to content
Permalink
Browse files
MDEV-18149 Crash after DROP COLUMN of AUTO_INCREMENT column on nonemp…
…ty table

commit_cache_norebuild(): Restore the MDEV-17901 fix that was reverted
as part of the MDEV-18076/MDEV-18077 fix. It was not redundant after all.
  • Loading branch information
dr-m committed Jan 17, 2019
1 parent 9dc81d2 commit 5fb4e4a
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
@@ -578,6 +578,15 @@ id f
1 NULL
2 NULL
DROP TABLE t1;
CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT, f INT, KEY(id)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
INSERT INTO t1 SET f=NULL;
ALTER TABLE t1 DROP COLUMN id;
INSERT INTO t1 SET f=NULL;
SELECT * FROM t1;
f
NULL
NULL
DROP TABLE t1;
CREATE TABLE t1(f INT, k INT NOT NULL AUTO_INCREMENT, KEY(k)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
ALTER TABLE t1 DROP COLUMN f;
INSERT INTO t1 VALUES (1);
@@ -1239,6 +1248,15 @@ id f
1 NULL
2 NULL
DROP TABLE t1;
CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT, f INT, KEY(id)) ENGINE=InnoDB ROW_FORMAT=COMPACT;
INSERT INTO t1 SET f=NULL;
ALTER TABLE t1 DROP COLUMN id;
INSERT INTO t1 SET f=NULL;
SELECT * FROM t1;
f
NULL
NULL
DROP TABLE t1;
CREATE TABLE t1(f INT, k INT NOT NULL AUTO_INCREMENT, KEY(k)) ENGINE=InnoDB ROW_FORMAT=COMPACT;
ALTER TABLE t1 DROP COLUMN f;
INSERT INTO t1 VALUES (1);
@@ -1900,6 +1918,15 @@ id f
1 NULL
2 NULL
DROP TABLE t1;
CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT, f INT, KEY(id)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
INSERT INTO t1 SET f=NULL;
ALTER TABLE t1 DROP COLUMN id;
INSERT INTO t1 SET f=NULL;
SELECT * FROM t1;
f
NULL
NULL
DROP TABLE t1;
CREATE TABLE t1(f INT, k INT NOT NULL AUTO_INCREMENT, KEY(k)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
ALTER TABLE t1 DROP COLUMN f;
INSERT INTO t1 VALUES (1);
@@ -2042,5 +2069,5 @@ SELECT variable_value-@old_instant instants
FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';
instants
155
158
SET GLOBAL innodb_purge_rseg_truncate_frequency= @saved_frequency;
@@ -447,6 +447,14 @@ ALTER TABLE t1 ADD COLUMN id INT NOT NULL AUTO_INCREMENT FIRST, ADD KEY(id);
SELECT * FROM t1;
DROP TABLE t1;

# MDEV-18149 Crash after DROP COLUMN of AUTO_INCREMENT column on nonempty table
eval CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT, f INT, KEY(id)) $engine;
INSERT INTO t1 SET f=NULL;
ALTER TABLE t1 DROP COLUMN id;
INSERT INTO t1 SET f=NULL;
SELECT * FROM t1;
DROP TABLE t1;

# MDEV-18076/MDEV-18077 Crash on AUTO_INCREMENT column after instant DROP
eval CREATE TABLE t1(f INT, k INT NOT NULL AUTO_INCREMENT, KEY(k)) $engine;
ALTER TABLE t1 DROP COLUMN f;
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2005, 2018, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2013, 2018, MariaDB Corporation.
Copyright (c) 2013, 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
@@ -10359,6 +10359,10 @@ commit_cache_norebuild(
}
}
}

if (!ctx->instant_table->persistent_autoinc) {
ctx->new_table->persistent_autoinc = 0;
}
}

if (ha_alter_info->handler_flags & ALTER_COLUMN_UNVERSIONED) {

0 comments on commit 5fb4e4a

Please sign in to comment.