Commit 8bbcc0d5 authored by Marko Mäkelä's avatar Marko Mäkelä

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.
parent 9801715c
......@@ -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;
......
......@@ -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
......
/******************************************************
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
......@@ -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:
......
......@@ -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;
......
......@@ -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,
......
......@@ -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
......
......@@ -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() */
......
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