mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 21:42:35 +01:00
branches/zip: Fix some bugs in incremental compression.
btr_create(): page_zip_compress() returns FALSE on failure. page_zip_write_header(): Write to page_zip->data[] instead of page_zip[]. buf_flush_init_for_writing(): Add parameter page_zip and set the fields also in the header of the compressed page. btr_cur_search_to_nth_level(): Add ut_ad() on page_zip_validate().
This commit is contained in:
parent
d1c2a0f5c1
commit
9a601a1c8b
7 changed files with 33 additions and 10 deletions
|
@ -763,7 +763,7 @@ btr_create(
|
|||
|
||||
page_zip = buf_block_get_page_zip(buf_block_align(page));
|
||||
if (UNIV_LIKELY_NULL(page_zip)) {
|
||||
if (UNIV_UNLIKELY(page_zip_compress(
|
||||
if (UNIV_UNLIKELY(!page_zip_compress(
|
||||
page_zip, page, index, mtr))) {
|
||||
/* An empty page should always be compressible */
|
||||
ut_error;
|
||||
|
|
|
@ -450,6 +450,7 @@ btr_cur_search_to_nth_level(
|
|||
/* Loop and search until we arrive at the desired level */
|
||||
|
||||
for (;;) {
|
||||
buf_block_t* block;
|
||||
retry_page_get:
|
||||
page = buf_page_get_gen(space, page_no, rw_latch, guess,
|
||||
buf_mode,
|
||||
|
@ -482,7 +483,12 @@ retry_page_get:
|
|||
goto retry_page_get;
|
||||
}
|
||||
|
||||
buf_block_align(page)->check_index_page_at_flush = TRUE;
|
||||
block = buf_block_align(page);
|
||||
|
||||
ut_ad(!buf_block_get_page_zip(block) || page_zip_validate(
|
||||
buf_block_get_page_zip(block), page));
|
||||
|
||||
block->check_index_page_at_flush = TRUE;
|
||||
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
if (rw_latch != RW_NO_LATCH) {
|
||||
|
|
|
@ -447,11 +447,14 @@ Initializes a page for writing to the tablespace. */
|
|||
void
|
||||
buf_flush_init_for_writing(
|
||||
/*=======================*/
|
||||
byte* page, /* in: page */
|
||||
byte* page, /* in/out: page */
|
||||
void* page_zip_, /* in/out: compressed page, or NULL */
|
||||
dulint newest_lsn, /* in: newest modification lsn to the page */
|
||||
ulint space, /* in: space id */
|
||||
ulint page_no) /* in: page number */
|
||||
{
|
||||
page_zip_des_t* page_zip = page_zip_;
|
||||
|
||||
/* Write the newest modification lsn to the page header and trailer */
|
||||
mach_write_to_8(page + FIL_PAGE_LSN, newest_lsn);
|
||||
|
||||
|
@ -468,6 +471,14 @@ buf_flush_init_for_writing(
|
|||
srv_use_checksums ?
|
||||
buf_calc_page_new_checksum(page) : BUF_NO_CHECKSUM_MAGIC);
|
||||
|
||||
if (UNIV_LIKELY_NULL(page_zip)) {
|
||||
/* Copy FIL_PAGE_SPACE_OR_CHKSUM and FIL_PAGE_OFFSET */
|
||||
memcpy(page_zip->data, page, FIL_PAGE_PREV);
|
||||
/* Copy FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID */
|
||||
memcpy(page_zip->data + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID,
|
||||
page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, 4);
|
||||
}
|
||||
|
||||
/* We overwrite the first 4 bytes of the end lsn field to store
|
||||
the old formula checksum. Since it depends also on the field
|
||||
FIL_PAGE_SPACE_OR_CHKSUM, it has to be calculated after storing the
|
||||
|
@ -510,8 +521,10 @@ buf_flush_write_block_low(
|
|||
/* Force the log to the disk before writing the modified block */
|
||||
log_write_up_to(block->newest_modification, LOG_WAIT_ALL_GROUPS, TRUE);
|
||||
#endif
|
||||
buf_flush_init_for_writing(block->frame, block->newest_modification,
|
||||
block->space, block->offset);
|
||||
buf_flush_init_for_writing(block->frame,
|
||||
buf_block_get_page_zip(block),
|
||||
block->newest_modification,
|
||||
block->space, block->offset);
|
||||
if (!srv_use_doublewrite_buf || !trx_doublewrite) {
|
||||
fil_io(OS_FILE_WRITE | OS_AIO_SIMULATED_WAKE_LATER,
|
||||
FALSE, block->space, block->offset, 0, UNIV_PAGE_SIZE,
|
||||
|
|
|
@ -2432,7 +2432,8 @@ fil_create_new_single_table_tablespace(
|
|||
|
||||
fsp_header_write_space_id(page, *space_id);
|
||||
|
||||
buf_flush_init_for_writing(page, ut_dulint_zero, *space_id, 0);
|
||||
buf_flush_init_for_writing(page, NULL/* TODO: page_zip */,
|
||||
ut_dulint_zero, *space_id, 0);
|
||||
|
||||
ret = os_file_write(path, file, page, 0, 0, UNIV_PAGE_SIZE);
|
||||
|
||||
|
@ -2594,8 +2595,9 @@ fil_reset_too_high_lsns(
|
|||
+ FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
|
||||
page_no = mach_read_from_4(page + FIL_PAGE_OFFSET);
|
||||
|
||||
buf_flush_init_for_writing(page, current_lsn, space_id,
|
||||
page_no);
|
||||
buf_flush_init_for_writing(page,
|
||||
NULL/* TODO: page_zip */,
|
||||
current_lsn, space_id, page_no);
|
||||
success = os_file_write(filepath, file, page,
|
||||
(ulint)(offset & 0xFFFFFFFFUL),
|
||||
(ulint)(offset >> 32), UNIV_PAGE_SIZE);
|
||||
|
|
|
@ -34,7 +34,8 @@ Initializes a page for writing to the tablespace. */
|
|||
void
|
||||
buf_flush_init_for_writing(
|
||||
/*=======================*/
|
||||
byte* page, /* in: page */
|
||||
byte* page, /* in/out: page */
|
||||
void* page_zip, /* in/out: compressed page, or NULL */
|
||||
dulint newest_lsn, /* in: newest modification lsn to the page */
|
||||
ulint space, /* in: space id */
|
||||
ulint page_no); /* in: page number */
|
||||
|
|
|
@ -272,7 +272,7 @@ page_zip_write_header(
|
|||
|
||||
ut_ad(pos < PAGE_DATA);
|
||||
|
||||
memcpy(page_zip + pos, str, length);
|
||||
memcpy(page_zip->data + pos, str, length);
|
||||
|
||||
/* The following would fail in page_cur_insert_rec_low(). */
|
||||
/* ut_ad(page_zip_validate(page_zip, str - pos)); */
|
||||
|
|
|
@ -1612,6 +1612,7 @@ recv_addr->space, recv_addr->page_no);
|
|||
fil0fil.c routines */
|
||||
|
||||
buf_flush_init_for_writing(page,
|
||||
NULL,/* TODO: page_zip */
|
||||
mach_read_from_8(page + FIL_PAGE_LSN),
|
||||
recv_addr->space, recv_addr->page_no);
|
||||
|
||||
|
|
Loading…
Reference in a new issue