Commit 56274bd5 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-23076 Misleading "InnoDB: using atomic writes"

As suggested by Vladislav Vaintroub, let us remove misleading
and malformatted startup messages.

Even if the global variable srv_use_atomic_writes were set, we would
still invoke my_test_if_atomic_write() to check if writes are atomic
with a particular page size.

When using the default innodb_page_size=16k, page writes should be
atomic on NTFS when using ROW_FORMAT=COMPRESSED and KEY_BLOCK_SIZE<=4.

Disabling srv_use_atomic_writes when innodb_file_per_table=OFF does
not make sense, because that is a dynamic parameter.

We also correct the documentation string of innodb_use_atomic_writes
and remove the duplicate variable innobase_use_atomic_writes.
parent 0f8caadc
......@@ -2591,7 +2591,7 @@ SESSION_VALUE NULL
DEFAULT_VALUE ON
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
VARIABLE_COMMENT Enable atomic writes, instead of using the doublewrite buffer, for files on devices that supports atomic writes. To use this option one must use file_per_table=1, flush_method=O_DIRECT and use_fallocate=1. This option only works on Linux with either FusionIO cards using the directFS filesystem or with Shannon cards using any file system.
VARIABLE_COMMENT Enable atomic writes, instead of using the doublewrite buffer, for files on devices that supports atomic writes. This option only works on Linux with either FusionIO cards using the directFS filesystem or with Shannon cards using any file system.
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
......
......@@ -236,7 +236,6 @@ static char* innobase_server_stopword_table;
values */
static my_bool innobase_file_format_check;
static my_bool innobase_use_atomic_writes;
static my_bool innobase_use_fallocate;
static my_bool innobase_use_doublewrite;
static my_bool innobase_use_checksums;
......@@ -4314,29 +4313,20 @@ innobase_init(
ib::warn() << deprecated_idle_flush_pct;
}
srv_use_atomic_writes
= innobase_use_atomic_writes && my_may_have_atomic_write;
if (srv_use_atomic_writes && !srv_file_per_table)
{
fprintf(stderr, "InnoDB: Disabling atomic_writes as file_per_table is not used.\n");
srv_use_atomic_writes= 0;
}
if (srv_use_atomic_writes) {
fprintf(stderr, "InnoDB: using atomic writes.\n");
#ifndef _WIN32
if (srv_use_atomic_writes && my_may_have_atomic_write) {
/*
Force O_DIRECT on Unixes (on Windows writes are always
unbuffered)
*/
#ifndef _WIN32
if (!innobase_file_flush_method ||
!strstr(innobase_file_flush_method, "O_DIRECT")) {
innobase_file_flush_method =
srv_file_flush_method_str = (char*)"O_DIRECT";
fprintf(stderr, "InnoDB: using O_DIRECT due to atomic writes.\n");
}
#endif
}
#endif
#ifdef HAVE_PSI_INTERFACE
/* Register keys with MySQL performance schema */
......@@ -20016,12 +20006,10 @@ static MYSQL_SYSVAR_BOOL(doublewrite, innobase_use_doublewrite,
" Disable with --skip-innodb-doublewrite.",
NULL, NULL, TRUE);
static MYSQL_SYSVAR_BOOL(use_atomic_writes, innobase_use_atomic_writes,
static MYSQL_SYSVAR_BOOL(use_atomic_writes, srv_use_atomic_writes,
PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
"Enable atomic writes, instead of using the doublewrite buffer, for files "
"on devices that supports atomic writes. "
"To use this option one must use "
"file_per_table=1, flush_method=O_DIRECT and use_fallocate=1. "
"This option only works on Linux with either FusionIO cards using "
"the directFS filesystem or with Shannon cards using any file system.",
NULL, NULL, TRUE);
......
/*****************************************************************************
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2013, 2020, MariaDB Corporation.
Copyright (c) 2013, 2021, 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
......@@ -46,7 +46,7 @@ struct ha_table_option_struct
uint atomic_writes; /*!< Use atomic writes for this
table if this options is ON or
in DEFAULT if
srv_use_atomic_writes=1.
innodb_use_atomic_writes.
Atomic writes are not used if
value OFF.*/
uint encryption; /*!< DEFAULT, ON, OFF */
......
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