Commit 7322270a authored by Jan Lindström's avatar Jan Lindström

Set actual compressed page size also on read code path to buffer pool so

that we can later use it to avoid unnecessary trim operations. 
parent fd38dca5
......@@ -185,7 +185,7 @@ buf_read_page_low(
*err = fil_io(OS_FILE_READ | wake_later
| ignore_nonexistent_pages,
sync, space, zip_size, offset, 0, zip_size,
bpage->zip.data, bpage, 0);
bpage->zip.data, bpage, &bpage->write_size);
} else {
ut_a(buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE);
......
......@@ -226,7 +226,9 @@ fil_decompress_page(
byte* page_buf, /*!< in: preallocated buffer or NULL */
byte* buf, /*!< out: buffer from which to read; in aio
this must be appropriately aligned */
ulint len) /*!< in: length of output buffer.*/
ulint len, /*!< in: length of output buffer.*/
ulint* write_size) /*!< in/out: Actual payload size of
the compressed data. */
{
int err = 0;
ulint actual_size = 0;
......@@ -277,6 +279,12 @@ fil_decompress_page(
ut_error;
}
/* Store actual payload size of the compressed data. This pointer
points to buffer pool. */
if (write_size) {
*write_size = actual_size;
}
if (compression_alg == FIL_PAGE_COMPRESSION_ZLIB) {
#ifdef UNIV_DEBUG
......
......@@ -97,7 +97,9 @@ fil_decompress_page(
byte* page_buf, /*!< in: preallocated buffer or NULL */
byte* buf, /*!< out: buffer from which to read; in aio
this must be appropriately aligned */
ulint len); /*!< in: length of output buffer.*/
ulint len, /*!< in: length of output buffer.*/
ulint* write_size); /*!< in/out: Actual payload size of
the compressed data. */
/****************************************************************//**
Get space id from fil node
......
......@@ -2821,7 +2821,7 @@ try_again:
if (ret && len == n) {
if (fil_page_is_compressed((byte *)buf)) {
fil_decompress_page(NULL, (byte *)buf, len);
fil_decompress_page(NULL, (byte *)buf, len, NULL);
}
return(TRUE);
}
......@@ -2836,7 +2836,7 @@ try_again:
if ((ulint) ret == n) {
if (fil_page_is_compressed((byte *)buf)) {
fil_decompress_page(NULL, (byte *)buf, n);
fil_decompress_page(NULL, (byte *)buf, n, NULL);
}
return(TRUE);
......@@ -5164,7 +5164,7 @@ os_aio_windows_handle(
if (slot->type == OS_FILE_READ) {
if (fil_page_is_compressed(slot->buf)) {
fil_decompress_page(slot->page_buf, slot->buf, slot->len);
fil_decompress_page(slot->page_buf, slot->buf, slot->len, slot->write_size);
}
} else {
if (slot->page_compress_success && fil_page_is_compressed(slot->page_buf)) {
......@@ -5278,7 +5278,7 @@ retry:
if (slot->type == OS_FILE_READ) {
if (fil_page_is_compressed(slot->buf)) {
fil_decompress_page(slot->page_buf, slot->buf, slot->len);
fil_decompress_page(slot->page_buf, slot->buf, slot->len, slot->write_size);
}
} else {
if (slot->page_compress_success &&
......@@ -6219,7 +6219,9 @@ os_file_trim(
" InnoDB: [Warning] fallocate not supported on this installation."
" InnoDB: Disabling fallocate for now.");
os_fallocate_failed = TRUE;
slot->write_size = NULL;
if (slot->write_size) {
*slot->write_size = 0;
}
#endif /* HAVE_FALLOCATE ... */
......
......@@ -237,7 +237,7 @@ not_to_recover:
*err = _fil_io(OS_FILE_READ | wake_later
| ignore_nonexistent_pages,
sync, space, 0, offset, 0, UNIV_PAGE_SIZE,
((buf_block_t*) bpage)->frame, bpage, 0, trx);
((buf_block_t*) bpage)->frame, bpage, &bpage->write_size, trx);
}
if (sync) {
......
......@@ -222,7 +222,9 @@ fil_decompress_page(
byte* page_buf, /*!< in: preallocated buffer or NULL */
byte* buf, /*!< out: buffer from which to read; in aio
this must be appropriately aligned */
ulint len) /*!< in: length of output buffer.*/
ulint len, /*!< in: length of output buffer.*/
ulint* write_size) /*!< in/out: Actual payload size of
the compressed data. */
{
int err = 0;
ulint actual_size = 0;
......@@ -273,6 +275,12 @@ fil_decompress_page(
ut_error;
}
/* Store actual payload size of the compressed data. This pointer
points to buffer pool. */
if (write_size) {
*write_size = actual_size;
}
if (compression_alg == FIL_PAGE_COMPRESSION_ZLIB) {
#ifdef UNIV_DEBUG
......
......@@ -97,7 +97,9 @@ fil_decompress_page(
byte* page_buf, /*!< in: preallocated buffer or NULL */
byte* buf, /*!< out: buffer from which to read; in aio
this must be appropriately aligned */
ulint len); /*!< in: length of output buffer.*/
ulint len, /*!< in: length of output buffer.*/
ulint* write_size); /*!< in/out: Actual payload size of
the compressed data. */
/****************************************************************//**
Get space id from fil node
......
......@@ -3009,7 +3009,7 @@ try_again:
if (ret && len == n) {
if (fil_page_is_compressed((byte *)buf)) {
fil_decompress_page(NULL, (byte *)buf, len);
fil_decompress_page(NULL, (byte *)buf, len, NULL);
}
return(TRUE);
}
......@@ -3025,7 +3025,7 @@ try_again:
if ((ulint) ret == n) {
if (fil_page_is_compressed((byte *)buf)) {
fil_decompress_page(NULL, (byte *)buf, n);
fil_decompress_page(NULL, (byte *)buf, n, NULL);
}
return(TRUE);
......@@ -3129,7 +3129,7 @@ try_again:
if ((ulint) ret == n) {
if (fil_page_is_compressed((byte *)buf)) {
fil_decompress_page(NULL, (byte *)buf, n);
fil_decompress_page(NULL, (byte *)buf, n, NULL);
}
return(TRUE);
......@@ -5223,7 +5223,7 @@ os_aio_windows_handle(
if (slot->type == OS_FILE_READ) {
if (fil_page_is_compressed(slot->buf)) {
fil_decompress_page(slot->page_buf, slot->buf, slot->len);
fil_decompress_page(slot->page_buf, slot->buf, slot->len, slot->write_size);
}
} else {
if (slot->page_compress_success && fil_page_is_compressed(slot->page_buf)) {
......@@ -5337,7 +5337,7 @@ retry:
if (slot->type == OS_FILE_READ) {
if (fil_page_is_compressed(slot->buf)) {
fil_decompress_page(slot->page_buf, slot->buf, slot->len);
fil_decompress_page(slot->page_buf, slot->buf, slot->len, slot->write_size);
}
} else {
if (slot->page_compress_success &&
......@@ -6284,7 +6284,9 @@ os_file_trim(
" InnoDB: [Warning] fallocate not supported on this installation."
" InnoDB: Disabling fallocate for now.");
os_fallocate_failed = TRUE;
slot->write_size = NULL;
if (slot->write_size) {
*slot->write_size = 0;
}
#endif /* HAVE_FALLOCATE ... */
......
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