Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
N/A
-
None
Description
Before MDEV-33449, REPAIR on InnoDB stat tables wasn't supported. Now it is, and in some circumstances it leads to concurrency errors like the one here
[ERROR] InnoDB: Table mysql.innodb_table_stats not found
|
or lock wait timeouts.
The use case as such (REPAIR on a stat table and concurrent ALTER) may be not that important, but I'm not at all sure it's limited to ALTER, and in general, when a part of operations in question involve activities happening under the hood, which a user has no control of (here it is doing something with the statistical table upon ALTER), it's potentially problematic.
The test case is for reproducing purposes only, don't put it into the regression suite!
--source include/have_innodb.inc
|
|
CREATE TABLE t1 (a int) STATS_PERSISTENT=1 ENGINE=InnoDB; |
INSERT INTO t1 VALUES (1),(2); |
|
--connect (con1,localhost,root,,)
|
--let $con1= `select connection_id()`
|
--delimiter $
|
--send
|
loop
|
ALTER TABLE t1 COMMENT 'comment', ALGORITHM=COPY; |
end loop $ |
--delimiter ;
|
|
--connection default
|
--let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err
|
--let SEARCH_PATTERN= Table .* not found
|
--let $run= 100
|
SET lock_wait_timeout= 1, innodb_lock_wait_timeout= 1; |
while ($run)
|
{
|
REPAIR TABLE mysql.innodb_table_stats; |
if ($mysql_errno) { |
--echo # Got error $mysql_errno upon ALTER |
}
|
--source include/search_pattern_in_file.inc |
if ($SEARCH_RESULT) { |
die # FOUND the error line in the log; |
}
|
--dec $run |
}
|
--eval KILL $con1
|
|
# Cleanup
|
DROP TABLE t1; |
When it hits the problem, which happens always for me, it says
mysqltest: At line 31: # FOUND the error line in the log
|
and the error log contains the error line
2024-04-20 1:36:57 5 [ERROR] InnoDB: Table mysql.innodb_table_stats not found.
|
Additionally, lock wait timeouts can be seen in the test output:
REPAIR TABLE mysql.innodb_table_stats;
|
Table Op Msg_type Msg_text
|
mysql.innodb_table_stats repair Error Lock wait timeout exceeded; try restarting transaction
|
mysql.innodb_table_stats repair status Table is already up to date
|
Attachments
Issue Links
- is caused by
-
MDEV-33449 improving repair of tables
- Closed
- relates to
-
MDEV-33993 Possible server hang on DROP INDEX or RENAME INDEX
- Closed