mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
Merge bk-internal:/home/bk/mysql-4.1-maint
into neptunus.(none):/home/msvensson/mysql/mysql-4.1-maint
This commit is contained in:
commit
4a1869b1b2
1 changed files with 33 additions and 15 deletions
|
@ -4252,29 +4252,47 @@ fil_flush_file_spaces(
|
|||
{
|
||||
fil_system_t* system = fil_system;
|
||||
fil_space_t* space;
|
||||
ulint* space_ids;
|
||||
ulint n_space_ids;
|
||||
ulint i;
|
||||
|
||||
mutex_enter(&(system->mutex));
|
||||
|
||||
space = UT_LIST_GET_FIRST(system->unflushed_spaces);
|
||||
n_space_ids = UT_LIST_GET_LEN(system->unflushed_spaces);
|
||||
if (n_space_ids == 0) {
|
||||
|
||||
mutex_exit(&system->mutex);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Assemble a list of space ids to flush. Previously, we
|
||||
traversed system->unflushed_spaces and called UT_LIST_GET_NEXT()
|
||||
on a space that was just removed from the list by fil_flush().
|
||||
Thus, the space could be dropped and the memory overwritten. */
|
||||
space_ids = mem_alloc(n_space_ids * sizeof *space_ids);
|
||||
|
||||
n_space_ids = 0;
|
||||
|
||||
for (space = UT_LIST_GET_FIRST(system->unflushed_spaces);
|
||||
space;
|
||||
space = UT_LIST_GET_NEXT(unflushed_spaces, space)) {
|
||||
|
||||
while (space) {
|
||||
if (space->purpose == purpose && !space->is_being_deleted) {
|
||||
|
||||
space->n_pending_flushes++; /* prevent dropping of the
|
||||
space while we are
|
||||
flushing */
|
||||
mutex_exit(&(system->mutex));
|
||||
|
||||
fil_flush(space->id);
|
||||
|
||||
mutex_enter(&(system->mutex));
|
||||
|
||||
space->n_pending_flushes--;
|
||||
space_ids[n_space_ids++] = space->id;
|
||||
}
|
||||
space = UT_LIST_GET_NEXT(unflushed_spaces, space);
|
||||
}
|
||||
|
||||
mutex_exit(&(system->mutex));
|
||||
|
||||
mutex_exit(&system->mutex);
|
||||
|
||||
/* Flush the spaces. It will not hurt to call fil_flush() on
|
||||
a non-existing space id. */
|
||||
for (i = 0; i < n_space_ids; i++) {
|
||||
|
||||
fil_flush(space_ids[i]);
|
||||
}
|
||||
|
||||
mem_free(space_ids);
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
|
|
Loading…
Reference in a new issue