summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@sun.com>2009-11-03 14:02:19 +0400
committerSergey Vojtovich <svoj@sun.com>2009-11-03 14:02:19 +0400
commit8494bb83d9415a119a4561a66d84d468a8bfcd90 (patch)
treef82c801f9beba28058b24b359635f58623a26948 /storage
parent10456f81c2c645fb6011dae91f8f1e75962e2895 (diff)
downloadmariadb-git-8494bb83d9415a119a4561a66d84d468a8bfcd90.tar.gz
Applying InnoDB plugin snashot
Detailed revision comments: r6064 | calvin | 2009-10-13 18:23:35 +0300 (Tue, 13 Oct 2009) | 4 lines branches/zip: non-functional changes Changes from MySQL to fix build issue. r6065 | inaam | 2009-10-13 20:43:13 +0300 (Tue, 13 Oct 2009) | 7 lines 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
Diffstat (limited to 'storage')
-rw-r--r--storage/innodb_plugin/buf/buf0flu.c42
1 files changed, 26 insertions, 16 deletions
diff --git a/storage/innodb_plugin/buf/buf0flu.c b/storage/innodb_plugin/buf/buf0flu.c
index 74dd0c07ca6..8b614ce90e5 100644
--- a/storage/innodb_plugin/buf/buf0flu.c
+++ b/storage/innodb_plugin/buf/buf0flu.c
@@ -304,6 +304,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,
and also wakes up the aio thread if simulated aio is used. It is very
important to call this function after a batch of writes has been posted,
@@ -320,8 +342,8 @@ buf_flush_buffered_writes(void)
ulint i;
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;
}
@@ -529,22 +551,10 @@ flush:
buf_LRU_stat_inc_io();
}
- /* 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);
+ /* Sync the writes to the disk. */
+ buf_flush_sync_datafiles();
/* We can now reuse the doublewrite memory buffer: */
-
trx_doublewrite->first_free = 0;
mutex_exit(&(trx_doublewrite->mutex));