Commit e80f2468 authored by Jan Lindström's avatar Jan Lindström

Fixed issues with atomic writes and compressed pages.

Temporal solution: In directFS using atomic writes
we must use posix_fallocate to extend the file because
pwrite past end of file fails but when compression is
used the file pages must be physically initialized with
zeroes, thus after file extend with posix_fallocate
we still write empty pages to file.
parent f6a19655
......@@ -2,7 +2,6 @@
Copyright (c) 1995, 2012, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2013 SkySQL Ab. All Rights Reserved.
Copyright (c) 2013, SkySQL Ab. All Rights Reserved.
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
......@@ -4828,6 +4827,7 @@ retry:
}
page_size = fsp_flags_get_zip_size(space->flags);
if (!page_size) {
page_size = UNIV_PAGE_SIZE;
}
......@@ -4859,8 +4859,6 @@ retry:
start_page_no = space->size;
file_start_page_no = space->size - node->size;
/* JAN: TODO: Need to disable fast file extension for Fusion-io
currently.
#ifdef HAVE_POSIX_FALLOCATE
if (srv_use_posix_fallocate) {
ulint n_pages = size_after_extend - start_page_no;
......@@ -4868,16 +4866,37 @@ retry:
success = os_file_set_size(node->name, node->handle,
n_pages * page_size);
/* Temporal solution: In directFS using atomic writes
we must use posix_fallocate to extend the file because
pwrite past end of file fails but when compression is
used the file pages must be physically initialized with
zeroes, thus after file extend with posix_fallocate
we still write empty pages to file. */
if (success &&
srv_use_atomic_writes &&
srv_compress_pages) {
goto extend_file;
}
mutex_enter(&fil_system->mutex);
if (success) {
node->size += n_pages;
space->size += n_pages;
os_has_said_disk_full = FALSE;
}
/* If posix_fallocate was used to extent the file space
we need to complete the io. Because no actual writes were
dispatched read operation is enough here. Without this
there will be assertion at shutdown indicating that
all IO is not completed. */
fil_node_complete_io(node, fil_system, OS_FILE_READ);
goto complete_io;
}
#endif
*/
extend_file:
/* Extend at most 64 pages at a time */
buf_size = ut_min(64, size_after_extend - start_page_no) * page_size;
......@@ -4932,15 +4951,10 @@ retry:
space->size += pages_added;
node->size += pages_added;
node->being_extended = FALSE;
#ifdef HAVE_POSIX_FALLOCATE
complete_io:
fil_node_complete_io(node, fil_system, OS_FILE_READ);
#else
fil_node_complete_io(node, fil_system, OS_FILE_WRITE);
#endif
fil_node_complete_io(node, fil_system, OS_FILE_WRITE);
complete_io:
node->being_extended = FALSE;
*actual_size = space->size;
......
......@@ -2288,8 +2288,6 @@ os_file_set_size(
current_size = 0;
/* JAN: TODO: Disable posix_fallocate file extension for Fusion-io
because currently it assumes that pages are initialized by zeroes
#ifdef HAVE_POSIX_FALLOCATE
if (srv_use_posix_fallocate) {
......@@ -2305,8 +2303,6 @@ os_file_set_size(
return(TRUE);
}
#endif
*/
/* Write up to 1 megabyte at a time. */
buf_size = ut_min(64, (ulint) (size / UNIV_PAGE_SIZE))
......
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