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

MDEV-31607 ER_DUP_KEY in mysql.innodb_table_stats upon RENAME on sequence

ha_innobase::delete_table(): Also on DROP SEQUENCE, do try to drop any
persistent statistics. They should really not be created for
SEQUENCE objects (which internally are 1-row no-rollback tables),
but that is how happened to always work.
parent dc1bd180
......@@ -248,3 +248,17 @@ SELECT NEXTVAL(s);
NEXTVAL(s)
1
DROP SEQUENCE s;
#
# MDEV-31607 ER_DUP_KEY in mysql.table_stats upon REANME on sequence
#
CREATE SEQUENCE s1 ENGINE=InnoDB;
CREATE SEQUENCE s2 ENGINE=InnoDB;
SHOW CREATE SEQUENCE s1;
Table Create Table
s1 CREATE SEQUENCE `s1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=InnoDB
SHOW CREATE SEQUENCE s2;
Table Create Table
s2 CREATE SEQUENCE `s2` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=InnoDB
DROP SEQUENCE s2;
RENAME TABLE s1 TO s2;
DROP SEQUENCE s2;
......@@ -161,3 +161,15 @@ CREATE SEQUENCE s;
ALTER TABLE s ORDER BY cache_size;
SELECT NEXTVAL(s);
DROP SEQUENCE s;
--echo #
--echo # MDEV-31607 ER_DUP_KEY in mysql.table_stats upon REANME on sequence
--echo #
CREATE SEQUENCE s1 ENGINE=InnoDB;
CREATE SEQUENCE s2 ENGINE=InnoDB;
SHOW CREATE SEQUENCE s1;
SHOW CREATE SEQUENCE s2;
DROP SEQUENCE s2;
RENAME TABLE s1 TO s2;
DROP SEQUENCE s2;
......@@ -13748,13 +13748,12 @@ int ha_innobase::delete_table(const char *name)
}
if (!table->no_rollback())
{
err= trx->drop_table_foreign(table->name);
if (err == DB_SUCCESS && table_stats && index_stats)
err= trx->drop_table_statistics(table->name);
if (err != DB_SUCCESS)
goto err_exit;
}
if (err == DB_SUCCESS && table_stats && index_stats)
err= trx->drop_table_statistics(table->name);
if (err != DB_SUCCESS)
goto err_exit;
err= trx->drop_table(*table);
if (err != DB_SUCCESS)
......
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