Skip to content

Commit 1a05bb4

Browse files
author
Jan Lindström
committed
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.
1 parent deffb95 commit 1a05bb4

File tree

4 files changed

+50
-2
lines changed

4 files changed

+50
-2
lines changed

storage/innobase/fil/fil0pagecompress.cc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,23 @@ fil_compress_page(
476476

477477
srv_stats.page_compression_saved.add((len - write_size));
478478
srv_stats.pages_page_compressed.inc();
479+
480+
#if defined (__linux__) && (!defined(FALLOC_FL_PUNCH_HOLE) || !defined (FALLOC_FL_KEEP_SIZE))
481+
if (srv_use_trim) {
482+
ut_print_timestamp(stderr);
483+
fprintf(stderr,
484+
" InnoDB: [Warning] System does not support FALLOC_FL_PUNCH_HOLE || FALLOC_FL_KEEP_SIZE.\n"
485+
" InnoDB: Disabling trim for now.\n");
486+
srv_use_trim = FALSE;
487+
}
488+
#endif
489+
490+
if (!srv_use_trim) {
491+
/* If persistent trims are not used we always write full
492+
page */
493+
write_size = len;
494+
}
495+
479496
*out_len = write_size;
480497

481498
return(out_buf);

storage/innobase/os/os0file.cc

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5265,9 +5265,17 @@ os_aio_windows_handle(
52655265
if (ret && len == slot->len) {
52665266

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

5270-
retry = TRUE;
5270+
if (!ret) {
5271+
if (os_file_handle_error(slot->name, "Windows aio", __FILE__, __LINE__)) {
5272+
retry = TRUE;
5273+
} else {
5274+
ret_val = FALSE;
5275+
}
5276+
} else {
5277+
retry = TRUE;
5278+
}
52715279
} else {
52725280

52735281
ret_val = FALSE;
@@ -6395,6 +6403,7 @@ os_file_trim(
63956403
if (ret) {
63966404
/* After first failure do not try to trim again */
63976405
os_fallocate_failed = TRUE;
6406+
srv_use_trim = FALSE;
63986407
ut_print_timestamp(stderr);
63996408
fprintf(stderr,
64006409
" InnoDB: [Warning] fallocate call failed with error code %d.\n"
@@ -6421,6 +6430,7 @@ os_file_trim(
64216430
" InnoDB: [Warning] fallocate not supported on this installation."
64226431
" InnoDB: Disabling fallocate for now.");
64236432
os_fallocate_failed = TRUE;
6433+
srv_use_trim = FALSE;
64246434
if (slot->write_size) {
64256435
*slot->write_size = 0;
64266436
}
@@ -6440,6 +6450,7 @@ os_file_trim(
64406450
if (!ret) {
64416451
/* After first failure do not try to trim again */
64426452
os_fallocate_failed = TRUE;
6453+
srv_use_trim=FALSE;
64436454
ut_print_timestamp(stderr);
64446455
fprintf(stderr,
64456456
" InnoDB: [Warning] fallocate call failed with error.\n"

storage/xtradb/fil/fil0pagecompress.cc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,23 @@ fil_compress_page(
473473

474474
srv_stats.page_compression_saved.add((len - write_size));
475475
srv_stats.pages_page_compressed.inc();
476+
477+
#if defined (__linux__) && (!defined(FALLOC_FL_PUNCH_HOLE) || !defined (FALLOC_FL_KEEP_SIZE))
478+
if (srv_use_trim) {
479+
ut_print_timestamp(stderr);
480+
fprintf(stderr,
481+
" InnoDB: [Warning] System does not support FALLOC_FL_PUNCH_HOLE || FALLOC_FL_KEEP_SIZE.\n"
482+
" InnoDB: Disabling trim for now.\n");
483+
srv_use_trim = FALSE;
484+
}
485+
#endif
486+
487+
if (!srv_use_trim) {
488+
/* If persistent trims are not used we always write full
489+
page */
490+
write_size = len;
491+
}
492+
476493
*out_len = write_size;
477494

478495
return(out_buf);

storage/xtradb/os/os0file.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6498,6 +6498,7 @@ os_file_trim(
64986498
if (ret) {
64996499
/* After first failure do not try to trim again */
65006500
os_fallocate_failed = TRUE;
6501+
srv_use_trim = FALSE;
65016502
ut_print_timestamp(stderr);
65026503
fprintf(stderr,
65036504
" InnoDB: [Warning] fallocate call failed with error code %d.\n"
@@ -6524,6 +6525,7 @@ os_file_trim(
65246525
" InnoDB: [Warning] fallocate not supported on this installation."
65256526
" InnoDB: Disabling fallocate for now.");
65266527
os_fallocate_failed = TRUE;
6528+
srv_use_trim = FALSE;
65276529
if (slot->write_size) {
65286530
*slot->write_size = 0;
65296531
}
@@ -6543,6 +6545,7 @@ os_file_trim(
65436545
if (!ret) {
65446546
/* After first failure do not try to trim again */
65456547
os_fallocate_failed = TRUE;
6548+
srv_use_trim = FALSE;
65466549
ut_print_timestamp(stderr);
65476550
fprintf(stderr,
65486551
" InnoDB: [Warning] fallocate call failed with error.\n"

0 commit comments

Comments
 (0)