Skip to content

Commit 12b1ba1

Browse files
committed
MDEV-17904 Crash in fts_is_sync_needed() after failed ALTER or CREATE TABLE
create_table_def(), ha_innobase::create(): Defer fts_optimize_add_table() until after the table has been successfully created.
1 parent daca7e7 commit 12b1ba1

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

storage/innobase/handler/ha_innodb.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9371,10 +9371,6 @@ create_table_def(
93719371
: ER_TABLESPACE_EXISTS, MYF(0), display_name);
93729372
}
93739373

9374-
if (err == DB_SUCCESS && (flags2 & DICT_TF2_FTS)) {
9375-
fts_optimize_add_table(table);
9376-
}
9377-
93789374
error_ret:
93799375
DBUG_RETURN(convert_error_code_to_mysql(err, flags, thd));
93809376
}
@@ -10441,6 +10437,10 @@ ha_innobase::create(
1044110437
trx_free_for_mysql(trx);
1044210438
DBUG_RETURN(-1);
1044310439
}
10440+
10441+
mutex_enter(&dict_sys->mutex);
10442+
fts_optimize_add_table(innobase_table);
10443+
mutex_exit(&dict_sys->mutex);
1044410444
}
1044510445

1044610446
/* Note: We can't call update_thd() as prebuilt will not be

storage/xtradb/handler/ha_innodb.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10143,10 +10143,6 @@ create_table_def(
1014310143
: ER_TABLESPACE_EXISTS, MYF(0), display_name);
1014410144
}
1014510145

10146-
if (err == DB_SUCCESS && (flags2 & DICT_TF2_FTS)) {
10147-
fts_optimize_add_table(table);
10148-
}
10149-
1015010146
error_ret:
1015110147
DBUG_RETURN(convert_error_code_to_mysql(err, flags, thd));
1015210148
}
@@ -11218,6 +11214,10 @@ ha_innobase::create(
1121811214
trx_free_for_mysql(trx);
1121911215
DBUG_RETURN(-1);
1122011216
}
11217+
11218+
mutex_enter(&dict_sys->mutex);
11219+
fts_optimize_add_table(innobase_table);
11220+
mutex_exit(&dict_sys->mutex);
1122111221
}
1122211222

1122311223
/* Note: We can't call update_thd() as prebuilt will not be

0 commit comments

Comments
 (0)