Commit 01590005 authored by Jan Lindström's avatar Jan Lindström

Fix buildbot valgrind errors on test innodb.innodb-page_compression_tables

Problem was that temporal buffers allocated for page compression
are not initialized and rest of the page that is actually writen
was als not initialized after previous usage.
parent 3502d741
......@@ -456,11 +456,14 @@ 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;
#ifdef UNIV_DEBUG
ut_a(block_size > 0);
#endif
write_size = (size_t)ut_uint64_align_up((ib_uint64_t)write_size, block_size);
/* Initialize rest of the written data to avoid
uninitialized bytes */
memset(out_buf+tmp, 0, write_size-tmp);
#ifdef UNIV_DEBUG
ut_a(write_size > 0 && ((write_size % block_size) == 0));
ut_a(write_size >= tmp);
......@@ -477,19 +480,10 @@ 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 */
page and end of the page needs to be initialized.*/
memset(out_buf+write_size, 0, len-write_size);
write_size = len;
}
......
......@@ -6397,7 +6397,7 @@ os_file_trim(
}
#ifdef __linux__
#if defined(FALLOC_FL_PUNCH_HOLE) && defined (FALLOC_FL_KEEP_SIZE)
#if defined(HAVE_POSIX_FALLOCATE)
int ret = fallocate(slot->file, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, off, trim_len);
if (ret) {
......@@ -6435,7 +6435,7 @@ os_file_trim(
*slot->write_size = 0;
}
#endif /* HAVE_FALLOCATE ... */
#endif /* HAVE_POSIX_FALLOCATE ... */
#elif defined(_WIN32)
FILE_LEVEL_TRIM flt;
......@@ -6523,6 +6523,7 @@ os_slot_alloc_page_buf(
cbuf = static_cast<byte *>(ut_align(cbuf2, UNIV_PAGE_SIZE));
slot->page_compression_page = static_cast<byte *>(cbuf2);
slot->page_buf = static_cast<byte *>(cbuf);
memset(slot->page_buf, 0, UNIV_PAGE_SIZE);
ut_a(slot->page_buf != NULL);
}
......@@ -6538,6 +6539,7 @@ os_slot_alloc_lzo_mem(
{
ut_a(slot != NULL);
slot->lzo_mem = static_cast<byte *>(ut_malloc(LZO1X_1_15_MEM_COMPRESS));
memset(slot->lzo_mem, 0, LZO1X_1_15_MEM_COMPRESS);
ut_a(slot->lzo_mem != NULL);
}
#endif
......
......@@ -453,11 +453,14 @@ 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;
#ifdef UNIV_DEBUG
ut_a(block_size > 0);
#endif
write_size = (size_t)ut_uint64_align_up((ib_uint64_t)write_size, block_size);
/* Initialize rest of the written data to avoid
uninitialized bytes */
memset(out_buf+tmp, 0, write_size-tmp);
#ifdef UNIV_DEBUG
ut_a(write_size > 0 && ((write_size % block_size) == 0));
ut_a(write_size >= tmp);
......@@ -474,19 +477,10 @@ 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 */
page and end of the page needs to be initialized.*/
memset(out_buf+write_size, 0, len-write_size);
write_size = len;
}
......
......@@ -6490,7 +6490,7 @@ os_file_trim(
}
#ifdef __linux__
#if defined(FALLOC_FL_PUNCH_HOLE) && defined (FALLOC_FL_KEEP_SIZE)
#if defined(POSIX_FALLOCATE)
int ret = fallocate(slot->file, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, off, trim_len);
if (ret) {
......@@ -6528,7 +6528,7 @@ os_file_trim(
*slot->write_size = 0;
}
#endif /* HAVE_FALLOCATE ... */
#endif /* HAVE_POSIX_FALLOCATE ... */
#elif defined(_WIN32)
FILE_LEVEL_TRIM flt;
......@@ -6615,6 +6615,7 @@ os_slot_alloc_page_buf(
cbuf = static_cast<byte *>(ut_align(cbuf2, UNIV_PAGE_SIZE));
slot->page_compression_page = static_cast<byte *>(cbuf2);
slot->page_buf = static_cast<byte *>(cbuf);
memset(slot->page_buf, 0, UNIV_PAGE_SIZE);
ut_a(slot->page_buf != NULL);
}
......@@ -6630,6 +6631,7 @@ os_slot_alloc_lzo_mem(
{
ut_a(slot != NULL);
slot->lzo_mem = static_cast<byte *>(ut_malloc(LZO1X_1_15_MEM_COMPRESS));
memset(slot->lzo_mem, 0, LZO1X_1_15_MEM_COMPRESS);
ut_a(slot->lzo_mem != NULL);
}
#endif
......
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