Commit f0da84c3 authored by Michael Widenius's avatar Michael Widenius

Fixes Bug #40711 "Maria crash in my_no_flags_free"

storage/maria/ma_close.c:
  Reset state_history when closing file.
  This fixes a race condition when the checkpoint is using the file while the file is beeing closed.
  The bug was that checkpoint was accessing the freed state_history.
parent 9aa2ada9
......@@ -155,7 +155,7 @@ int maria_close(register MARIA_HA *info)
MARIA_STATE_HISTORY_CLOSED *history;
/*
Here we ignore the unlikely case that we don't have memory to
store the case. In the worst case what happens is that any transaction
store the state. In the worst case what happens is that any transaction
that tries to access this table will get a wrong status information.
*/
if ((history= (MARIA_STATE_HISTORY_CLOSED *)
......@@ -166,6 +166,8 @@ int maria_close(register MARIA_HA *info)
if (my_hash_insert(&maria_stored_state, (uchar*) history))
my_free(history, MYF(0));
}
/* Marker for concurrent checkpoint */
share->state_history= 0;
}
}
pthread_mutex_unlock(&THR_LOCK_maria);
......
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