Commit 1a05bb40 authored by Jan Lindström's avatar Jan Lindström

MDEV-7166: innodb.innodb-page_compression_zip fails in buildbot

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.
parent deffb95b
...@@ -476,6 +476,23 @@ fil_compress_page( ...@@ -476,6 +476,23 @@ fil_compress_page(
srv_stats.page_compression_saved.add((len - write_size)); srv_stats.page_compression_saved.add((len - write_size));
srv_stats.pages_page_compressed.inc(); 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; *out_len = write_size;
return(out_buf); return(out_buf);
......
...@@ -5265,10 +5265,18 @@ os_aio_windows_handle( ...@@ -5265,10 +5265,18 @@ os_aio_windows_handle(
if (ret && len == slot->len) { if (ret && len == slot->len) {
ret_val = TRUE; ret_val = TRUE;
} else if (os_file_handle_error(slot->name, "Windows aio", __FILE__, __LINE__)) { } else if (!ret || (len != slot->len)) {
if (!ret) {
if (os_file_handle_error(slot->name, "Windows aio", __FILE__, __LINE__)) {
retry = TRUE; retry = TRUE;
} else { } else {
ret_val = FALSE;
}
} else {
retry = TRUE;
}
} else {
ret_val = FALSE; ret_val = FALSE;
} }
...@@ -6395,6 +6403,7 @@ os_file_trim( ...@@ -6395,6 +6403,7 @@ os_file_trim(
if (ret) { if (ret) {
/* After first failure do not try to trim again */ /* After first failure do not try to trim again */
os_fallocate_failed = TRUE; os_fallocate_failed = TRUE;
srv_use_trim = FALSE;
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: [Warning] fallocate call failed with error code %d.\n" " InnoDB: [Warning] fallocate call failed with error code %d.\n"
...@@ -6421,6 +6430,7 @@ os_file_trim( ...@@ -6421,6 +6430,7 @@ os_file_trim(
" InnoDB: [Warning] fallocate not supported on this installation." " InnoDB: [Warning] fallocate not supported on this installation."
" InnoDB: Disabling fallocate for now."); " InnoDB: Disabling fallocate for now.");
os_fallocate_failed = TRUE; os_fallocate_failed = TRUE;
srv_use_trim = FALSE;
if (slot->write_size) { if (slot->write_size) {
*slot->write_size = 0; *slot->write_size = 0;
} }
...@@ -6440,6 +6450,7 @@ os_file_trim( ...@@ -6440,6 +6450,7 @@ os_file_trim(
if (!ret) { if (!ret) {
/* After first failure do not try to trim again */ /* After first failure do not try to trim again */
os_fallocate_failed = TRUE; os_fallocate_failed = TRUE;
srv_use_trim=FALSE;
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: [Warning] fallocate call failed with error.\n" " InnoDB: [Warning] fallocate call failed with error.\n"
......
...@@ -473,6 +473,23 @@ fil_compress_page( ...@@ -473,6 +473,23 @@ fil_compress_page(
srv_stats.page_compression_saved.add((len - write_size)); srv_stats.page_compression_saved.add((len - write_size));
srv_stats.pages_page_compressed.inc(); 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; *out_len = write_size;
return(out_buf); return(out_buf);
......
...@@ -6498,6 +6498,7 @@ os_file_trim( ...@@ -6498,6 +6498,7 @@ os_file_trim(
if (ret) { if (ret) {
/* After first failure do not try to trim again */ /* After first failure do not try to trim again */
os_fallocate_failed = TRUE; os_fallocate_failed = TRUE;
srv_use_trim = FALSE;
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: [Warning] fallocate call failed with error code %d.\n" " InnoDB: [Warning] fallocate call failed with error code %d.\n"
...@@ -6524,6 +6525,7 @@ os_file_trim( ...@@ -6524,6 +6525,7 @@ os_file_trim(
" InnoDB: [Warning] fallocate not supported on this installation." " InnoDB: [Warning] fallocate not supported on this installation."
" InnoDB: Disabling fallocate for now."); " InnoDB: Disabling fallocate for now.");
os_fallocate_failed = TRUE; os_fallocate_failed = TRUE;
srv_use_trim = FALSE;
if (slot->write_size) { if (slot->write_size) {
*slot->write_size = 0; *slot->write_size = 0;
} }
...@@ -6543,6 +6545,7 @@ os_file_trim( ...@@ -6543,6 +6545,7 @@ os_file_trim(
if (!ret) { if (!ret) {
/* After first failure do not try to trim again */ /* After first failure do not try to trim again */
os_fallocate_failed = TRUE; os_fallocate_failed = TRUE;
srv_use_trim = FALSE;
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: [Warning] fallocate call failed with error.\n" " InnoDB: [Warning] fallocate call failed with error.\n"
......
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