Commit 8833c24c authored by Marko Mäkelä's avatar Marko Mäkelä

Revert MDEV-29566

This reverts commit bdc5548c
that introduced a work-around to ha_innobase::delete_table()
for avoiding failures when trying to remove table partitions.

This work-around (of not removing statistics in case of a locking
conflict) would occasionally cause a failure of the test
parts.part_supported_sql_func_innodb:

mysqltest: In included file "./suite/parts/inc/partition_supported_sql_funcs.inc":
included from ./suite/parts/inc/part_supported_sql_funcs_main.inc at line 91:
included from /buildbot/amd64-ubuntu-2004-msan/build/mysql-test/suite/parts/t/part_supported_sql_func_innodb.test at line 44:
At line 234: query 'alter table t66
reorganize partition s1 into
(partition p0 values less than ($valsqlfunc),
partition p1 values less than maxvalue)' failed: ER_DUP_KEY (1022): Can't write; duplicate key in table 'mysql.innodb_table_stats'
parent bdc5548c
......@@ -2,8 +2,6 @@ CREATE DATABASE unlocked;
CREATE TABLE unlocked.t1(a INT PRIMARY KEY) ENGINE=INNODB STATS_PERSISTENT=0;
CREATE DATABASE locked;
CREATE TABLE locked.t1(a INT PRIMARY KEY) ENGINE=INNODB STATS_PERSISTENT=1;
CREATE TABLE locked.t1p(pk INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=1
PARTITION BY HASH (pk) PARTITIONS 4;
CREATE TABLE innodb_stats_drop_locked (c INT, KEY c_key (c))
ENGINE=INNODB STATS_PERSISTENT=1;
ANALYZE TABLE innodb_stats_drop_locked;
......@@ -40,25 +38,12 @@ innodb_stats_drop_locked CREATE TABLE `innodb_stats_drop_locked` (
DROP TABLE innodb_stats_drop_locked;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
DROP DATABASE unlocked;
DROP TABLE locked.t1p;
SELECT * FROM locked.t1p;
ERROR 42S02: Table 'locked.t1p' doesn't exist
DROP DATABASE locked;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
disconnect con1;
connection default;
COMMIT;
SELECT COUNT(*) FROM mysql.innodb_table_stats WHERE database_name='locked';
COUNT(*)
5
SELECT COUNT(*) FROM mysql.innodb_index_stats WHERE database_name='locked';
COUNT(*)
15
DROP DATABASE locked;
SELECT table_name FROM mysql.innodb_table_stats WHERE database_name='locked';
table_name
SELECT table_name FROM mysql.innodb_index_stats WHERE database_name='locked';
table_name
SELECT table_name FROM mysql.innodb_table_stats
WHERE table_name='innodb_stats_drop_locked';
table_name
......
......@@ -4,16 +4,12 @@
#
-- source include/have_innodb.inc
-- source include/have_partition.inc
CREATE DATABASE unlocked;
CREATE TABLE unlocked.t1(a INT PRIMARY KEY) ENGINE=INNODB STATS_PERSISTENT=0;
CREATE DATABASE locked;
CREATE TABLE locked.t1(a INT PRIMARY KEY) ENGINE=INNODB STATS_PERSISTENT=1;
CREATE TABLE locked.t1p(pk INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=1
PARTITION BY HASH (pk) PARTITIONS 4;
CREATE TABLE innodb_stats_drop_locked (c INT, KEY c_key (c))
ENGINE=INNODB STATS_PERSISTENT=1;
ANALYZE TABLE innodb_stats_drop_locked;
......@@ -39,26 +35,14 @@ SHOW CREATE TABLE innodb_stats_drop_locked;
DROP TABLE innodb_stats_drop_locked;
DROP DATABASE unlocked;
# Partitions will always be dropped despite locking conflicts.
DROP TABLE locked.t1p;
--error ER_NO_SUCH_TABLE
SELECT * FROM locked.t1p;
--error ER_LOCK_WAIT_TIMEOUT
DROP DATABASE locked;
-- disconnect con1
-- connection default
COMMIT;
SELECT COUNT(*) FROM mysql.innodb_table_stats WHERE database_name='locked';
SELECT COUNT(*) FROM mysql.innodb_index_stats WHERE database_name='locked';
DROP DATABASE locked;
SELECT table_name FROM mysql.innodb_table_stats WHERE database_name='locked';
SELECT table_name FROM mysql.innodb_index_stats WHERE database_name='locked';
# the stats should be there
SELECT table_name FROM mysql.innodb_table_stats
......
......@@ -13613,8 +13613,7 @@ int ha_innobase::delete_table(const char *name)
dict_sys.unfreeze();
}
const bool skip_wait{table->name.is_temporary() ||
dict_table_is_partition(table)};
const bool skip_wait{table->name.is_temporary()};
if (table_stats && index_stats &&
!strcmp(table_stats->name.m_name, TABLE_STATS_NAME) &&
......
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