mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
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.
This commit is contained in:
@ -248,3 +248,17 @@ SELECT NEXTVAL(s);
|
|||||||
NEXTVAL(s)
|
NEXTVAL(s)
|
||||||
1
|
1
|
||||||
DROP SEQUENCE s;
|
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;
|
ALTER TABLE s ORDER BY cache_size;
|
||||||
SELECT NEXTVAL(s);
|
SELECT NEXTVAL(s);
|
||||||
DROP SEQUENCE 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 @@ err_exit:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!table->no_rollback())
|
if (!table->no_rollback())
|
||||||
{
|
|
||||||
err= trx->drop_table_foreign(table->name);
|
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 && table_stats && index_stats)
|
||||||
if (err != DB_SUCCESS)
|
err= trx->drop_table_statistics(table->name);
|
||||||
goto err_exit;
|
if (err != DB_SUCCESS)
|
||||||
}
|
goto err_exit;
|
||||||
|
|
||||||
err= trx->drop_table(*table);
|
err= trx->drop_table(*table);
|
||||||
if (err != DB_SUCCESS)
|
if (err != DB_SUCCESS)
|
||||||
|
Reference in New Issue
Block a user