Commit 251fa7ff authored by Jan Lindström's avatar Jan Lindström

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.
parent 43f185e1
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
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