Commit 2c4d5aa0 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-12353: Replace MLOG_ZIP_PAGE_COMPRESS

page_zip_compress_write_log(): Write MLOG_INIT_FILE_PAGE2
and MLOG_ZIP_WRITE_STRING records instead of MLOG_ZIP_PAGE_COMPRESS.

This depends on the changes to buf_page_io_complete() and friends
in the parent commit.
parent 2a77b2a5
...@@ -361,66 +361,66 @@ page_zip_dir_get( ...@@ -361,66 +361,66 @@ page_zip_dir_get(
- PAGE_ZIP_DIR_SLOT_SIZE * (slot + 1))); - PAGE_ZIP_DIR_SLOT_SIZE * (slot + 1)));
} }
/** Write a MLOG_ZIP_PAGE_COMPRESS record of compressing an index page. /** Write redo log for compressing a ROW_FORMAT=COMPRESSED index page.
@param[in,out] block ROW_FORMAT=COMPRESSED index page @param[in,out] block ROW_FORMAT=COMPRESSED index page
@param[in] index the index that the block belongs to @param[in] index the index that the block belongs to
@param[in,out] mtr mini-transaction */ @param[in,out] mtr mini-transaction */
static void page_zip_compress_write_log(buf_block_t* block, static void page_zip_compress_write_log(buf_block_t *block,
dict_index_t* index, mtr_t* mtr) dict_index_t *index, mtr_t *mtr)
{ {
byte* log_ptr; ut_ad(!index->is_ibuf());
ulint trailer_size;
byte *log_ptr= mlog_open(mtr, 11 + 11 + 2 + 2);
ut_ad(!dict_index_is_ibuf(index));
if (!log_ptr)
log_ptr = mlog_open(mtr, 11 + 2 + 2); return;
if (!log_ptr) { const page_t *page= block->frame;
const page_zip_des_t *page_zip= &block->page.zip;
return; /* Read the number of user records. */
} ulint trailer_size= ulint(page_dir_get_n_heap(page_zip->data)) -
PAGE_HEAP_NO_USER_LOW;
const page_t* page = block->frame; /* Multiply by uncompressed of size stored per record */
const page_zip_des_t* page_zip = &block->page.zip; if (!page_is_leaf(page))
/* Read the number of user records. */ trailer_size*= PAGE_ZIP_DIR_SLOT_SIZE + REC_NODE_PTR_SIZE;
trailer_size = ulint(page_dir_get_n_heap(page_zip->data)) else if (index->is_clust())
- PAGE_HEAP_NO_USER_LOW; trailer_size*= PAGE_ZIP_DIR_SLOT_SIZE + DATA_TRX_ID_LEN +
/* Multiply by uncompressed of size stored per record */ DATA_ROLL_PTR_LEN;
if (!page_is_leaf(page)) { else
trailer_size *= PAGE_ZIP_DIR_SLOT_SIZE + REC_NODE_PTR_SIZE; trailer_size*= PAGE_ZIP_DIR_SLOT_SIZE;
} else if (dict_index_is_clust(index)) { /* Add the space occupied by BLOB pointers. */
trailer_size *= PAGE_ZIP_DIR_SLOT_SIZE trailer_size+= page_zip->n_blobs * BTR_EXTERN_FIELD_REF_SIZE;
+ DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN; ut_a(page_zip->m_end > PAGE_DATA);
} else { compile_time_assert(FIL_PAGE_DATA <= PAGE_DATA);
trailer_size *= PAGE_ZIP_DIR_SLOT_SIZE; ut_a(page_zip->m_end + trailer_size <= page_zip_get_size(page_zip));
}
/* Add the space occupied by BLOB pointers. */ log_ptr= mlog_write_initial_log_record_low(MLOG_INIT_FILE_PAGE2,
trailer_size += page_zip->n_blobs * BTR_EXTERN_FIELD_REF_SIZE; block->page.id.space(),
ut_a(page_zip->m_end > PAGE_DATA); block->page.id.page_no(),
compile_time_assert(FIL_PAGE_DATA <= PAGE_DATA); log_ptr, mtr);
ut_a(page_zip->m_end + trailer_size <= page_zip_get_size(page_zip)); log_ptr = mlog_write_initial_log_record_low(MLOG_ZIP_WRITE_STRING,
block->page.id.space(),
log_ptr = mlog_write_initial_log_record_low(MLOG_ZIP_PAGE_COMPRESS, block->page.id.page_no(),
block->page.id.space(), log_ptr, mtr);
block->page.id.page_no(), mach_write_to_2(log_ptr, FIL_PAGE_PREV);
log_ptr, mtr); mach_write_to_2(log_ptr + 2, page_zip->m_end - FIL_PAGE_PREV);
mach_write_to_2(log_ptr, ulint(page_zip->m_end - FIL_PAGE_TYPE)); mlog_close(mtr, log_ptr + 4);
log_ptr += 2; mlog_catenate_string(mtr, page_zip->data + FIL_PAGE_PREV,
mach_write_to_2(log_ptr, trailer_size); page_zip->m_end - FIL_PAGE_PREV);
log_ptr += 2; if (trailer_size)
mlog_close(mtr, log_ptr); {
log_ptr= mlog_open(mtr, 11 + 2 + 2);
/* Write FIL_PAGE_PREV and FIL_PAGE_NEXT */ log_ptr= mlog_write_initial_log_record_low(MLOG_ZIP_WRITE_STRING,
mlog_catenate_string(mtr, page_zip->data + FIL_PAGE_PREV, 4); block->page.id.space(),
mlog_catenate_string(mtr, page_zip->data + FIL_PAGE_NEXT, 4); block->page.id.page_no(),
/* Write most of the page header, the compressed stream and log_ptr, mtr);
the modification log. */ mach_write_to_2(log_ptr, page_zip_get_size(page_zip) - trailer_size);
mlog_catenate_string(mtr, page_zip->data + FIL_PAGE_TYPE, mach_write_to_2(log_ptr + 2, trailer_size);
ulint(page_zip->m_end - FIL_PAGE_TYPE)); mlog_close(mtr, log_ptr + 4);
/* Write the uncompressed trailer of the compressed page. */ mlog_catenate_string(mtr, page_zip->data + page_zip_get_size(page_zip) -
mlog_catenate_string(mtr, page_zip->data + page_zip_get_size(page_zip) trailer_size, trailer_size);
- trailer_size, trailer_size); }
block->page.init_on_flush = true; block->page.init_on_flush= true; /* because of MLOG_INIT_FILE_PAGE2 */
} }
/******************************************************//** /******************************************************//**
......
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