Commit 6241b552 authored by marko's avatar marko

branches/zip: Stamp (space_id, page_no) on buffer pool pages early on.

buf_flush_init_for_writing(): Remove parameters space, page_no.

fsp_init_file_page_low(): Wriet space_id and page_no to the page.

fil_create_new_single_table_tablespace(): Write space_id to the page.
parent 9a2c2f4a
...@@ -503,9 +503,7 @@ buf_flush_init_for_writing( ...@@ -503,9 +503,7 @@ buf_flush_init_for_writing(
/*=======================*/ /*=======================*/
byte* page, /* in/out: page */ byte* page, /* in/out: page */
void* page_zip_, /* in/out: compressed page, or NULL */ void* page_zip_, /* in/out: compressed page, or NULL */
dulint newest_lsn, /* in: newest modification lsn to the page */ dulint newest_lsn) /* in: newest modification lsn to the page */
ulint space, /* in: space id */
ulint page_no) /* in: page number */
{ {
if (page_zip_) { if (page_zip_) {
page_zip_des_t* page_zip = page_zip_; page_zip_des_t* page_zip = page_zip_;
...@@ -525,18 +523,8 @@ buf_flush_init_for_writing( ...@@ -525,18 +523,8 @@ buf_flush_init_for_writing(
/* fall through */ /* fall through */
case FIL_PAGE_TYPE_ZBLOB: case FIL_PAGE_TYPE_ZBLOB:
case FIL_PAGE_INDEX: case FIL_PAGE_INDEX:
mach_write_to_4(page
+ FIL_PAGE_OFFSET, page_no);
mach_write_to_4(page
+ FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID,
space);
mach_write_to_4(page_zip->data
+ FIL_PAGE_OFFSET, page_no);
mach_write_to_8(page_zip->data mach_write_to_8(page_zip->data
+ FIL_PAGE_LSN, newest_lsn); + FIL_PAGE_LSN, newest_lsn);
mach_write_to_4(page_zip->data
+ FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID,
space);
memset(page_zip->data + FIL_PAGE_FILE_FLUSH_LSN, 0, 8); memset(page_zip->data + FIL_PAGE_FILE_FLUSH_LSN, 0, 8);
mach_write_to_4(page_zip->data mach_write_to_4(page_zip->data
+ FIL_PAGE_SPACE_OR_CHKSUM, + FIL_PAGE_SPACE_OR_CHKSUM,
...@@ -555,10 +543,6 @@ buf_flush_init_for_writing( ...@@ -555,10 +543,6 @@ buf_flush_init_for_writing(
mach_write_to_8(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM, mach_write_to_8(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
newest_lsn); newest_lsn);
/* Write the page number and the space id */
mach_write_to_4(page + FIL_PAGE_OFFSET, page_no);
mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, space);
/* Store the new formula checksum */ /* Store the new formula checksum */
...@@ -612,8 +596,7 @@ buf_flush_write_block_low( ...@@ -612,8 +596,7 @@ buf_flush_write_block_low(
#endif #endif
buf_flush_init_for_writing(block->frame, buf_flush_init_for_writing(block->frame,
buf_frame_get_page_zip(block->frame), buf_frame_get_page_zip(block->frame),
block->newest_modification, block->newest_modification);
block->space, block->offset);
if (!srv_use_doublewrite_buf || !trx_doublewrite) { if (!srv_use_doublewrite_buf || !trx_doublewrite) {
fil_io(OS_FILE_WRITE | OS_AIO_SIMULATED_WAKE_LATER, fil_io(OS_FILE_WRITE | OS_AIO_SIMULATED_WAKE_LATER,
FALSE, block->space, block->page_zip.size, FALSE, block->space, block->page_zip.size,
......
...@@ -2651,18 +2651,17 @@ error_exit2: ...@@ -2651,18 +2651,17 @@ error_exit2:
memset(page, '\0', UNIV_PAGE_SIZE); memset(page, '\0', UNIV_PAGE_SIZE);
fsp_header_init_fields(page, *space_id, zip_size); fsp_header_init_fields(page, *space_id, zip_size);
mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, *space_id);
if (!zip_size) { if (!zip_size) {
buf_flush_init_for_writing(page, NULL, buf_flush_init_for_writing(page, NULL, ut_dulint_zero);
ut_dulint_zero, *space_id, 0);
ret = os_file_write(path, file, page, 0, 0, UNIV_PAGE_SIZE); ret = os_file_write(path, file, page, 0, 0, UNIV_PAGE_SIZE);
} else { } else {
page_zip_des_t page_zip; page_zip_des_t page_zip;
page_zip.size = zip_size; page_zip.size = zip_size;
page_zip.data = page + UNIV_PAGE_SIZE; page_zip.data = page + UNIV_PAGE_SIZE;
page_zip.n_blobs = page_zip.m_start = page_zip.m_end = 0; page_zip.n_blobs = page_zip.m_start = page_zip.m_end = 0;
buf_flush_init_for_writing(page, &page_zip, buf_flush_init_for_writing(page, &page_zip, ut_dulint_zero);
ut_dulint_zero, *space_id, 0);
ret = os_file_write(path, file, page_zip.data, 0, 0, zip_size); ret = os_file_write(path, file, page_zip.data, 0, 0, zip_size);
} }
...@@ -2746,7 +2745,6 @@ fil_reset_too_high_lsns( ...@@ -2746,7 +2745,6 @@ fil_reset_too_high_lsns(
ulint space_id; ulint space_id;
ib_longlong file_size; ib_longlong file_size;
ib_longlong offset; ib_longlong offset;
ulint page_no;
ulint zip_size; ulint zip_size;
ibool success; ibool success;
...@@ -2832,19 +2830,15 @@ fil_reset_too_high_lsns( ...@@ -2832,19 +2830,15 @@ fil_reset_too_high_lsns(
if (ut_dulint_cmp(mach_read_from_8(page + FIL_PAGE_LSN), if (ut_dulint_cmp(mach_read_from_8(page + FIL_PAGE_LSN),
current_lsn) > 0) { current_lsn) > 0) {
/* We have to reset the lsn */ /* We have to reset the lsn */
space_id = mach_read_from_4(
page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
page_no = mach_read_from_4(page + FIL_PAGE_OFFSET);
if (zip_size) { if (zip_size) {
memcpy(page + UNIV_PAGE_SIZE, page, zip_size); memcpy(page + UNIV_PAGE_SIZE, page, zip_size);
buf_flush_init_for_writing( buf_flush_init_for_writing(
page, page + UNIV_PAGE_SIZE, page, page + UNIV_PAGE_SIZE,
current_lsn, space_id, page_no); current_lsn);
} else { } else {
buf_flush_init_for_writing( buf_flush_init_for_writing(
page, NULL, page, NULL, current_lsn);
current_lsn, space_id, page_no);
} }
success = os_file_write(filepath, file, page, success = os_file_write(filepath, file, page,
(ulint)(offset & 0xFFFFFFFFUL), (ulint)(offset & 0xFFFFFFFFUL),
......
...@@ -826,14 +826,25 @@ fsp_init_file_page_low( ...@@ -826,14 +826,25 @@ fsp_init_file_page_low(
if (UNIV_LIKELY_NULL(page_zip)) { if (UNIV_LIKELY_NULL(page_zip)) {
memset(page, 0, UNIV_PAGE_SIZE); memset(page, 0, UNIV_PAGE_SIZE);
memset(page_zip->data, 0, page_zip->size); memset(page_zip->data, 0, page_zip->size);
mach_write_to_4(page + FIL_PAGE_OFFSET, block->offset);
mach_write_to_4(page
+ FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID,
block->space);
mach_write_to_4(page_zip->data
+ FIL_PAGE_OFFSET, block->offset);
mach_write_to_4(page_zip->data
+ FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID,
block->space);
return; return;
} }
#ifdef UNIV_BASIC_LOG_DEBUG #ifdef UNIV_BASIC_LOG_DEBUG
memset(page, 0xff, UNIV_PAGE_SIZE); memset(page, 0xff, UNIV_PAGE_SIZE);
#endif #endif
memset(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM, 0, 8); mach_write_to_4(page + FIL_PAGE_OFFSET, block->offset);
memset(page + FIL_PAGE_LSN, 0, 8); memset(page + FIL_PAGE_LSN, 0, 8);
mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, block->space);
memset(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM, 0, 8);
} }
/*************************************************************** /***************************************************************
......
...@@ -36,9 +36,7 @@ buf_flush_init_for_writing( ...@@ -36,9 +36,7 @@ buf_flush_init_for_writing(
/*=======================*/ /*=======================*/
byte* page, /* in/out: page */ byte* page, /* in/out: page */
void* page_zip, /* in/out: compressed page, or NULL */ void* page_zip, /* in/out: compressed page, or NULL */
dulint newest_lsn, /* in: newest modification lsn to the page */ dulint newest_lsn); /* in: newest modification lsn to the page */
ulint space, /* in: space id */
ulint page_no); /* in: page number */
/*********************************************************************** /***********************************************************************
This utility flushes dirty blocks from the end of the LRU list or flush_list. This utility flushes dirty blocks from the end of the LRU list or flush_list.
NOTE 1: in the case of an LRU flush the calling thread may own latches to NOTE 1: in the case of an LRU flush the calling thread may own latches to
......
...@@ -1656,8 +1656,7 @@ recv_apply_log_recs_for_backup(void) ...@@ -1656,8 +1656,7 @@ recv_apply_log_recs_for_backup(void)
buf_flush_init_for_writing( buf_flush_init_for_writing(
block->frame, buf_block_get_page_zip(block), block->frame, buf_block_get_page_zip(block),
mach_read_from_8(block->frame + FIL_PAGE_LSN), mach_read_from_8(block->frame + FIL_PAGE_LSN));
recv_addr->space, recv_addr->page_no);
if (zip_size) { if (zip_size) {
error = fil_io(OS_FILE_WRITE, TRUE, error = fil_io(OS_FILE_WRITE, TRUE,
......
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