summaryrefslogtreecommitdiff
path: root/innobase/trx/trx0sys.c
diff options
context:
space:
mode:
Diffstat (limited to 'innobase/trx/trx0sys.c')
-rw-r--r--innobase/trx/trx0sys.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/innobase/trx/trx0sys.c b/innobase/trx/trx0sys.c
index b29ffb4b3bf..6c9776560bd 100644
--- a/innobase/trx/trx0sys.c
+++ b/innobase/trx/trx0sys.c
@@ -20,12 +20,43 @@ Created 3/26/1996 Heikki Tuuri
#include "srv0srv.h"
#include "trx0purge.h"
#include "log0log.h"
+#include "os0file.h"
/* The transaction system */
trx_sys_t* trx_sys = NULL;
trx_doublewrite_t* trx_doublewrite = NULL;
/********************************************************************
+Determines if a page number is located inside the doublewrite buffer. */
+
+ibool
+trx_doublewrite_page_inside(
+/*========================*/
+ /* out: TRUE if the location is inside
+ the two blocks of the doublewrite buffer */
+ ulint page_no) /* in: page number */
+{
+ if (trx_doublewrite == NULL) {
+
+ return(FALSE);
+ }
+
+ if (page_no >= trx_doublewrite->block1
+ && page_no < trx_doublewrite->block1
+ + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
+ return(TRUE);
+ }
+
+ if (page_no >= trx_doublewrite->block2
+ && page_no < trx_doublewrite->block2
+ + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
+ return(TRUE);
+ }
+
+ return(FALSE);
+}
+
+/********************************************************************
Creates or initialializes the doublewrite buffer at a database start. */
static
void
@@ -36,6 +67,11 @@ trx_doublewrite_init(
{
trx_doublewrite = mem_alloc(sizeof(trx_doublewrite_t));
+ /* When we have the doublewrite buffer in use, we do not need to
+ call os_file_flush (Unix fsync) after every write. */
+
+ os_do_not_call_flush_at_each_write = TRUE;
+
mutex_create(&(trx_doublewrite->mutex));
mutex_set_level(&(trx_doublewrite->mutex), SYNC_DOUBLEWRITE);