Skip to content

Commit

Permalink
MDEV-7166: innodb.innodb-page_compression_zip fails in buildbot
Browse files Browse the repository at this point in the history
Analysis: If innodb_use_trim is not enabled or system does not
support fallocate to make persistent trim, we should always
write full page not only partial pages.
  • Loading branch information
Jan Lindström committed Nov 24, 2014
1 parent deffb95 commit 1a05bb4
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 2 deletions.
17 changes: 17 additions & 0 deletions storage/innobase/fil/fil0pagecompress.cc
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,23 @@ fil_compress_page(

srv_stats.page_compression_saved.add((len - write_size));
srv_stats.pages_page_compressed.inc();

#if defined (__linux__) && (!defined(FALLOC_FL_PUNCH_HOLE) || !defined (FALLOC_FL_KEEP_SIZE))
if (srv_use_trim) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: [Warning] System does not support FALLOC_FL_PUNCH_HOLE || FALLOC_FL_KEEP_SIZE.\n"
" InnoDB: Disabling trim for now.\n");
srv_use_trim = FALSE;
}
#endif

if (!srv_use_trim) {
/* If persistent trims are not used we always write full
page */
write_size = len;
}

*out_len = write_size;

return(out_buf);
Expand Down
15 changes: 13 additions & 2 deletions storage/innobase/os/os0file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5265,9 +5265,17 @@ os_aio_windows_handle(
if (ret && len == slot->len) {

ret_val = TRUE;
} else if (os_file_handle_error(slot->name, "Windows aio", __FILE__, __LINE__)) {
} else if (!ret || (len != slot->len)) {

retry = TRUE;
if (!ret) {
if (os_file_handle_error(slot->name, "Windows aio", __FILE__, __LINE__)) {
retry = TRUE;
} else {
ret_val = FALSE;
}
} else {
retry = TRUE;
}
} else {

ret_val = FALSE;
Expand Down Expand Up @@ -6395,6 +6403,7 @@ os_file_trim(
if (ret) {
/* After first failure do not try to trim again */
os_fallocate_failed = TRUE;
srv_use_trim = FALSE;
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: [Warning] fallocate call failed with error code %d.\n"
Expand All @@ -6421,6 +6430,7 @@ os_file_trim(
" InnoDB: [Warning] fallocate not supported on this installation."
" InnoDB: Disabling fallocate for now.");
os_fallocate_failed = TRUE;
srv_use_trim = FALSE;
if (slot->write_size) {
*slot->write_size = 0;
}
Expand All @@ -6440,6 +6450,7 @@ os_file_trim(
if (!ret) {
/* After first failure do not try to trim again */
os_fallocate_failed = TRUE;
srv_use_trim=FALSE;
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: [Warning] fallocate call failed with error.\n"
Expand Down
17 changes: 17 additions & 0 deletions storage/xtradb/fil/fil0pagecompress.cc
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,23 @@ fil_compress_page(

srv_stats.page_compression_saved.add((len - write_size));
srv_stats.pages_page_compressed.inc();

#if defined (__linux__) && (!defined(FALLOC_FL_PUNCH_HOLE) || !defined (FALLOC_FL_KEEP_SIZE))
if (srv_use_trim) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: [Warning] System does not support FALLOC_FL_PUNCH_HOLE || FALLOC_FL_KEEP_SIZE.\n"
" InnoDB: Disabling trim for now.\n");
srv_use_trim = FALSE;
}
#endif

if (!srv_use_trim) {
/* If persistent trims are not used we always write full
page */
write_size = len;
}

*out_len = write_size;

return(out_buf);
Expand Down
3 changes: 3 additions & 0 deletions storage/xtradb/os/os0file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6498,6 +6498,7 @@ os_file_trim(
if (ret) {
/* After first failure do not try to trim again */
os_fallocate_failed = TRUE;
srv_use_trim = FALSE;
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: [Warning] fallocate call failed with error code %d.\n"
Expand All @@ -6524,6 +6525,7 @@ os_file_trim(
" InnoDB: [Warning] fallocate not supported on this installation."
" InnoDB: Disabling fallocate for now.");
os_fallocate_failed = TRUE;
srv_use_trim = FALSE;
if (slot->write_size) {
*slot->write_size = 0;
}
Expand All @@ -6543,6 +6545,7 @@ os_file_trim(
if (!ret) {
/* After first failure do not try to trim again */
os_fallocate_failed = TRUE;
srv_use_trim = FALSE;
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: [Warning] fallocate call failed with error.\n"
Expand Down

0 comments on commit 1a05bb4

Please sign in to comment.