summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-03-22 18:11:44 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2021-03-22 18:12:44 +0200
commit56274bd5e4115d86059936ddd3bf656dab1b4354 (patch)
tree5ba80dc3d9438e2afb049d2232dd9686406e8526
parent0f8caadc96d1b34ac6bfe980fba660166ed65f9b (diff)
downloadmariadb-git-56274bd5e4115d86059936ddd3bf656dab1b4354.tar.gz
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.
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb.result2
-rw-r--r--storage/innobase/handler/ha_innodb.cc20
-rw-r--r--storage/innobase/handler/ha_innodb.h4
3 files changed, 7 insertions, 19 deletions
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
index 5a845825c47..440efc6a9cd 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
@@ -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
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 144f9951eb0..af6fc4d5b48 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -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_change_buffering_inited_ok:
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);
diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h
index b1c34f64326..274c6761d4f 100644
--- a/storage/innobase/handler/ha_innodb.h
+++ b/storage/innobase/handler/ha_innodb.h
@@ -1,7 +1,7 @@
/*****************************************************************************
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 */