summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-04-30 18:12:14 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2018-04-30 18:22:52 +0300
commit8bbcc0d5050dcbd44c0bc396c6b1acd488d3dfe2 (patch)
treeda2e30e14797dfd6ccc3ee77230791fb5e59469d
parent9801715cb0ce71ab248464bdcfad0cfa82e998e6 (diff)
downloadmariadb-git-8bbcc0d5050dcbd44c0bc396c6b1acd488d3dfe2.tar.gz
MDEV-12218: Put back mariabackup --innodb-flush-method
Implement innodb_flush_method as an enum parameter in Mariabackup, instead of ignoring the option and hard-wiring it to a default value. xb0xb.h: Remove. Only xtrabackup.cc refers to the enum parameters. innodb_flush_method_names[], innodb_flush_method_typelib[]: Define as non-static, so that mariabackup can share the definitions. srv_file_flush_method: Change the type to ulong, to match the assignment in init_one_value() and handle_options() in mariabackup.
-rw-r--r--extra/mariabackup/backup_copy.cc2
-rw-r--r--extra/mariabackup/fil_cur.cc1
-rw-r--r--extra/mariabackup/xb0xb.h27
-rw-r--r--extra/mariabackup/xtrabackup.cc20
-rw-r--r--storage/innobase/fil/fil0fil.cc2
-rw-r--r--storage/innobase/handler/ha_innodb.cc4
-rw-r--r--storage/innobase/include/srv0srv.h6
-rw-r--r--storage/innobase/srv/srv0srv.cc2
8 files changed, 25 insertions, 39 deletions
diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc
index 2ea34406a6b..a0c5fbcca1b 100644
--- a/extra/mariabackup/backup_copy.cc
+++ b/extra/mariabackup/backup_copy.cc
@@ -57,8 +57,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#include "backup_copy.h"
#include "backup_mysql.h"
#include <btr0btr.h>
-#include "xb0xb.h"
-
/* list of files to sync for --rsync mode */
static std::set<std::string> rsync_list;
diff --git a/extra/mariabackup/fil_cur.cc b/extra/mariabackup/fil_cur.cc
index 1aef6cc0a4f..799405b3d42 100644
--- a/extra/mariabackup/fil_cur.cc
+++ b/extra/mariabackup/fil_cur.cc
@@ -33,7 +33,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#include "common.h"
#include "read_filt.h"
#include "xtrabackup.h"
-#include "xb0xb.h"
/* Size of read buffer in pages (640 pages = 10M for 16K sized pages) */
#define XB_FIL_CUR_PAGES 640
diff --git a/extra/mariabackup/xb0xb.h b/extra/mariabackup/xb0xb.h
deleted file mode 100644
index 59938a014c6..00000000000
--- a/extra/mariabackup/xb0xb.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/******************************************************
-Copyright (c) 2012 Percona LLC and/or its affiliates.
-
-Declarations of XtraBackup functions called by InnoDB code.
-
-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 Foundation; version 2 of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-
-*******************************************************/
-
-#ifndef xb0xb_h
-#define xb0xb_h
-
-extern const char *innodb_checksum_algorithm_names[];
-extern TYPELIB innodb_checksum_algorithm_typelib;
-
-#endif
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index 89914d5ea4a..fafc9447873 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -97,7 +97,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#include "backup_mysql.h"
#include "backup_copy.h"
#include "backup_mysql.h"
-#include "xb0xb.h"
#include "encryption_plugin.h"
#include <sql_plugin.h>
#include <srv0srv.h>
@@ -297,6 +296,11 @@ my_bool opt_remove_original;
my_bool opt_lock_ddl_per_table = FALSE;
+extern const char *innodb_checksum_algorithm_names[];
+extern TYPELIB innodb_checksum_algorithm_typelib;
+extern const char *innodb_flush_method_names[];
+extern TYPELIB innodb_flush_method_typelib;
+
static const char *binlog_info_values[] = {"off", "lockless", "on", "auto",
NullS};
static TYPELIB binlog_info_typelib = {array_elements(binlog_info_values)-1, "",
@@ -617,6 +621,7 @@ enum options_xtrabackup
OPT_INNODB_ADAPTIVE_HASH_INDEX,
OPT_INNODB_DOUBLEWRITE,
OPT_INNODB_FILE_PER_TABLE,
+ OPT_INNODB_FLUSH_METHOD,
OPT_INNODB_LOG_GROUP_HOME_DIR,
OPT_INNODB_MAX_DIRTY_PAGES_PCT,
OPT_INNODB_MAX_PURGE_LAG,
@@ -1119,6 +1124,12 @@ struct my_option xb_server_options[] =
(G_PTR*) &innobase_file_per_table, 0, GET_BOOL, NO_ARG,
FALSE, 0, 0, 0, 0, 0},
+ {"innodb_flush_method", OPT_INNODB_FLUSH_METHOD,
+ "With which method to flush data.",
+ &srv_file_flush_method, &srv_file_flush_method,
+ &innodb_flush_method_typelib, GET_ENUM, REQUIRED_ARG,
+ IF_WIN(SRV_ALL_O_DIRECT_FSYNC, SRV_FSYNC), 0, 0, 0, 0, 0},
+
{"innodb_log_buffer_size", OPT_INNODB_LOG_BUFFER_SIZE,
"The size of the buffer which InnoDB uses to write log to the log files on disk.",
(G_PTR*) &srv_log_buffer_size, (G_PTR*) &srv_log_buffer_size, 0,
@@ -1466,6 +1477,12 @@ xb_get_one_option(int optid,
case OPT_INNODB_LOG_FILE_SIZE:
break;
+ case OPT_INNODB_FLUSH_METHOD:
+ ut_a(srv_file_flush_method
+ <= IF_WIN(SRV_ALL_O_DIRECT_FSYNC, SRV_O_DIRECT_NO_FSYNC));
+ ADD_PRINT_PARAM_OPT(innodb_flush_method_names[srv_file_flush_method]);
+ break;
+
case OPT_INNODB_PAGE_SIZE:
ADD_PRINT_PARAM_OPT(innobase_page_size);
@@ -1760,7 +1777,6 @@ static bool innodb_init_param()
#ifdef _WIN32
srv_use_native_aio = TRUE;
#endif
- srv_file_flush_method = IF_WIN(SRV_ALL_O_DIRECT_FSYNC, SRV_FSYNC);
return false;
error:
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index 1b217dd4b6f..a2a6757ea0c 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -4691,7 +4691,7 @@ fil_aio_wait(
and can only end up here when writing a log checkpoint! */
ut_a(ptrdiff_t(message) == 1);
/* It was a checkpoint write */
- switch (srv_file_flush_method) {
+ switch (srv_flush_t(srv_file_flush_method)) {
case SRV_O_DSYNC:
case SRV_NOSYNC:
break;
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index cd4768c3a4a..26730676e2e 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -431,7 +431,7 @@ static TYPELIB innodb_lock_schedule_algorithm_typelib = {
};
/** Names of allowed values of innodb_flush_method */
-static const char* innodb_flush_method_names[] = {
+const char* innodb_flush_method_names[] = {
"fsync",
"O_DSYNC",
"littlesync",
@@ -447,7 +447,7 @@ static const char* innodb_flush_method_names[] = {
};
/** Enumeration of innodb_flush_method */
-static TYPELIB innodb_flush_method_typelib = {
+TYPELIB innodb_flush_method_typelib = {
array_elements(innodb_flush_method_names) - 1,
"innodb_flush_method_typelib",
innodb_flush_method_names,
diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
index 5216073ee53..1e307f872e5 100644
--- a/storage/innobase/include/srv0srv.h
+++ b/storage/innobase/include/srv0srv.h
@@ -658,8 +658,7 @@ extern PSI_stage_info srv_stage_buffer_pool_load;
#endif /* HAVE_PSI_STAGE_INTERFACE */
-/** Alternatives for the file flush option in Unix; see the InnoDB manual
-about what these mean */
+/** Alternatives for innodb_flush_method */
enum srv_flush_t {
SRV_FSYNC = 0, /*!< fsync, the default */
SRV_O_DSYNC, /*!< open log files in O_SYNC mode */
@@ -686,7 +685,8 @@ enum srv_flush_t {
all files without caching, and do FileFlushBuffers()*/
#endif
};
-extern enum srv_flush_t srv_file_flush_method;
+/** innodb_flush_method */
+extern ulong srv_file_flush_method;
/** Alternatives for srv_force_recovery. Non-zero values are intended
to help the user get a damaged database up so that he can dump intact
diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc
index 10dcf2084e0..3d591de8dec 100644
--- a/storage/innobase/srv/srv0srv.cc
+++ b/storage/innobase/srv/srv0srv.cc
@@ -278,7 +278,7 @@ ulong srv_read_ahead_threshold;
buffer in terms of percentage of the buffer pool. */
uint srv_change_buffer_max_size;
-enum srv_flush_t srv_file_flush_method;
+ulong srv_file_flush_method;
/** copy of innodb_open_files; @see innodb_init_params() */