summaryrefslogtreecommitdiff
path: root/storage/innobase/include
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-03-09 21:25:20 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2018-03-10 11:54:34 +0200
commit112df06996dd88ac1d858c4c0c321d4c6e7bbf90 (patch)
treebbd4ac5bc8852834b9cb2bab3f007902cb85a365 /storage/innobase/include
parent54765aaa4db8dacb5cca81d4628335c570e7798a (diff)
downloadmariadb-git-112df06996dd88ac1d858c4c0c321d4c6e7bbf90.tar.gz
MDEV-15529 IMPORT TABLESPACE unnecessarily uses the doublewrite buffer
fil_space_t::atomic_write_supported: Always set this flag for TEMPORARY TABLESPACE and during IMPORT TABLESPACE. The page writes during these operations are by definition not crash-safe because they are not written to the redo log. fil_space_t::use_doublewrite(): Determine if doublewrite should be used. buf_dblwr_update(): Add assertions, and let the caller check whether doublewrite buffering is desired. buf_flush_write_block_low(): Disable the doublewrite buffer for the temporary tablespace and for IMPORT TABLESPACE. fil_space_set_imported(), fil_node_open_file(), fil_space_create(): Initialize or revise the space->atomic_write_supported flag. buf_page_io_complete(), buf_flush_write_complete(): Add the parameter dblwr, to indicate whether doublewrite was used for writes. buf_dblwr_sync_datafiles(): Remove an unnecessary flush of persistent tablespaces when flushing temporary tablespaces. (Move the call to buf_dblwr_flush_buffered_writes().)
Diffstat (limited to 'storage/innobase/include')
-rw-r--r--storage/innobase/include/buf0buf.h10
-rw-r--r--storage/innobase/include/buf0flu.h10
-rw-r--r--storage/innobase/include/fil0fil.h10
3 files changed, 18 insertions, 12 deletions
diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
index 063eb6b6fab..1001f2ca807 100644
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2017, MariaDB Corporation.
+Copyright (c) 2013, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -1271,9 +1271,9 @@ buf_page_init_for_read(
bool unzip);
/** Complete a read or write request of a file page to or from the buffer pool.
-@param[in,out] bpage Page to complete
-@param[in] evict whether or not to evict the page
- from LRU list.
+@param[in,out] bpage page to complete
+@param[in] dblwr whether the doublewrite buffer was used (on write)
+@param[in] evict whether or not to evict the page from LRU list
@return whether the operation succeeded
@retval DB_SUCCESS always when writing, or if a read page was OK
@retval DB_PAGE_CORRUPTED if the checksum fails on a page read
@@ -1282,7 +1282,7 @@ buf_page_init_for_read(
not match */
UNIV_INTERN
dberr_t
-buf_page_io_complete(buf_page_t* bpage, bool evict = false)
+buf_page_io_complete(buf_page_t* bpage, bool dblwr = false, bool evict = false)
MY_ATTRIBUTE((nonnull));
/********************************************************************//**
diff --git a/storage/innobase/include/buf0flu.h b/storage/innobase/include/buf0flu.h
index ccf1d991b09..c3b518c4295 100644
--- a/storage/innobase/include/buf0flu.h
+++ b/storage/innobase/include/buf0flu.h
@@ -70,12 +70,10 @@ buf_flush_relocate_on_flush_list(
/*=============================*/
buf_page_t* bpage, /*!< in/out: control block being moved */
buf_page_t* dpage); /*!< in/out: destination block */
-/********************************************************************//**
-Updates the flush system data structures when a write is completed. */
-void
-buf_flush_write_complete(
-/*=====================*/
- buf_page_t* bpage); /*!< in: pointer to the block in question */
+/** Update the flush system data structures when a write is completed.
+@param[in,out] bpage flushed page
+@param[in] dblwr whether the doublewrite buffer was used */
+void buf_flush_write_complete(buf_page_t* bpage, bool dblwr);
/** Initialize a page for writing to the tablespace.
@param[in] block buffer block; NULL if bypassing the buffer pool
@param[in,out] page page frame
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
index c2152ce11d0..249755f1ff6 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -36,9 +36,10 @@ Created 10/25/1995 Heikki Tuuri
#include "ibuf0types.h"
#include <list>
-#include <vector>
// Forward declaration
+extern ibool srv_use_doublewrite_buf;
+extern struct buf_dblwr_t* buf_dblwr;
struct trx_t;
class page_id_t;
class truncate_t;
@@ -200,6 +201,13 @@ struct fil_space_t {
{
return stop_new_ops || is_being_truncated;
}
+
+ /** @return whether doublewrite buffering is needed */
+ bool use_doublewrite() const
+ {
+ return !atomic_write_supported
+ && srv_use_doublewrite_buf && buf_dblwr;
+ }
};
/** Value of fil_space_t::magic_n */