Commit 942a6bd0 authored by Marko Mäkelä's avatar Marko Mäkelä

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.
parent 9c5be7d1
/***************************************************************************** /*****************************************************************************
Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved. 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 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 the terms of the GNU General Public License as published by the Free Software
...@@ -4155,6 +4155,8 @@ fil_extend_space_to_desired_size( ...@@ -4155,6 +4155,8 @@ fil_extend_space_to_desired_size(
" failed with error %d\n", " failed with error %d\n",
node->name, node->name,
start_offset, len + start_offset, err); start_offset, len + start_offset, err);
} else {
os_file_flush(node->handle);
} }
mutex_enter(&fil_system->mutex); mutex_enter(&fil_system->mutex);
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved. 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 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 the terms of the GNU General Public License as published by the Free Software
...@@ -4990,6 +4990,8 @@ fil_extend_space_to_desired_size( ...@@ -4990,6 +4990,8 @@ fil_extend_space_to_desired_size(
" failed with error %d\n", " failed with error %d\n",
node->name, node->name,
start_offset, len + start_offset, err); start_offset, len + start_offset, err);
} else {
os_file_flush(node->handle, TRUE);
} }
mutex_enter(&fil_system->mutex); mutex_enter(&fil_system->mutex);
......
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