mirror of
https://github.com/MariaDB/server.git
synced 2026-10-23 18:49:29 +03:00
Enhancement: Change atomic_writes table option to enum type. Now every file can either use atomic writes, not use it or use default.
SYNTAX: ATOMIC_WRITES=['DEFAULT','ON','OFF']
Idea here is to be able to define innodb_doublewrite = 1 but with following rules:
ATOMIC_WRITES='DEFAULT' - if innodb_use_atomic_writes = 1, we do not write to doublewrite buffer the changes
if innodb_use_atomic_writes = 0, we write to doublewrite buffer
ATOMIC_WRITES='ON' - do not write to doublewrite buffer
ATOMIC_WRITES='OFF' - write to doublewrite buffer
Note that doublewrite buffer can't be used if innodb_doublewrite = 0.
This commit is contained in:
@@ -50,6 +50,7 @@ Created 11/11/1995 Heikki Tuuri
|
||||
#include "srv0mon.h"
|
||||
#include "mysql/plugin.h"
|
||||
#include "mysql/service_thd_wait.h"
|
||||
#include "fil0pagecompress.h"
|
||||
|
||||
/** Number of pages flushed through non flush_list flushes. */
|
||||
static ulint buf_lru_flush_page_count = 0;
|
||||
@@ -866,6 +867,8 @@ buf_flush_write_block_low(
|
||||
{
|
||||
ulint zip_size = buf_page_get_zip_size(bpage);
|
||||
page_t* frame = NULL;
|
||||
ulint space_id = buf_page_get_space(bpage);
|
||||
atomic_writes_t awrites = fil_space_get_atomic_writes(space_id);
|
||||
|
||||
#ifdef UNIV_DEBUG
|
||||
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
|
||||
@@ -943,10 +946,25 @@ buf_flush_write_block_low(
|
||||
buf_page_get_page_no(bpage), 0,
|
||||
zip_size ? zip_size : UNIV_PAGE_SIZE,
|
||||
frame, bpage, &bpage->write_size);
|
||||
} else if (flush_type == BUF_FLUSH_SINGLE_PAGE) {
|
||||
buf_dblwr_write_single_page(bpage);
|
||||
} else {
|
||||
buf_dblwr_add_to_batch(bpage);
|
||||
/* InnoDB uses doublewrite buffer and doublewrite buffer
|
||||
is initialized. User can define do we use atomic writes
|
||||
on a file space (table) or not. If atomic writes are
|
||||
not used we should use doublewrite buffer and if
|
||||
atomic writes should be used, no doublewrite buffer
|
||||
is used. */
|
||||
|
||||
if (awrites == ATOMIC_WRITES_ON) {
|
||||
fil_io(OS_FILE_WRITE | OS_AIO_SIMULATED_WAKE_LATER,
|
||||
FALSE, buf_page_get_space(bpage), zip_size,
|
||||
buf_page_get_page_no(bpage), 0,
|
||||
zip_size ? zip_size : UNIV_PAGE_SIZE,
|
||||
frame, bpage, &bpage->write_size);
|
||||
} else if (flush_type == BUF_FLUSH_SINGLE_PAGE) {
|
||||
buf_dblwr_write_single_page(bpage);
|
||||
} else {
|
||||
buf_dblwr_add_to_batch(bpage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -756,7 +756,7 @@ fil_node_open_file(
|
||||
|
||||
node->handle = os_file_create_simple_no_error_handling(
|
||||
innodb_file_data_key, node->name, OS_FILE_OPEN,
|
||||
OS_FILE_READ_ONLY, &success, FALSE);
|
||||
OS_FILE_READ_ONLY, &success, 0);
|
||||
if (!success) {
|
||||
/* The following call prints an error message */
|
||||
os_file_get_last_error(true);
|
||||
@@ -3159,7 +3159,7 @@ fil_create_link_file(
|
||||
|
||||
file = os_file_create_simple_no_error_handling(
|
||||
innodb_file_data_key, link_filepath,
|
||||
OS_FILE_CREATE, OS_FILE_READ_WRITE, &success, FALSE);
|
||||
OS_FILE_CREATE, OS_FILE_READ_WRITE, &success, 0);
|
||||
|
||||
if (!success) {
|
||||
/* The following call will print an error message */
|
||||
@@ -3269,8 +3269,8 @@ fil_open_linked_file(
|
||||
const char* tablename, /*!< in: database/tablename */
|
||||
char** remote_filepath,/*!< out: remote filepath */
|
||||
os_file_t* remote_file, /*!< out: remote file handle */
|
||||
ibool atomic_writes) /*!< in: should atomic writes be
|
||||
used */
|
||||
ulint atomic_writes) /*!< in: atomic writes table option
|
||||
value */
|
||||
{
|
||||
ibool success;
|
||||
|
||||
@@ -4861,7 +4861,7 @@ retry:
|
||||
|
||||
#ifdef HAVE_POSIX_FALLOCATE
|
||||
if (srv_use_posix_fallocate) {
|
||||
ulint n_pages = size_after_extend - start_page_no;
|
||||
ulint n_pages = size_after_extend;
|
||||
|
||||
success = os_file_set_size(node->name, node->handle,
|
||||
n_pages * page_size);
|
||||
|
||||
@@ -350,8 +350,8 @@ fil_get_compression_alg_name(
|
||||
/*******************************************************************//**
|
||||
Returns the atomic writes flag of the space, or false if the space
|
||||
is not using atomic writes. The tablespace must be cached in the memory cache.
|
||||
@return true if space using atomic writes, false if not */
|
||||
ibool
|
||||
@return atomic writes table option value */
|
||||
atomic_writes_t
|
||||
fil_space_get_atomic_writes(
|
||||
/*========================*/
|
||||
ulint id) /*!< in: space id */
|
||||
@@ -362,8 +362,8 @@ fil_space_get_atomic_writes(
|
||||
|
||||
if (flags && flags != ULINT_UNDEFINED) {
|
||||
|
||||
return(fsp_flags_get_atomic_writes(flags));
|
||||
return((atomic_writes_t)fsp_flags_get_atomic_writes(flags));
|
||||
}
|
||||
|
||||
return(flags);
|
||||
return((atomic_writes_t)0);
|
||||
}
|
||||
|
||||
@@ -503,7 +503,7 @@ ha_create_table_option innodb_table_option_list[]=
|
||||
compression for this table*/
|
||||
HA_TOPTION_NUMBER("PAGE_COMPRESSION_LEVEL", page_compression_level, ULINT_UNDEFINED, 0, 9, 1),
|
||||
/* With this option user can enable atomic writes feature for this table */
|
||||
HA_TOPTION_BOOL("ATOMIC_WRITES", atomic_writes, 0),
|
||||
HA_TOPTION_ENUM("ATOMIC_WRITES", atomic_writes, "DEFAULT,ON,OFF", 0),
|
||||
HA_TOPTION_END
|
||||
};
|
||||
|
||||
@@ -9738,6 +9738,7 @@ ha_innobase::check_table_options(
|
||||
{
|
||||
enum row_type row_format = table->s->row_type;;
|
||||
ha_table_option_struct *options= table->s->option_struct;
|
||||
atomic_writes_t awrites = (atomic_writes_t)options->atomic_writes;
|
||||
|
||||
/* Check page compression requirements */
|
||||
if (options->page_compressed) {
|
||||
@@ -9811,8 +9812,9 @@ ha_innobase::check_table_options(
|
||||
}
|
||||
|
||||
/* Check atomic writes requirements */
|
||||
if (options->atomic_writes) {
|
||||
if (!srv_use_atomic_writes && !use_tablespace) {
|
||||
if (awrites == ATOMIC_WRITES_ON ||
|
||||
(awrites == ATOMIC_WRITES_DEFAULT && srv_use_atomic_writes)) {
|
||||
if (!use_tablespace) {
|
||||
push_warning(
|
||||
thd, Sql_condition::WARN_LEVEL_WARN,
|
||||
HA_WRONG_CREATE_OPTION,
|
||||
|
||||
@@ -64,8 +64,12 @@ struct ha_table_option_struct
|
||||
if this option is true. */
|
||||
int page_compression_level; /*!< Table page compression level
|
||||
or UNIV_UNSPECIFIED. */
|
||||
bool atomic_writes; /*!< Use atomic writes for this
|
||||
table if this options is true. */
|
||||
uint atomic_writes; /*!< Use atomic writes for this
|
||||
table if this options is ON or
|
||||
in DEFAULT if
|
||||
srv_use_atomic_writes=1.
|
||||
Atomic writes are not used if
|
||||
value OFF.*/
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -258,7 +258,7 @@ ha_innobase::check_if_supported_inplace_alter(
|
||||
|
||||
if (new_options->page_compressed != old_options->page_compressed ||
|
||||
new_options->page_compression_level != old_options->page_compression_level ||
|
||||
new_options->atomic_writes != old_options->page_compression_level) {
|
||||
new_options->atomic_writes != old_options->atomic_writes) {
|
||||
ha_alter_info->unsupported_reason = innobase_get_err_msg(
|
||||
ER_ALTER_OPERATION_NOT_SUPPORTED_REASON);
|
||||
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
|
||||
|
||||
@@ -887,8 +887,8 @@ dict_tf_set(
|
||||
pages */
|
||||
ulint page_compression_level, /*!< in: table page compression
|
||||
level */
|
||||
bool atomic_writes) /*!< in: table uses atomic
|
||||
writes */
|
||||
ulint atomic_writes) /*!< in: table atomic
|
||||
writes option value*/
|
||||
__attribute__((nonnull));
|
||||
/********************************************************************//**
|
||||
Convert a 32 bit integer table flags to the 32 bit integer that is
|
||||
|
||||
@@ -670,6 +670,7 @@ dict_sys_tables_type_validate(
|
||||
ulint page_compression = DICT_TF_GET_PAGE_COMPRESSION(type);
|
||||
ulint page_compression_level = DICT_TF_GET_PAGE_COMPRESSION_LEVEL(type);
|
||||
ulint atomic_writes = DICT_TF_GET_ATOMIC_WRITES(type);
|
||||
atomic_writes_t awrites = (atomic_writes_t)atomic_writes;
|
||||
|
||||
/* The low order bit of SYS_TABLES.TYPE is always set to 1.
|
||||
If the format is UNIV_FORMAT_B or higher, this field is the same
|
||||
@@ -734,7 +735,8 @@ dict_sys_tables_type_validate(
|
||||
}
|
||||
}
|
||||
|
||||
if (atomic_writes) {
|
||||
if (awrites == ATOMIC_WRITES_ON ||
|
||||
(awrites == ATOMIC_WRITES_DEFAULT && srv_use_atomic_writes)) {
|
||||
if (!atomic_blobs) {
|
||||
return(ULINT_UNDEFINED);
|
||||
}
|
||||
@@ -818,9 +820,10 @@ dict_tf_set(
|
||||
pages */
|
||||
ulint page_compression_level, /*!< in: table page compression
|
||||
level */
|
||||
bool atomic_writes) /*!< in: table uses atomic
|
||||
writes */
|
||||
ulint atomic_writes) /*!< in: table atomic writes setup */
|
||||
{
|
||||
atomic_writes_t awrites = (atomic_writes_t)atomic_writes;
|
||||
|
||||
switch (format) {
|
||||
case REC_FORMAT_REDUNDANT:
|
||||
*flags = 0;
|
||||
@@ -853,9 +856,9 @@ dict_tf_set(
|
||||
ut_ad(dict_tf_get_page_compression_level(*flags) == page_compression_level);
|
||||
}
|
||||
|
||||
if (atomic_writes) {
|
||||
*flags |= (1 << DICT_TF_POS_ATOMIC_WRITES);
|
||||
ut_ad(dict_tf_get_atomic_writes(*flags) == TRUE);
|
||||
if (awrites != ATOMIC_WRITES_DEFAULT) {
|
||||
*flags |= (atomic_writes << DICT_TF_POS_ATOMIC_WRITES);
|
||||
ut_ad(dict_tf_get_atomic_writes(*flags) == awrites);
|
||||
*flags |= (1 << DICT_TF_POS_ATOMIC_BLOBS);
|
||||
}
|
||||
|
||||
|
||||
@@ -129,8 +129,9 @@ Width of the page compression flag
|
||||
|
||||
/**
|
||||
Width of atomic writes flag
|
||||
DEFAULT=0, ON = 1, OFF = 2
|
||||
*/
|
||||
#define DICT_TF_WIDTH_ATOMIC_WRITES 1
|
||||
#define DICT_TF_WIDTH_ATOMIC_WRITES 2
|
||||
|
||||
/** Width of all the currently known table flags */
|
||||
#define DICT_TF_BITS (DICT_TF_WIDTH_COMPACT \
|
||||
|
||||
@@ -71,7 +71,7 @@ dict_tf_verify_flags(
|
||||
Extract the atomic writes flag from table flags.
|
||||
@return true if atomic writes are used, false if not used */
|
||||
UNIV_INLINE
|
||||
ibool
|
||||
atomic_writes_t
|
||||
dict_tf_get_atomic_writes(
|
||||
/*======================*/
|
||||
ulint flags) /*!< in: flags */
|
||||
@@ -81,7 +81,7 @@ dict_tf_get_atomic_writes(
|
||||
Check whether the table uses the atomic writes.
|
||||
@return true if atomic writes is used, false if not */
|
||||
UNIV_INLINE
|
||||
ibool
|
||||
atomic_writes_t
|
||||
dict_table_get_atomic_writes(
|
||||
/*=========================*/
|
||||
const dict_table_t* table); /*!< in: table */
|
||||
|
||||
@@ -168,24 +168,24 @@ dict_table_is_page_compressed(
|
||||
|
||||
/********************************************************************//**
|
||||
Extract the atomic writes flag from table flags.
|
||||
@return true if atomic writes are used, false if not used */
|
||||
@return enumerated value of atomic writes */
|
||||
UNIV_INLINE
|
||||
ibool
|
||||
atomic_writes_t
|
||||
dict_tf_get_atomic_writes(
|
||||
/*======================*/
|
||||
ulint flags) /*!< in: flags */
|
||||
{
|
||||
return(DICT_TF_GET_ATOMIC_WRITES(flags));
|
||||
return((atomic_writes_t)DICT_TF_GET_ATOMIC_WRITES(flags));
|
||||
}
|
||||
|
||||
/********************************************************************//**
|
||||
Check whether the table uses the atomic writes.
|
||||
@return true if atomic writes is used, false if not */
|
||||
@return enumerated value of atomic writes */
|
||||
UNIV_INLINE
|
||||
ibool
|
||||
atomic_writes_t
|
||||
dict_table_get_atomic_writes(
|
||||
/*=========================*/
|
||||
const dict_table_t* table) /*!< in: table */
|
||||
{
|
||||
return (dict_tf_get_atomic_writes(table->flags));
|
||||
return ((atomic_writes_t)dict_tf_get_atomic_writes(table->flags));
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2013, SkySQL Ab. All Rights Reserved.
|
||||
|
||||
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
|
||||
@@ -67,4 +68,11 @@ enum ib_quiesce_t {
|
||||
QUIESCE_COMPLETE /*!< All done */
|
||||
};
|
||||
|
||||
/** Enum values for atomic_writes table option */
|
||||
typedef enum {
|
||||
ATOMIC_WRITES_DEFAULT = 0,
|
||||
ATOMIC_WRITES_ON = 1,
|
||||
ATOMIC_WRITES_OFF = 2
|
||||
} atomic_writes_t;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -49,8 +49,8 @@ fil_space_is_page_compressed(
|
||||
/*******************************************************************//**
|
||||
Returns the atomic writes flag of the space, or false if the space
|
||||
is not using atomic writes. The tablespace must be cached in the memory cache.
|
||||
@return true if space using atomic writes, false if not */
|
||||
ibool
|
||||
@return atomic write table option value */
|
||||
atomic_writes_t
|
||||
fil_space_get_atomic_writes(
|
||||
/*=========================*/
|
||||
ulint id); /*!< in: space id */
|
||||
|
||||
@@ -58,7 +58,7 @@ is found in a remote location, not the default data directory. */
|
||||
#define FSP_FLAGS_WIDTH_PAGE_COMPRESSION 1
|
||||
#define FSP_FLAGS_WIDTH_PAGE_COMPRESSION_LEVEL 4
|
||||
/** Number of flag bits used to indicate atomic writes for this tablespace */
|
||||
#define FSP_FLAGS_WIDTH_ATOMIC_WRITES 1
|
||||
#define FSP_FLAGS_WIDTH_ATOMIC_WRITES 2
|
||||
|
||||
/** Width of all the currently known tablespace flags */
|
||||
#define FSP_FLAGS_WIDTH (FSP_FLAGS_WIDTH_POST_ANTELOPE \
|
||||
|
||||
@@ -67,6 +67,7 @@ fsp_flags_is_valid(
|
||||
ulint page_compression = FSP_FLAGS_GET_PAGE_COMPRESSION(flags);
|
||||
ulint page_compression_level = FSP_FLAGS_GET_PAGE_COMPRESSION_LEVEL(flags);
|
||||
ulint atomic_writes = FSP_FLAGS_GET_ATOMIC_WRITES(flags);
|
||||
atomic_writes_t awrites = (atomic_writes_t)atomic_writes;
|
||||
|
||||
DBUG_EXECUTE_IF("fsp_flags_is_valid_failure", return(false););
|
||||
|
||||
@@ -116,7 +117,9 @@ fsp_flags_is_valid(
|
||||
}
|
||||
}
|
||||
|
||||
if (atomic_writes && !atomic_blobs) {
|
||||
if ((awrites == ATOMIC_WRITES_ON ||
|
||||
(awrites == ATOMIC_WRITES_DEFAULT && srv_use_atomic_writes))
|
||||
&& !atomic_blobs) {
|
||||
return (false);
|
||||
}
|
||||
|
||||
|
||||
@@ -57,6 +57,15 @@ fsp_flags_get_page_compression_level(
|
||||
/*=================================*/
|
||||
ulint flags); /*!< in: tablespace flags */
|
||||
|
||||
/********************************************************************//**
|
||||
Determine the tablespace is using atomic writes from dict_table_t::flags.
|
||||
@return true if atomic writes is used, false if not */
|
||||
UNIV_INLINE
|
||||
atomic_writes_t
|
||||
fsp_flags_get_atomic_writes(
|
||||
/*========================*/
|
||||
ulint flags); /*!< in: tablespace flags */
|
||||
|
||||
#ifndef UNIV_NONINL
|
||||
#include "fsp0pagecompress.ic"
|
||||
#endif
|
||||
|
||||
@@ -52,10 +52,10 @@ fsp_flags_get_page_compression_level(
|
||||
Determine the tablespace is using atomic writes from dict_table_t::flags.
|
||||
@return true if atomic writes is used, false if not */
|
||||
UNIV_INLINE
|
||||
ibool
|
||||
atomic_writes_t
|
||||
fsp_flags_get_atomic_writes(
|
||||
/*========================*/
|
||||
ulint flags) /*!< in: tablespace flags */
|
||||
{
|
||||
return(FSP_FLAGS_GET_ATOMIC_WRITES(flags));
|
||||
return((atomic_writes_t)FSP_FLAGS_GET_ATOMIC_WRITES(flags));
|
||||
}
|
||||
|
||||
@@ -275,12 +275,12 @@ The wrapper functions have the prefix of "innodb_". */
|
||||
pfs_os_file_create_func(key, name, create, purpose, type, \
|
||||
success, atomic_writes, __FILE__, __LINE__)
|
||||
|
||||
# define os_file_create_simple(key, name, create, access, success, atomic_writes) \
|
||||
# define os_file_create_simple(key, name, create, access, success) \
|
||||
pfs_os_file_create_simple_func(key, name, create, access, \
|
||||
success, atomic_writes, __FILE__, __LINE__)
|
||||
success, __FILE__, __LINE__)
|
||||
|
||||
# define os_file_create_simple_no_error_handling( \
|
||||
key, name, create_mode, access, success, atomic_writes) \
|
||||
key, name, create_mode, access, success, atomic_writes) \
|
||||
pfs_os_file_create_simple_no_error_handling_func( \
|
||||
key, name, create_mode, access, success, atomic_writes, __FILE__, __LINE__)
|
||||
|
||||
@@ -315,13 +315,13 @@ to original un-instrumented file I/O APIs */
|
||||
# define os_file_create(key, name, create, purpose, type, success, atomic_writes) \
|
||||
os_file_create_func(name, create, purpose, type, success, atomic_writes)
|
||||
|
||||
# define os_file_create_simple(key, name, create_mode, access, success, atomic_writes) \
|
||||
os_file_create_simple_func(name, create_mode, access, success, atomic_writes)
|
||||
# define os_file_create_simple(key, name, create_mode, access, success) \
|
||||
os_file_create_simple_func(name, create_mode, access, success)
|
||||
|
||||
# define os_file_create_simple_no_error_handling( \
|
||||
key, name, create_mode, access, success, atomic_writes) \
|
||||
os_file_create_simple_no_error_handling_func( \
|
||||
name, create_mode, access, success, atomic_writes)
|
||||
key, name, create_mode, access, success, atomic_writes) \
|
||||
os_file_create_simple_no_error_handling_func( \
|
||||
name, create_mode, access, success, atomic_writes)
|
||||
|
||||
# define os_file_close(file) os_file_close_func(file)
|
||||
|
||||
@@ -470,8 +470,7 @@ os_file_create_simple_func(
|
||||
ulint create_mode,/*!< in: create mode */
|
||||
ulint access_type,/*!< in: OS_FILE_READ_ONLY or
|
||||
OS_FILE_READ_WRITE */
|
||||
ibool* success,/*!< out: TRUE if succeed, FALSE if error */
|
||||
ibool atomic_writes); /*!<in TRUE if atomic writes are used */
|
||||
ibool* success);/*!< out: TRUE if succeed, FALSE if error */
|
||||
/****************************************************************//**
|
||||
NOTE! Use the corresponding macro
|
||||
os_file_create_simple_no_error_handling(), not directly this function!
|
||||
@@ -490,7 +489,8 @@ os_file_create_simple_no_error_handling_func(
|
||||
OS_FILE_READ_ALLOW_DELETE; the last option is
|
||||
used by a backup program reading the file */
|
||||
ibool* success,/*!< out: TRUE if succeed, FALSE if error */
|
||||
ibool atomic_writes)/*!<in TRUE if atomic writes are used */
|
||||
ulint atomic_writes)/*!< in: atomic writes table option
|
||||
value */
|
||||
__attribute__((nonnull, warn_unused_result));
|
||||
/****************************************************************//**
|
||||
Tries to disable OS caching on an opened file descriptor. */
|
||||
@@ -525,7 +525,8 @@ os_file_create_func(
|
||||
function source code for the exact rules */
|
||||
ulint type, /*!< in: OS_DATA_FILE or OS_LOG_FILE */
|
||||
ibool* success,/*!< out: TRUE if succeed, FALSE if error */
|
||||
ibool atomic_writes)/*!<in TRUE if atomic writes are used */
|
||||
ulint atomic_writes)/*!< in: atomic writes table option
|
||||
value */
|
||||
__attribute__((nonnull, warn_unused_result));
|
||||
/***********************************************************************//**
|
||||
Deletes a file. The file has to be closed before calling this.
|
||||
@@ -590,7 +591,6 @@ pfs_os_file_create_simple_func(
|
||||
ulint access_type,/*!< in: OS_FILE_READ_ONLY or
|
||||
OS_FILE_READ_WRITE */
|
||||
ibool* success,/*!< out: TRUE if succeed, FALSE if error */
|
||||
ibool atomic_writes,/*!<in TRUE if atomic writes are used */
|
||||
const char* src_file,/*!< in: file name where func invoked */
|
||||
ulint src_line)/*!< in: line where the func invoked */
|
||||
__attribute__((nonnull, warn_unused_result));
|
||||
@@ -616,7 +616,8 @@ pfs_os_file_create_simple_no_error_handling_func(
|
||||
OS_FILE_READ_ALLOW_DELETE; the last option is
|
||||
used by a backup program reading the file */
|
||||
ibool* success,/*!< out: TRUE if succeed, FALSE if error */
|
||||
ibool atomic_writes, /*!<in TRUE if atomic writes are used */
|
||||
ulint atomic_writes,/*!< in: atomic writes table option
|
||||
value */
|
||||
const char* src_file,/*!< in: file name where func invoked */
|
||||
ulint src_line)/*!< in: line where the func invoked */
|
||||
__attribute__((nonnull, warn_unused_result));
|
||||
@@ -645,7 +646,8 @@ pfs_os_file_create_func(
|
||||
function source code for the exact rules */
|
||||
ulint type, /*!< in: OS_DATA_FILE or OS_LOG_FILE */
|
||||
ibool* success,/*!< out: TRUE if succeed, FALSE if error */
|
||||
ibool atomic_writes, /*!<in TRUE if atomic writes are used */
|
||||
ulint atomic_writes,/*!< in: atomic writes table option
|
||||
value*/
|
||||
const char* src_file,/*!< in: file name where func invoked */
|
||||
ulint src_line)/*!< in: line where the func invoked */
|
||||
__attribute__((nonnull, warn_unused_result));
|
||||
@@ -694,6 +696,8 @@ pfs_os_file_read_no_error_handling_func(
|
||||
void* buf, /*!< in: buffer where to read */
|
||||
os_offset_t offset, /*!< in: file offset where to read */
|
||||
ulint n, /*!< in: number of bytes to read */
|
||||
ulint atomic_writes,/*!< in: atomic writes table option
|
||||
value */
|
||||
const char* src_file,/*!< in: file name where func invoked */
|
||||
ulint src_line);/*!< in: line where the func invoked */
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@ pfs_os_file_create_simple_func(
|
||||
ulint access_type,/*!< in: OS_FILE_READ_ONLY or
|
||||
OS_FILE_READ_WRITE */
|
||||
ibool* success,/*!< out: TRUE if succeed, FALSE if error */
|
||||
ibool atomic_writes, /*!<in TRUE if atomic writes are used */
|
||||
const char* src_file,/*!< in: file name where func invoked */
|
||||
ulint src_line)/*!< in: line where the func invoked */
|
||||
{
|
||||
@@ -61,7 +60,7 @@ pfs_os_file_create_simple_func(
|
||||
name, src_file, src_line);
|
||||
|
||||
file = os_file_create_simple_func(name, create_mode,
|
||||
access_type, success, atomic_writes);
|
||||
access_type, success);
|
||||
|
||||
/* Regsiter the returning "file" value with the system */
|
||||
register_pfs_file_open_end(locker, file);
|
||||
@@ -90,7 +89,8 @@ pfs_os_file_create_simple_no_error_handling_func(
|
||||
OS_FILE_READ_ALLOW_DELETE; the last option is
|
||||
used by a backup program reading the file */
|
||||
ibool* success,/*!< out: TRUE if succeed, FALSE if error */
|
||||
ibool atomic_writes, /*!<in TRUE if atomic writes are used */
|
||||
ulint atomic_writes,/*!< in: atomic writes table option
|
||||
value */
|
||||
const char* src_file,/*!< in: file name where func invoked */
|
||||
ulint src_line)/*!< in: line where the func invoked */
|
||||
{
|
||||
@@ -137,7 +137,8 @@ pfs_os_file_create_func(
|
||||
function source code for the exact rules */
|
||||
ulint type, /*!< in: OS_DATA_FILE or OS_LOG_FILE */
|
||||
ibool* success,/*!< out: TRUE if succeed, FALSE if error */
|
||||
ibool atomic_writes, /*!<in TRUE if atomic writes are used */
|
||||
ulint atomic_writes, /*!< in: atomic writes table option
|
||||
value */
|
||||
const char* src_file,/*!< in: file name where func invoked */
|
||||
ulint src_line)/*!< in: line where the func invoked */
|
||||
{
|
||||
|
||||
@@ -1259,8 +1259,7 @@ os_file_create_simple_func(
|
||||
ulint create_mode,/*!< in: create mode */
|
||||
ulint access_type,/*!< in: OS_FILE_READ_ONLY or
|
||||
OS_FILE_READ_WRITE */
|
||||
ibool* success,/*!< out: TRUE if succeed, FALSE if error */
|
||||
ibool atomic_writes) /*!<in TRUE if atomic writes are used */
|
||||
ibool* success)/*!< out: TRUE if succeed, FALSE if error */
|
||||
{
|
||||
os_file_t file;
|
||||
ibool retry;
|
||||
@@ -1354,14 +1353,6 @@ os_file_create_simple_func(
|
||||
|
||||
} while (retry);
|
||||
|
||||
if (file != INVALID_HANDLE_VALUE
|
||||
&& (srv_use_atomic_writes || atomic_writes)
|
||||
&& !os_file_set_atomic_writes(name, file)) {
|
||||
CloseHandle(file);
|
||||
*success = FALSE;
|
||||
file = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
#else /* __WIN__ */
|
||||
int create_flag;
|
||||
|
||||
@@ -1441,14 +1432,6 @@ os_file_create_simple_func(
|
||||
}
|
||||
#endif /* USE_FILE_LOCK */
|
||||
|
||||
if (file != -1
|
||||
&& (srv_use_atomic_writes || atomic_writes)
|
||||
&& !os_file_set_atomic_writes(name, file)) {
|
||||
*success = FALSE;
|
||||
close(file);
|
||||
file = -1;
|
||||
}
|
||||
|
||||
#endif /* __WIN__ */
|
||||
|
||||
return(file);
|
||||
@@ -1472,9 +1455,11 @@ os_file_create_simple_no_error_handling_func(
|
||||
OS_FILE_READ_ALLOW_DELETE; the last option is
|
||||
used by a backup program reading the file */
|
||||
ibool* success,/*!< out: TRUE if succeed, FALSE if error */
|
||||
ibool atomic_writes) /*!<in TRUE if atomic writes are used */
|
||||
ulint atomic_writes) /*! in: atomic writes table option
|
||||
value */
|
||||
{
|
||||
os_file_t file;
|
||||
atomic_writes_t awrites = (atomic_writes_t) atomic_writes;
|
||||
|
||||
#ifdef __WIN__
|
||||
DWORD access;
|
||||
@@ -1535,13 +1520,14 @@ os_file_create_simple_no_error_handling_func(
|
||||
NULL); // No template file
|
||||
|
||||
if (file != INVALID_HANDLE_VALUE
|
||||
&& (srv_use_atomic_writes || atomic_writes)
|
||||
&& (awrites == ATOMIC_WRITES_ON ||
|
||||
(srv_use_atomic_writes && awrites == ATOMIC_WRITES_DEFAULT))
|
||||
&& !os_file_set_atomic_writes(name, file)) {
|
||||
CloseHandle(file);
|
||||
file = INVALID_HANDLE_VALUE;
|
||||
CloseHandle(file);
|
||||
*success = FALSE;
|
||||
file = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
|
||||
*success = (file != INVALID_HANDLE_VALUE);
|
||||
#else /* __WIN__ */
|
||||
int create_flag;
|
||||
@@ -1603,13 +1589,15 @@ os_file_create_simple_no_error_handling_func(
|
||||
#endif /* USE_FILE_LOCK */
|
||||
|
||||
if (file != -1
|
||||
&& (srv_use_atomic_writes || atomic_writes)
|
||||
&& (awrites == ATOMIC_WRITES_ON ||
|
||||
(srv_use_atomic_writes && awrites == ATOMIC_WRITES_DEFAULT))
|
||||
&& !os_file_set_atomic_writes(name, file)) {
|
||||
*success = FALSE;
|
||||
close(file);
|
||||
file = -1;
|
||||
}
|
||||
|
||||
|
||||
#endif /* __WIN__ */
|
||||
|
||||
return(file);
|
||||
@@ -1681,13 +1669,14 @@ os_file_create_func(
|
||||
function source code for the exact rules */
|
||||
ulint type, /*!< in: OS_DATA_FILE or OS_LOG_FILE */
|
||||
ibool* success,/*!< out: TRUE if succeed, FALSE if error */
|
||||
ibool atomic_writes) /*! in: true if atomic writes for
|
||||
this file should be used */
|
||||
ulint atomic_writes) /*! in: atomic writes table option
|
||||
value */
|
||||
{
|
||||
os_file_t file;
|
||||
ibool retry;
|
||||
ibool on_error_no_exit;
|
||||
ibool on_error_silent;
|
||||
atomic_writes_t awrites = (atomic_writes_t) atomic_writes;
|
||||
|
||||
#ifdef __WIN__
|
||||
DBUG_EXECUTE_IF(
|
||||
@@ -1832,15 +1821,13 @@ os_file_create_func(
|
||||
} while (retry);
|
||||
|
||||
if (file != INVALID_HANDLE_VALUE
|
||||
&& type == OS_DATA_FILE
|
||||
&& (srv_use_atomic_writes || atomic_writes)
|
||||
&& (awrites == ATOMIC_WRITES_ON ||
|
||||
(srv_use_atomic_writes && awrites == ATOMIC_WRITES_DEFAULT))
|
||||
&& !os_file_set_atomic_writes(name, file)) {
|
||||
CloseHandle(file);
|
||||
*success = FALSE;
|
||||
file = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
|
||||
#else /* __WIN__ */
|
||||
int create_flag;
|
||||
const char* mode_str = NULL;
|
||||
@@ -1970,15 +1957,13 @@ os_file_create_func(
|
||||
#endif /* USE_FILE_LOCK */
|
||||
|
||||
if (file != -1
|
||||
&& type == OS_DATA_FILE
|
||||
&& (srv_use_atomic_writes || atomic_writes)
|
||||
&& (awrites == ATOMIC_WRITES_ON ||
|
||||
(srv_use_atomic_writes && awrites == ATOMIC_WRITES_DEFAULT))
|
||||
&& !os_file_set_atomic_writes(name, file)) {
|
||||
*success = FALSE;
|
||||
close(file);
|
||||
file = -1;
|
||||
}
|
||||
|
||||
|
||||
#endif /* __WIN__ */
|
||||
|
||||
return(file);
|
||||
@@ -2288,6 +2273,11 @@ os_file_set_size(
|
||||
|
||||
current_size = 0;
|
||||
|
||||
#ifdef UNIV_DEBUG
|
||||
fprintf(stderr, "InnoDB: Note: File %s current_size %lu extended_size %lu\n",
|
||||
name, os_file_get_size(file), size);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_POSIX_FALLOCATE
|
||||
if (srv_use_posix_fallocate) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user