1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-09 22:24:09 +03:00

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.
This commit is contained in:
Jan Lindström
2014-03-04 17:14:08 +02:00
parent fd38dca5d5
commit 7322270a05
8 changed files with 41 additions and 17 deletions

View File

@@ -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);

View File

@@ -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

View File

@@ -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

View File

@@ -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 ... */

View File

@@ -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) {

View File

@@ -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

View File

@@ -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

View File

@@ -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 ... */