summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2019-05-03 18:59:07 +0000
committerVladislav Vaintroub <wlad@mariadb.com>2019-05-06 11:32:17 +0000
commit60bd353bdf0ddf6593c04ac92321913b723fe7db (patch)
treeeb34cca40e4f79df9832eb5885c15b059c1300a5
parent59a266a9f943e186af3dbb7f3fc9208e2e3b379b (diff)
downloadmariadb-git-60bd353bdf0ddf6593c04ac92321913b723fe7db.tar.gz
Fixes for atomic writes on Windows.
Windows does atomic writes, as long as they are aligned and multiple of sector size. this is documented in MSDN. Fix innodb.doublewrite test to always use doublewrite buffer, (even if atomic writes are autodetected)
-rw-r--r--mysql-test/suite/innodb/t/doublewrite.combinations2
-rw-r--r--mysys/my_atomic_writes.c2
-rw-r--r--storage/innobase/os/os0file.cc8
3 files changed, 11 insertions, 1 deletions
diff --git a/mysql-test/suite/innodb/t/doublewrite.combinations b/mysql-test/suite/innodb/t/doublewrite.combinations
index 729380593f3..4f52013f6fc 100644
--- a/mysql-test/suite/innodb/t/doublewrite.combinations
+++ b/mysql-test/suite/innodb/t/doublewrite.combinations
@@ -1,5 +1,7 @@
[strict_crc32]
--innodb-checksum-algorithm=strict_crc32
+--innodb-use-atomic-writes=0
[strict_full_crc32]
--innodb-checksum-algorithm=strict_full_crc32
+--innodb-use-atomic-writes=0
diff --git a/mysys/my_atomic_writes.c b/mysys/my_atomic_writes.c
index 7f1e353c121..b383af11ba8 100644
--- a/mysys/my_atomic_writes.c
+++ b/mysys/my_atomic_writes.c
@@ -15,7 +15,7 @@
#include "mysys_priv.h"
-my_bool my_may_have_atomic_write= 0;
+my_bool my_may_have_atomic_write= IF_WIN(1,0);
#ifdef __linux__
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index 0a0dd35008a..88bfcd4a138 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -7669,7 +7669,15 @@ void fil_node_t::find_metadata(os_file_t file
&& my_test_if_atomic_write(file,
space->physical_size())
#else
+ /* On Windows, all single sector writes are atomic,
+ as per WriteFile() documentation on MSDN.
+ We also require SSD for atomic writes, eventhough
+ technically it is not necessary- the reason is that
+ on hard disks, we still want the benefit from
+ (non-atomic) neighbor page flushing in the buffer
+ pool code. */
&& srv_page_size == block_size
+ && on_ssd
#endif
;
}