summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-01-23 09:51:06 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2019-01-23 09:51:06 +0200
commit942a6bd0090eff5680e4465040abc2b75f77e033 (patch)
treeaacb0bc35916e3bfcf189f6322aa98d42f206782
parent9c5be7d131f7eb7f27df722463faa2cd8135fd1b (diff)
downloadmariadb-git-942a6bd0090eff5680e4465040abc2b75f77e033.tar.gz
MDEV-18349 InnoDB file size changes are not safe when file system crashes
fil_extend_space_to_desired_size(): Invoke fsync() after posix_fallocate() in order to durably extend the file in a crash-safe file system.
-rw-r--r--storage/innobase/fil/fil0fil.c4
-rw-r--r--storage/xtradb/fil/fil0fil.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
index 4006ce4acce..32bf0b8ccd8 100644
--- a/storage/innobase/fil/fil0fil.c
+++ b/storage/innobase/fil/fil0fil.c
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2014, 2017, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2014, 2019, 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
@@ -4155,6 +4155,8 @@ fil_extend_space_to_desired_size(
" failed with error %d\n",
node->name,
start_offset, len + start_offset, err);
+ } else {
+ os_file_flush(node->handle);
}
mutex_enter(&fil_system->mutex);
diff --git a/storage/xtradb/fil/fil0fil.c b/storage/xtradb/fil/fil0fil.c
index 004a80e9b13..fc305c7e01f 100644
--- a/storage/xtradb/fil/fil0fil.c
+++ b/storage/xtradb/fil/fil0fil.c
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2014, 2017, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2014, 2019, 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
@@ -4990,6 +4990,8 @@ fil_extend_space_to_desired_size(
" failed with error %d\n",
node->name,
start_offset, len + start_offset, err);
+ } else {
+ os_file_flush(node->handle, TRUE);
}
mutex_enter(&fil_system->mutex);