Skip to content

Commit d2f7ec7

Browse files
BUG#27899274 - [MYSQL 8.0 GA DEBUG BUILD] ASSERTION `!IS_SET()' FAILED.
When mysqld is started with thread_stack option value of zero, an ALTER TABLE DDL SQL asserts on debug build. The root cause is the diagnostics area is set with a OK status whereas it has already been set with an ERROR status. The fix ensures the stack overrun error is propagated so that the call to set the diagnostics area with OK status is avoided.
1 parent 8f55c71 commit d2f7ec7

File tree

3 files changed

+36
-2
lines changed

3 files changed

+36
-2
lines changed

mysql-test/r/alter_debug.result

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#
2+
# BUG#27899274 - [MYSQL 8.0 GA DEBUG BUILD] ASSERTION `!IS_SET()' FAILED.
3+
#
4+
#
5+
CREATE TABLE test.t1(col INT);
6+
SET SESSION debug= "+d, enable_stack_overrun_post_alter_commit";
7+
ALTER TABLE test.t1 ADD COLUMN col1 CHAR;
8+
Got one of the listed errors
9+
SET SESSION debug= "-d, enable_stack_overrun_post_alter_commit";
10+
DROP TABLE test.t1;

mysql-test/t/alter_debug.test

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--source include/have_debug.inc
2+
3+
--echo #
4+
--echo # BUG#27899274 - [MYSQL 8.0 GA DEBUG BUILD] ASSERTION `!IS_SET()' FAILED.
5+
--echo #
6+
--echo #
7+
8+
CREATE TABLE test.t1(col INT);
9+
SET SESSION debug= "+d, enable_stack_overrun_post_alter_commit";
10+
# Suppress exact error message as it contains numbers which may not be identical
11+
# across platforms
12+
--error ER_STACK_OVERRUN_NEED_MORE,ER_STACK_OVERRUN_NEED_MORE
13+
ALTER TABLE test.t1 ADD COLUMN col1 CHAR;
14+
SET SESSION debug= "-d, enable_stack_overrun_post_alter_commit";
15+
DROP TABLE test.t1;

storage/innobase/dict/dict0dd.cc

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3343,8 +3343,12 @@ dberr_t dd_table_load_fk(dd::cache::Dictionary_client *client,
33433343
mutex_exit(&dict_sys->mutex);
33443344
}
33453345

3346+
DBUG_EXECUTE_IF("enable_stack_overrun_post_alter_commit",
3347+
{ DBUG_SET("+d,simulate_stack_overrun"); });
33463348
err = dd_table_check_for_child(client, tbl_name, col_names, m_table, dd_table,
33473349
thd, check_charsets, ignore_err, fk_tables);
3350+
DBUG_EXECUTE_IF("enable_stack_overrun_post_alter_commit",
3351+
{ DBUG_SET("-d,simulate_stack_overrun"); });
33483352

33493353
if (dict_locked) {
33503354
mutex_enter(&dict_sys->mutex);
@@ -4081,8 +4085,13 @@ dict_table_t *dd_open_table_one(dd::cache::Dictionary_client *client,
40814085
/* Load foreign key info. It could also register child table(s) that
40824086
refers to current table */
40834087
if (exist == nullptr) {
4084-
dd_table_load_fk(client, norm_name, nullptr, m_table, &dd_table->table(),
4085-
thd, false, true, &fk_list);
4088+
dberr_t error =
4089+
dd_table_load_fk(client, norm_name, nullptr, m_table,
4090+
&dd_table->table(), thd, false, true, &fk_list);
4091+
if (error != DB_SUCCESS) {
4092+
dict_table_close(m_table, FALSE, FALSE);
4093+
m_table = nullptr;
4094+
}
40864095
}
40874096
mem_heap_free(heap);
40884097

0 commit comments

Comments
 (0)