MDEV-24637 fts_slots is being accessed after it gets freed

fts_optimize_callback() could be called after processing
FTS_MSG_STOP due to timer initiated callback. This issue
is caused by commit 38fd7b7d
(MDEV-21452). In that case, fts_optimize_callback() should
check whether it processed FTS_MSG_STOP already.

Reviewed-by: Marko Mäkelä
parent 1936b3c8
...@@ -2797,15 +2797,16 @@ static void fts_optimize_callback(void *) ...@@ -2797,15 +2797,16 @@ static void fts_optimize_callback(void *)
{ {
ut_ad(!srv_read_only_mode); ut_ad(!srv_read_only_mode);
if (!fts_optimize_wq) { static ulint current;
static bool done;
static ulint n_optimize;
if (!fts_optimize_wq || done) {
/* Possibly timer initiated callback, can come after FTS_MSG_STOP.*/ /* Possibly timer initiated callback, can come after FTS_MSG_STOP.*/
return; return;
} }
static ulint current = 0;
static ibool done = FALSE;
static ulint n_tables = ib_vector_size(fts_slots); static ulint n_tables = ib_vector_size(fts_slots);
static ulint n_optimize = 0;
while (!done && srv_shutdown_state <= SRV_SHUTDOWN_INITIATED) { while (!done && srv_shutdown_state <= SRV_SHUTDOWN_INITIATED) {
/* If there is no message in the queue and we have tables /* If there is no message in the queue and we have tables
...@@ -2846,7 +2847,7 @@ static void fts_optimize_callback(void *) ...@@ -2846,7 +2847,7 @@ static void fts_optimize_callback(void *)
switch (msg->type) { switch (msg->type) {
case FTS_MSG_STOP: case FTS_MSG_STOP:
done = TRUE; done = true;
break; break;
case FTS_MSG_ADD_TABLE: case FTS_MSG_ADD_TABLE:
......
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