Skip to content
/ server Public

Commit 5b6ad32

Browse files
MDEV-38667 Assertion in diagnostics area on DDL stats timeout
Reason: ====== During InnoDB DDL, statistics updation fails due to lock wait timeout and calls push_warning_printf() to generate warnings but then returns success, causing the SQL layer to attempt calling set_ok_status() when the diagnostics area is already set. Solution: ========= By temporarily setting abort_on_warning to false around operations that prevents warning to error escalation and restore the original setting after calling HA_EXTRA_END_ALTER_COPY for alter operation.
1 parent 12578d8 commit 5b6ad32

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

mysql-test/suite/innodb/r/alter_copy_stats.result

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,13 @@ n_rows database_name lower(table_name)
103103
# Test Cleanup.
104104
DROP TABLE t1;
105105
DROP TABLE t2;
106+
#
107+
# MDEV-38667 Assertion in diagnostics area on DDL stats timeout
108+
#
109+
set @lock_wait_timeout= @@global.innodb_lock_wait_timeout;
110+
SET innodb_lock_wait_timeout = 1;
111+
CREATE TABLE t ENGINE=InnoDB AS SELECT * FROM mysql.innodb_table_stats;
112+
Warnings:
113+
Warning 1088 Error updating stats for table after table rebuild: Lock wait timeout
114+
SET innodb_lock_wait_timeout = @lock_wait_timeout;
115+
DROP TABLE t;

mysql-test/suite/innodb/t/alter_copy_stats.test

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,12 @@ FROM mysql.innodb_table_stats WHERE table_name LIKE '%t2%';
8888
--echo # Test Cleanup.
8989
DROP TABLE t1;
9090
DROP TABLE t2;
91+
92+
--echo #
93+
--echo # MDEV-38667 Assertion in diagnostics area on DDL stats timeout
94+
--echo #
95+
set @lock_wait_timeout= @@global.innodb_lock_wait_timeout;
96+
SET innodb_lock_wait_timeout = 1;
97+
CREATE TABLE t ENGINE=InnoDB AS SELECT * FROM mysql.innodb_table_stats;
98+
SET innodb_lock_wait_timeout = @lock_wait_timeout;
99+
DROP TABLE t;

sql/sql_insert.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4382,7 +4382,14 @@ bool select_insert::prepare_eof()
43824382
if (info.ignore || info.handle_duplicates != DUP_ERROR)
43834383
if (table->file->ha_table_flags() & HA_DUPLICATE_POS)
43844384
table->file->ha_rnd_end();
4385+
4386+
/* Don't convert the warning to error in case
4387+
statistics updation fails */
4388+
bool save_abort_on_warning= thd->abort_on_warning;
4389+
thd->abort_on_warning= false;
43854390
table->file->extra(HA_EXTRA_END_ALTER_COPY);
4391+
thd->abort_on_warning= save_abort_on_warning;
4392+
43864393
table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
43874394
table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
43884395

0 commit comments

Comments
 (0)