diff --git a/storage/innobase/fil/fil0pagecompress.cc b/storage/innobase/fil/fil0pagecompress.cc index 52f3792f649..2b0196c9017 100644 --- a/storage/innobase/fil/fil0pagecompress.cc +++ b/storage/innobase/fil/fil0pagecompress.cc @@ -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); diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index d97f6a39931..ee00b15c72c 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -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; @@ -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" @@ -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; } @@ -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" diff --git a/storage/xtradb/fil/fil0pagecompress.cc b/storage/xtradb/fil/fil0pagecompress.cc index 3852bc49408..20b6b0b1b15 100644 --- a/storage/xtradb/fil/fil0pagecompress.cc +++ b/storage/xtradb/fil/fil0pagecompress.cc @@ -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); diff --git a/storage/xtradb/os/os0file.cc b/storage/xtradb/os/os0file.cc index aa39e7bab7a..bb67f2d453c 100644 --- a/storage/xtradb/os/os0file.cc +++ b/storage/xtradb/os/os0file.cc @@ -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" @@ -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; } @@ -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"