Commit 51c89873 authored by inaam's avatar inaam

branches/zip rb://182

Call fsync() on datafiles after a batch of pages is written to disk
even when skip_innodb_doublewrite is set.

Approved by: Heikki
parent 6642d470
...@@ -303,6 +303,28 @@ buf_flush_write_complete( ...@@ -303,6 +303,28 @@ buf_flush_write_complete(
} }
} }
/********************************************************************//**
Flush a batch of writes to the datafiles that have already been
written by the OS. */
static
void
buf_flush_sync_datafiles(void)
/*==========================*/
{
/* Wake possible simulated aio thread to actually post the
writes to the operating system */
os_aio_simulated_wake_handler_threads();
/* Wait that all async writes to tablespaces have been posted to
the OS */
os_aio_wait_until_no_pending_writes();
/* Now we flush the data to disk (for example, with fsync) */
fil_flush_file_spaces(FIL_TABLESPACE);
return;
}
/********************************************************************//** /********************************************************************//**
Flushes possible buffered writes from the doublewrite memory buffer to disk, Flushes possible buffered writes from the doublewrite memory buffer to disk,
and also wakes up the aio thread if simulated aio is used. It is very and also wakes up the aio thread if simulated aio is used. It is very
...@@ -320,8 +342,8 @@ buf_flush_buffered_writes(void) ...@@ -320,8 +342,8 @@ buf_flush_buffered_writes(void)
ulint i; ulint i;
if (!srv_use_doublewrite_buf || trx_doublewrite == NULL) { if (!srv_use_doublewrite_buf || trx_doublewrite == NULL) {
os_aio_simulated_wake_handler_threads(); /* Sync the writes to the disk. */
buf_flush_sync_datafiles();
return; return;
} }
...@@ -529,22 +551,10 @@ buf_flush_buffered_writes(void) ...@@ -529,22 +551,10 @@ buf_flush_buffered_writes(void)
buf_LRU_stat_inc_io(); buf_LRU_stat_inc_io();
} }
/* Wake possible simulated aio thread to actually post the /* Sync the writes to the disk. */
writes to the operating system */ buf_flush_sync_datafiles();
os_aio_simulated_wake_handler_threads();
/* Wait that all async writes to tablespaces have been posted to
the OS */
os_aio_wait_until_no_pending_writes();
/* Now we flush the data to disk (for example, with fsync) */
fil_flush_file_spaces(FIL_TABLESPACE);
/* We can now reuse the doublewrite memory buffer: */ /* We can now reuse the doublewrite memory buffer: */
trx_doublewrite->first_free = 0; trx_doublewrite->first_free = 0;
mutex_exit(&(trx_doublewrite->mutex)); mutex_exit(&(trx_doublewrite->mutex));
......
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