summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@skysql.com>2014-11-04 12:26:48 +0200
committerJan Lindström <jan.lindstrom@skysql.com>2014-11-04 12:26:48 +0200
commit251fa7ffc59f236a8c493465519bc70152466385 (patch)
tree20aaea2d37ae1f621d3a2a11f587cab9feda770f /storage
parent43f185e171eecdce41e71c548ce0bc2bd6969c0f (diff)
downloadmariadb-git-251fa7ffc59f236a8c493465519bc70152466385.tar.gz
Fix error on trim operation alligment. Furthermore, make sure that
we do not return simulated out of file space on read operation, that would cause crash.
Diffstat (limited to 'storage')
-rw-r--r--storage/innobase/fil/fil0pagecompress.cc10
-rw-r--r--storage/innobase/os/os0file.cc17
-rw-r--r--storage/xtradb/fil/fil0pagecompress.cc10
-rw-r--r--storage/xtradb/os/os0file.cc17
4 files changed, 38 insertions, 16 deletions
diff --git a/storage/innobase/fil/fil0pagecompress.cc b/storage/innobase/fil/fil0pagecompress.cc
index 68a7163897f..52f3792f649 100644
--- a/storage/innobase/fil/fil0pagecompress.cc
+++ b/storage/innobase/fil/fil0pagecompress.cc
@@ -456,9 +456,15 @@ fil_compress_page(
/* Actual write needs to be alligned on block size */
if (write_size % block_size) {
+#ifdef UNIV_DEBUG
+ size_t tmp = write_size;
ut_a(block_size > 0);
- write_size = (write_size + block_size-1) & ~(block_size-1);
- ut_a((write_size % block_size) == 0);
+#endif
+ write_size = (size_t)ut_uint64_align_up((ib_uint64_t)write_size, block_size);
+#ifdef UNIV_DEBUG
+ ut_a(write_size > 0 && ((write_size % block_size) == 0));
+ ut_a(write_size >= tmp);
+#endif
}
#ifdef UNIV_PAGECOMPRESS_DEBUG
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index 31ddd05829c..04a94e5aad2 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -5018,12 +5018,12 @@ os_aio_func(
ret = os_file_write_func(name, file, buf, offset, n);
}
- DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28",
- os_has_said_disk_full = FALSE;);
- DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28",
- ret = 0;);
- DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28",
- errno = 28;);
+ if (type == OS_FILE_WRITE) {
+ DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28",
+ os_has_said_disk_full = FALSE;
+ ret = 0;
+ errno = 28;);
+ }
return ret;
}
@@ -6356,6 +6356,11 @@ os_file_trim(
ut_ad((len % bsize) == 0);
ut_ad(bsize != 0);
+#ifdef UNIV_TRIM_DEBUG
+ fprintf(stderr, "Note: TRIM: write_size %lu trim_len %lu len %lu off %lu\n",
+ *slot->write_size, trim_len, len, off);
+#endif
+
// Nothing to do if trim length is zero or if actual write
// size is initialized and it is smaller than current write size.
// In first write if we trim we set write_size to actual bytes
diff --git a/storage/xtradb/fil/fil0pagecompress.cc b/storage/xtradb/fil/fil0pagecompress.cc
index a4b0e1b486b..3852bc49408 100644
--- a/storage/xtradb/fil/fil0pagecompress.cc
+++ b/storage/xtradb/fil/fil0pagecompress.cc
@@ -453,9 +453,15 @@ fil_compress_page(
/* Actual write needs to be alligned on block size */
if (write_size % block_size) {
+#ifdef UNIV_DEBUG
+ size_t tmp = write_size;
ut_a(block_size > 0);
- write_size = (write_size + block_size-1) & ~(block_size-1);
- ut_a((write_size % block_size) == 0);
+#endif
+ write_size = (size_t)ut_uint64_align_up((ib_uint64_t)write_size, block_size);
+#ifdef UNIV_DEBUG
+ ut_a(write_size > 0 && ((write_size % block_size) == 0));
+ ut_a(write_size >= tmp);
+#endif
}
#ifdef UNIV_PAGECOMPRESS_DEBUG
diff --git a/storage/xtradb/os/os0file.cc b/storage/xtradb/os/os0file.cc
index 18ccc3350cf..fa183d5724d 100644
--- a/storage/xtradb/os/os0file.cc
+++ b/storage/xtradb/os/os0file.cc
@@ -5115,12 +5115,12 @@ os_aio_func(
ret = os_file_write(name, file, buf, offset, n);
}
- DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28",
- os_has_said_disk_full = FALSE;);
- DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28",
- ret = 0;);
- DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28",
- errno = 28;);
+ if (type == OS_FILE_WRITE) {
+ DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28",
+ os_has_said_disk_full = FALSE;
+ ret = 0;
+ errno = 28;);
+ }
if (!ret) {
fprintf(stderr, "FAIL");
@@ -6459,6 +6459,11 @@ os_file_trim(
ut_ad((len % bsize) == 0);
ut_ad(bsize != 0);
+#ifdef UNIV_TRIM_DEBUG
+ fprintf(stderr, "Note: TRIM: write_size %lu trim_len %lu len %lu off %lu\n",
+ *slot->write_size, trim_len, len, off);
+#endif
+
// Nothing to do if trim length is zero or if actual write
// size is initialized and it is smaller than current write size.
// In first write if we trim we set write_size to actual bytes