Commit b0ae76c5 authored by marko's avatar marko

branches/zip: Minor cleanup and bug fixes

btr_page_reorganize_low(): Rename new_page to temp_page.

btr_store_big_rec_extern_fields(): FIL_PAGE_TYPE is 2 bytes, not 4.

buf_page_init(), buf_page_create(), buf_read_page_low(),
buf_page_init_for_read(): Add parameter zip_size.

buf_page_init_for_backup_restore(),
recv_apply_log_recs_for_backup(): Enclose in #ifdef UNIV_HOTBACKUP.

Enclose some debug code in #ifdef UNIV_LOG_REPLICATE.

page_zip_write_header_log(): Replace page_zip with a pointer to
the uncompressed page.

page_zip_write_rec(): Relax an assertion about blob_no + n_ext.

page_copy_rec_list_to_created_page_write_log(): Allow logging to be disabled.
parent 121623c1
...@@ -858,7 +858,7 @@ btr_page_reorganize_low( ...@@ -858,7 +858,7 @@ btr_page_reorganize_low(
dict_index_t* index, /* in: record descriptor */ dict_index_t* index, /* in: record descriptor */
mtr_t* mtr) /* in: mtr */ mtr_t* mtr) /* in: mtr */
{ {
page_t* new_page; page_t* temp_page;
ulint log_mode; ulint log_mode;
ulint data_size1; ulint data_size1;
ulint data_size2; ulint data_size2;
...@@ -881,10 +881,10 @@ btr_page_reorganize_low( ...@@ -881,10 +881,10 @@ btr_page_reorganize_low(
/* Turn logging off */ /* Turn logging off */
log_mode = mtr_set_log_mode(mtr, MTR_LOG_NONE); log_mode = mtr_set_log_mode(mtr, MTR_LOG_NONE);
new_page = buf_frame_alloc(); temp_page = buf_frame_alloc();
/* Copy the old page to temporary space */ /* Copy the old page to temporary space */
buf_frame_copy(new_page, page); buf_frame_copy(temp_page, page);
if (UNIV_LIKELY(!recovery)) { if (UNIV_LIKELY(!recovery)) {
btr_search_drop_page_hash_index(page); btr_search_drop_page_hash_index(page);
...@@ -900,16 +900,16 @@ btr_page_reorganize_low( ...@@ -900,16 +900,16 @@ btr_page_reorganize_low(
do not copy the lock bits yet */ do not copy the lock bits yet */
page_copy_rec_list_end_no_locks(page, page_copy_rec_list_end_no_locks(page,
page_get_infimum_rec(new_page), index, mtr); page_get_infimum_rec(temp_page), index, mtr);
/* Copy max trx id to recreated page */ /* Copy max trx id to recreated page */
page_set_max_trx_id(page, NULL, page_get_max_trx_id(new_page)); page_set_max_trx_id(page, NULL, page_get_max_trx_id(temp_page));
if (UNIV_LIKELY_NULL(page_zip)) { if (UNIV_LIKELY_NULL(page_zip)) {
if (UNIV_UNLIKELY(!page_zip_compress( if (UNIV_UNLIKELY(!page_zip_compress(
page_zip, page, index))) { page_zip, page, index))) {
/* Restore the old page and exit. */ /* Restore the old page and exit. */
buf_frame_copy(page, new_page); buf_frame_copy(page, temp_page);
goto func_exit; goto func_exit;
} }
...@@ -917,7 +917,7 @@ btr_page_reorganize_low( ...@@ -917,7 +917,7 @@ btr_page_reorganize_low(
if (UNIV_LIKELY(!recovery)) { if (UNIV_LIKELY(!recovery)) {
/* Update the record lock bitmaps */ /* Update the record lock bitmaps */
lock_move_reorganize_page(page, new_page); lock_move_reorganize_page(page, temp_page);
} }
data_size2 = page_get_data_size(page); data_size2 = page_get_data_size(page);
...@@ -926,7 +926,7 @@ btr_page_reorganize_low( ...@@ -926,7 +926,7 @@ btr_page_reorganize_low(
if (UNIV_UNLIKELY(data_size1 != data_size2) if (UNIV_UNLIKELY(data_size1 != data_size2)
|| UNIV_UNLIKELY(max_ins_size1 != max_ins_size2)) { || UNIV_UNLIKELY(max_ins_size1 != max_ins_size2)) {
buf_page_print(page); buf_page_print(page);
buf_page_print(new_page); buf_page_print(temp_page);
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: page old data size %lu new data size %lu\n" "InnoDB: Error: page old data size %lu new data size %lu\n"
"InnoDB: Error: page old max ins size %lu new max ins size %lu\n" "InnoDB: Error: page old max ins size %lu new max ins size %lu\n"
...@@ -940,7 +940,7 @@ btr_page_reorganize_low( ...@@ -940,7 +940,7 @@ btr_page_reorganize_low(
func_exit: func_exit:
ut_ad(!page_zip || page_zip_validate(page_zip, page)); ut_ad(!page_zip || page_zip_validate(page_zip, page));
buf_frame_free(new_page); buf_frame_free(temp_page);
/* Restore logging mode */ /* Restore logging mode */
mtr_set_log_mode(mtr, log_mode); mtr_set_log_mode(mtr, log_mode);
......
...@@ -3605,7 +3605,7 @@ btr_store_big_rec_extern_fields( ...@@ -3605,7 +3605,7 @@ btr_store_big_rec_extern_fields(
if (UNIV_LIKELY_NULL(page_zip)) { if (UNIV_LIKELY_NULL(page_zip)) {
int err; int err;
mach_write_to_4(page + FIL_PAGE_TYPE, mach_write_to_2(page + FIL_PAGE_TYPE,
FIL_PAGE_TYPE_ZBLOB); FIL_PAGE_TYPE_ZBLOB);
c_stream.next_out = page c_stream.next_out = page
......
...@@ -1559,6 +1559,7 @@ buf_page_get_known_nowait( ...@@ -1559,6 +1559,7 @@ buf_page_get_known_nowait(
return(TRUE); return(TRUE);
} }
#ifdef UNIV_HOTBACKUP
/************************************************************************ /************************************************************************
Inits a page to the buffer buf_pool, for use in ibbackup --restore. */ Inits a page to the buffer buf_pool, for use in ibbackup --restore. */
...@@ -1594,9 +1595,12 @@ buf_page_init_for_backup_restore( ...@@ -1594,9 +1595,12 @@ buf_page_init_for_backup_restore(
block->n_fields = 1; block->n_fields = 1;
block->n_bytes = 0; block->n_bytes = 0;
block->side = BTR_SEARCH_LEFT_SIDE; block->side = BTR_SEARCH_LEFT_SIDE;
page_zip_des_init(&block->page_zip);
/* TODO: allocate page_zip->data? */
block->file_page_was_freed = FALSE; block->file_page_was_freed = FALSE;
} }
#endif /* UNIV_HOTBACKUP */
/************************************************************************ /************************************************************************
Inits a page to the buffer buf_pool. */ Inits a page to the buffer buf_pool. */
...@@ -1607,12 +1611,15 @@ buf_page_init( ...@@ -1607,12 +1611,15 @@ buf_page_init(
ulint space, /* in: space id */ ulint space, /* in: space id */
ulint offset, /* in: offset of the page within space ulint offset, /* in: offset of the page within space
in units of a page */ in units of a page */
ulint zip_size,/* in: compressed page size in bytes,
or 0 if uncompressed tablespace */
buf_block_t* block) /* in: block to init */ buf_block_t* block) /* in: block to init */
{ {
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex))); ut_ad(mutex_own(&(buf_pool->mutex)));
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
ut_a(block->state != BUF_BLOCK_FILE_PAGE); ut_a(block->state != BUF_BLOCK_FILE_PAGE);
ut_a(space || !zip_size);
/* Set the state of the block */ /* Set the state of the block */
block->magic_n = BUF_BLOCK_MAGIC_N; block->magic_n = BUF_BLOCK_MAGIC_N;
...@@ -1627,11 +1634,19 @@ buf_page_init( ...@@ -1627,11 +1634,19 @@ buf_page_init(
block->lock_hash_val = lock_rec_hash(space, offset); block->lock_hash_val = lock_rec_hash(space, offset);
block->lock_mutex = NULL; block->lock_mutex = NULL;
block->page_zip.size = zip_size;
if (UNIV_UNLIKELY(zip_size)) {
/* TODO: allocate this from a separate pool */
block->page_zip.data = ut_malloc(zip_size);
} else {
block->page_zip.data = NULL;
}
/* Insert into the hash table of file pages */ /* Insert into the hash table of file pages */
if (buf_page_hash_get(space, offset)) { if (UNIV_LIKELY_NULL(buf_page_hash_get(space, offset))) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: page %lu %lu already found from the hash table\n", "InnoDB: Error: page %lu %lu already found in the hash table\n",
(ulong) space, (ulong) space,
(ulong) offset); (ulong) offset);
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
...@@ -1640,7 +1655,7 @@ buf_page_init( ...@@ -1640,7 +1655,7 @@ buf_page_init(
buf_validate(); buf_validate();
buf_LRU_validate(); buf_LRU_validate();
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
ut_a(0); ut_error;
} }
HASH_INSERT(buf_block_t, hash, buf_pool->page_hash, HASH_INSERT(buf_block_t, hash, buf_pool->page_hash,
...@@ -1683,6 +1698,7 @@ buf_page_init_for_read( ...@@ -1683,6 +1698,7 @@ buf_page_init_for_read(
ulint* err, /* out: DB_SUCCESS or DB_TABLESPACE_DELETED */ ulint* err, /* out: DB_SUCCESS or DB_TABLESPACE_DELETED */
ulint mode, /* in: BUF_READ_IBUF_PAGES_ONLY, ... */ ulint mode, /* in: BUF_READ_IBUF_PAGES_ONLY, ... */
ulint space, /* in: space id */ ulint space, /* in: space id */
ulint zip_size,/* in: compressed page size, or 0 */
ib_longlong tablespace_version,/* in: prevents reading from a wrong ib_longlong tablespace_version,/* in: prevents reading from a wrong
version of the tablespace in case we have done version of the tablespace in case we have done
DISCARD + IMPORT */ DISCARD + IMPORT */
...@@ -1743,7 +1759,7 @@ buf_page_init_for_read( ...@@ -1743,7 +1759,7 @@ buf_page_init_for_read(
ut_ad(block); ut_ad(block);
buf_page_init(space, offset, block); buf_page_init(space, offset, zip_size, block);
/* The block must be put to the LRU list, to the old blocks */ /* The block must be put to the LRU list, to the old blocks */
...@@ -1784,6 +1800,7 @@ buf_page_create( ...@@ -1784,6 +1800,7 @@ buf_page_create(
ulint space, /* in: space id */ ulint space, /* in: space id */
ulint offset, /* in: offset of the page within space in units of ulint offset, /* in: offset of the page within space in units of
a page */ a page */
ulint zip_size,/* in: compressed page size, or 0 */
mtr_t* mtr) /* in: mini-transaction handle */ mtr_t* mtr) /* in: mini-transaction handle */
{ {
buf_frame_t* frame; buf_frame_t* frame;
...@@ -1791,6 +1808,7 @@ buf_page_create( ...@@ -1791,6 +1808,7 @@ buf_page_create(
buf_block_t* free_block = NULL; buf_block_t* free_block = NULL;
ut_ad(mtr); ut_ad(mtr);
ut_ad(space || !zip_size);
free_block = buf_LRU_get_free_block(); free_block = buf_LRU_get_free_block();
...@@ -1825,7 +1843,7 @@ buf_page_create( ...@@ -1825,7 +1843,7 @@ buf_page_create(
block = free_block; block = free_block;
buf_page_init(space, offset, block); buf_page_init(space, offset, zip_size, block);
/* The block must be put to the LRU list */ /* The block must be put to the LRU list */
buf_LRU_add_block(block, FALSE); buf_LRU_add_block(block, FALSE);
...@@ -1914,7 +1932,8 @@ buf_page_io_complete( ...@@ -1914,7 +1932,8 @@ buf_page_io_complete(
/* From version 3.23.38 up we store the page checksum /* From version 3.23.38 up we store the page checksum
to the 4 first bytes of the page end lsn field */ to the 4 first bytes of the page end lsn field */
if (buf_page_is_corrupted(block->frame, 0/*TODO:zip_size*/)) { if (buf_page_is_corrupted(block->frame/* TODO */,
block->page_zip.size)) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Database page corruption on disk or a failed\n" "InnoDB: Database page corruption on disk or a failed\n"
"InnoDB: file read of page %lu.\n", (ulong) block->offset); "InnoDB: file read of page %lu.\n", (ulong) block->offset);
......
...@@ -65,6 +65,7 @@ buf_read_page_low( ...@@ -65,6 +65,7 @@ buf_read_page_low(
ORed to OS_AIO_SIMULATED_WAKE_LATER (see below ORed to OS_AIO_SIMULATED_WAKE_LATER (see below
at read-ahead functions) */ at read-ahead functions) */
ulint space, /* in: space id */ ulint space, /* in: space id */
ulint zip_size,/* in: compressed page size, or 0 */
ib_longlong tablespace_version, /* in: if the space memory object has ib_longlong tablespace_version, /* in: if the space memory object has
this timestamp different from what we are giving here, this timestamp different from what we are giving here,
treat the tablespace as dropped; this is a timestamp we treat the tablespace as dropped; this is a timestamp we
...@@ -122,8 +123,8 @@ buf_read_page_low( ...@@ -122,8 +123,8 @@ buf_read_page_low(
or is being dropped; if we succeed in initing the page in the buffer or is being dropped; if we succeed in initing the page in the buffer
pool for read, then DISCARD cannot proceed until the read has pool for read, then DISCARD cannot proceed until the read has
completed */ completed */
block = buf_page_init_for_read(err, mode, space, tablespace_version, block = buf_page_init_for_read(err, mode, space, zip_size,
offset); tablespace_version, offset);
if (block == NULL) { if (block == NULL) {
return(0); return(0);
...@@ -177,6 +178,7 @@ buf_read_ahead_random( ...@@ -177,6 +178,7 @@ buf_read_ahead_random(
wants to access */ wants to access */
{ {
ib_longlong tablespace_version; ib_longlong tablespace_version;
ulint zip_size;
buf_block_t* block; buf_block_t* block;
ulint recent_blocks = 0; ulint recent_blocks = 0;
ulint count; ulint count;
...@@ -200,6 +202,8 @@ buf_read_ahead_random( ...@@ -200,6 +202,8 @@ buf_read_ahead_random(
return(0); return(0);
} }
zip_size = fil_space_get_zip_size(space);
/* Remember the tablespace version before we ask te tablespace size /* Remember the tablespace version before we ask te tablespace size
below: if DISCARD + IMPORT changes the actual .ibd file meanwhile, we below: if DISCARD + IMPORT changes the actual .ibd file meanwhile, we
do not try to read outside the bounds of the tablespace! */ do not try to read outside the bounds of the tablespace! */
...@@ -269,7 +273,8 @@ buf_read_ahead_random( ...@@ -269,7 +273,8 @@ buf_read_ahead_random(
if (!ibuf_bitmap_page(i)) { if (!ibuf_bitmap_page(i)) {
count += buf_read_page_low(&err, FALSE, ibuf_mode count += buf_read_page_low(&err, FALSE, ibuf_mode
| OS_AIO_SIMULATED_WAKE_LATER, | OS_AIO_SIMULATED_WAKE_LATER,
space, tablespace_version, i); space, zip_size,
tablespace_version, i);
if (err == DB_TABLESPACE_DELETED) { if (err == DB_TABLESPACE_DELETED) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
...@@ -316,10 +321,12 @@ buf_read_page( ...@@ -316,10 +321,12 @@ buf_read_page(
ulint offset) /* in: page number */ ulint offset) /* in: page number */
{ {
ib_longlong tablespace_version; ib_longlong tablespace_version;
ulint zip_size;
ulint count; ulint count;
ulint count2; ulint count2;
ulint err; ulint err;
zip_size = fil_space_get_zip_size(space);
tablespace_version = fil_space_get_version(space); tablespace_version = fil_space_get_version(space);
count = buf_read_ahead_random(space, offset); count = buf_read_ahead_random(space, offset);
...@@ -328,7 +335,7 @@ buf_read_page( ...@@ -328,7 +335,7 @@ buf_read_page(
switches: hence TRUE */ switches: hence TRUE */
count2 = buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE, space, count2 = buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE, space,
tablespace_version, offset); zip_size, tablespace_version, offset);
srv_buf_pool_reads+= count2; srv_buf_pool_reads+= count2;
if (err == DB_TABLESPACE_DELETED) { if (err == DB_TABLESPACE_DELETED) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
...@@ -377,6 +384,7 @@ buf_read_ahead_linear( ...@@ -377,6 +384,7 @@ buf_read_ahead_linear(
must want access to this page (see NOTE 3 above) */ must want access to this page (see NOTE 3 above) */
{ {
ib_longlong tablespace_version; ib_longlong tablespace_version;
ulint zip_size;
buf_block_t* block; buf_block_t* block;
buf_frame_t* frame; buf_frame_t* frame;
buf_block_t* pred_block = NULL; buf_block_t* pred_block = NULL;
...@@ -416,6 +424,8 @@ buf_read_ahead_linear( ...@@ -416,6 +424,8 @@ buf_read_ahead_linear(
return(0); return(0);
} }
zip_size = fil_space_get_zip_size(space);
/* Remember the tablespace version before we ask te tablespace size /* Remember the tablespace version before we ask te tablespace size
below: if DISCARD + IMPORT changes the actual .ibd file meanwhile, we below: if DISCARD + IMPORT changes the actual .ibd file meanwhile, we
do not try to read outside the bounds of the tablespace! */ do not try to read outside the bounds of the tablespace! */
...@@ -556,7 +566,8 @@ buf_read_ahead_linear( ...@@ -556,7 +566,8 @@ buf_read_ahead_linear(
if (!ibuf_bitmap_page(i)) { if (!ibuf_bitmap_page(i)) {
count += buf_read_page_low(&err, FALSE, ibuf_mode count += buf_read_page_low(&err, FALSE, ibuf_mode
| OS_AIO_SIMULATED_WAKE_LATER, | OS_AIO_SIMULATED_WAKE_LATER,
space, tablespace_version, i); space, zip_size,
tablespace_version, i);
if (err == DB_TABLESPACE_DELETED) { if (err == DB_TABLESPACE_DELETED) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
...@@ -623,13 +634,9 @@ buf_read_ibuf_merge_pages( ...@@ -623,13 +634,9 @@ buf_read_ibuf_merge_pages(
} }
for (i = 0; i < n_stored; i++) { for (i = 0; i < n_stored; i++) {
if ((i + 1 == n_stored) && sync) { buf_read_page_low(&err, sync && (i + 1 == n_stored),
buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE, BUF_READ_ANY_PAGE, space_ids[i], 0,
space_ids[i], space_versions[i], page_nos[i]); space_versions[i], page_nos[i]);
} else {
buf_read_page_low(&err, FALSE, BUF_READ_ANY_PAGE,
space_ids[i], space_versions[i], page_nos[i]);
}
if (err == DB_TABLESPACE_DELETED) { if (err == DB_TABLESPACE_DELETED) {
/* We have deleted or are deleting the single-table /* We have deleted or are deleting the single-table
...@@ -669,10 +676,12 @@ buf_read_recv_pages( ...@@ -669,10 +676,12 @@ buf_read_recv_pages(
ulint n_stored) /* in: number of page numbers in the array */ ulint n_stored) /* in: number of page numbers in the array */
{ {
ib_longlong tablespace_version; ib_longlong tablespace_version;
ulint zip_size;
ulint count; ulint count;
ulint err; ulint err;
ulint i; ulint i;
zip_size = fil_space_get_zip_size(space);
tablespace_version = fil_space_get_version(space); tablespace_version = fil_space_get_version(space);
for (i = 0; i < n_stored; i++) { for (i = 0; i < n_stored; i++) {
...@@ -704,11 +713,11 @@ buf_read_recv_pages( ...@@ -704,11 +713,11 @@ buf_read_recv_pages(
if ((i + 1 == n_stored) && sync) { if ((i + 1 == n_stored) && sync) {
buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE, space, buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE, space,
tablespace_version, page_nos[i]); zip_size, tablespace_version, page_nos[i]);
} else { } else {
buf_read_page_low(&err, FALSE, BUF_READ_ANY_PAGE buf_read_page_low(&err, FALSE, BUF_READ_ANY_PAGE
| OS_AIO_SIMULATED_WAKE_LATER, | OS_AIO_SIMULATED_WAKE_LATER, space,
space, tablespace_version, page_nos[i]); zip_size, tablespace_version, page_nos[i]);
} }
} }
......
...@@ -890,7 +890,7 @@ fsp_header_init( ...@@ -890,7 +890,7 @@ fsp_header_init(
mtr_x_lock(fil_space_get_latch(space), mtr); mtr_x_lock(fil_space_get_latch(space), mtr);
page = buf_page_create(space, 0, mtr); page = buf_page_create(space, 0, 0/* TODO: zip_size!=16k? */, mtr);
buf_page_get(space, 0, RW_X_LATCH, mtr); buf_page_get(space, 0, RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(page, SYNC_FSP_PAGE); buf_page_dbg_add_level(page, SYNC_FSP_PAGE);
...@@ -1272,7 +1272,8 @@ fsp_fill_free_list( ...@@ -1272,7 +1272,8 @@ fsp_fill_free_list(
pages should be ignored. */ pages should be ignored. */
if (i > 0) { if (i > 0) {
descr_page = buf_page_create(space, i, mtr); /* TODO: zip_size != 16384 */
descr_page = buf_page_create(space, i, 0, mtr);
buf_page_get(space, i, RW_X_LATCH, mtr); buf_page_get(space, i, RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(descr_page, buf_page_dbg_add_level(descr_page,
...@@ -1290,8 +1291,10 @@ fsp_fill_free_list( ...@@ -1290,8 +1291,10 @@ fsp_fill_free_list(
mtr_start(&ibuf_mtr); mtr_start(&ibuf_mtr);
/* TODO: no ibuf on compressed tablespaces */
ibuf_page = buf_page_create(space, ibuf_page = buf_page_create(space,
i + FSP_IBUF_BITMAP_OFFSET, &ibuf_mtr); i + FSP_IBUF_BITMAP_OFFSET,
0, &ibuf_mtr);
buf_page_get(space, i + FSP_IBUF_BITMAP_OFFSET, buf_page_get(space, i + FSP_IBUF_BITMAP_OFFSET,
RW_X_LATCH, &ibuf_mtr); RW_X_LATCH, &ibuf_mtr);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
...@@ -1511,7 +1514,8 @@ fsp_alloc_free_page( ...@@ -1511,7 +1514,8 @@ fsp_alloc_free_page(
be obtained immediately with buf_page_get without need for a disk be obtained immediately with buf_page_get without need for a disk
read. */ read. */
buf_page_create(space, page_no, mtr); buf_page_create(space, page_no,
mach_read_from_4(FSP_PAGE_ZIP_SIZE + header), mtr);
page = buf_page_get(space, page_no, RW_X_LATCH, mtr); page = buf_page_get(space, page_no, RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
...@@ -2544,9 +2548,14 @@ fseg_alloc_free_page_low( ...@@ -2544,9 +2548,14 @@ fseg_alloc_free_page_low(
can be obtained immediately with buf_page_get without need can be obtained immediately with buf_page_get without need
for a disk read */ for a disk read */
page = buf_page_create(space, ret_page, mtr); page = buf_page_create(space, ret_page,
mach_read_from_4(FSP_PAGE_ZIP_SIZE
+ space_header), mtr);
ut_a(page == buf_page_get(space, ret_page, RW_X_LATCH, mtr)); if (UNIV_UNLIKELY(page != buf_page_get(
space, ret_page, RW_X_LATCH, mtr))) {
ut_error;
}
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(page, SYNC_FSP_PAGE); buf_page_dbg_add_level(page, SYNC_FSP_PAGE);
......
...@@ -238,6 +238,7 @@ buf_page_create( ...@@ -238,6 +238,7 @@ buf_page_create(
ulint space, /* in: space id */ ulint space, /* in: space id */
ulint offset, /* in: offset of the page within space in units of ulint offset, /* in: offset of the page within space in units of
a page */ a page */
ulint zip_size,/* in: compressed page size, or 0 */
mtr_t* mtr); /* in: mini-transaction handle */ mtr_t* mtr); /* in: mini-transaction handle */
/************************************************************************ /************************************************************************
Inits a page to the buffer buf_pool, for use in ibbackup --restore. */ Inits a page to the buffer buf_pool, for use in ibbackup --restore. */
...@@ -679,6 +680,7 @@ buf_page_init_for_read( ...@@ -679,6 +680,7 @@ buf_page_init_for_read(
ulint* err, /* out: DB_SUCCESS or DB_TABLESPACE_DELETED */ ulint* err, /* out: DB_SUCCESS or DB_TABLESPACE_DELETED */
ulint mode, /* in: BUF_READ_IBUF_PAGES_ONLY, ... */ ulint mode, /* in: BUF_READ_IBUF_PAGES_ONLY, ... */
ulint space, /* in: space id */ ulint space, /* in: space id */
ulint zip_size,/* in: compressed page size, or 0 */
ib_longlong tablespace_version,/* in: prevents reading from a wrong ib_longlong tablespace_version,/* in: prevents reading from a wrong
version of the tablespace in case we have done version of the tablespace in case we have done
DISCARD + IMPORT */ DISCARD + IMPORT */
......
...@@ -214,6 +214,7 @@ void ...@@ -214,6 +214,7 @@ void
recv_recovery_from_archive_finish(void); recv_recovery_from_archive_finish(void);
/*===================================*/ /*===================================*/
#endif /* UNIV_LOG_ARCHIVE */ #endif /* UNIV_LOG_ARCHIVE */
#ifdef UNIV_LOG_REPLICATE
/*********************************************************************** /***********************************************************************
Checks that a replica of a space is identical to the original space. */ Checks that a replica of a space is identical to the original space. */
...@@ -235,6 +236,7 @@ recv_compare_spaces_low( ...@@ -235,6 +236,7 @@ recv_compare_spaces_low(
ulint space1, /* in: space id */ ulint space1, /* in: space id */
ulint space2, /* in: space id */ ulint space2, /* in: space id */
ulint n_pages);/* in: number of pages */ ulint n_pages);/* in: number of pages */
#endif /* UNIV_LOG_REPLICATE */
/* Block of log record data */ /* Block of log record data */
typedef struct recv_data_struct recv_data_t; typedef struct recv_data_struct recv_data_t;
......
...@@ -272,10 +272,9 @@ Write a log record of writing to the uncompressed header portion of a page. */ ...@@ -272,10 +272,9 @@ Write a log record of writing to the uncompressed header portion of a page. */
void void
page_zip_write_header_log( page_zip_write_header_log(
/*======================*/ /*======================*/
const page_zip_des_t* page_zip,/* in: compressed page */ const byte* data,/* in: data on the uncompressed page */
ulint offset, /* in: offset to the data */ ulint length, /* in: length of the data */
ulint length, /* in: length of the data */ mtr_t* mtr); /* in: mini-transaction */
mtr_t* mtr); /* in: mini-transaction */
/************************************************************************** /**************************************************************************
Write data to the uncompressed header portion of a page. The data must Write data to the uncompressed header portion of a page. The data must
...@@ -307,7 +306,7 @@ page_zip_write_header( ...@@ -307,7 +306,7 @@ page_zip_write_header(
/* ut_ad(page_zip_validate(page_zip, str - pos)); */ /* ut_ad(page_zip_validate(page_zip, str - pos)); */
if (UNIV_LIKELY_NULL(mtr)) { if (UNIV_LIKELY_NULL(mtr)) {
page_zip_write_header_log(page_zip, pos, length, mtr); page_zip_write_header_log(str, length, mtr);
} }
} }
......
...@@ -1490,9 +1490,11 @@ recv_apply_hashed_log_recs( ...@@ -1490,9 +1490,11 @@ recv_apply_hashed_log_recs(
mutex_exit(&(recv_sys->mutex)); mutex_exit(&(recv_sys->mutex));
} }
#ifdef UNIV_HOTBACKUP
/* This page is allocated from the buffer pool and used in the function /* This page is allocated from the buffer pool and used in the function
below */ below */
static page_t* recv_backup_application_page = NULL; static page_t* recv_backup_application_page = NULL;
TODO: define recv_backup_application_page_zip;
/*********************************************************************** /***********************************************************************
Applies log records in the hash table to a backup. */ Applies log records in the hash table to a backup. */
...@@ -1618,8 +1620,9 @@ recv_addr->space, recv_addr->page_no); ...@@ -1618,8 +1620,9 @@ recv_addr->space, recv_addr->page_no);
recv_sys_empty_hash(); recv_sys_empty_hash();
} }
#endif /* UNIV_HOTBACKUP */
#ifdef notdefined #ifdef UNIV_LOG_REPLICATE
/*********************************************************************** /***********************************************************************
In the debug version, updates the replica of a file page, based on a log In the debug version, updates the replica of a file page, based on a log
record. */ record. */
......
...@@ -1123,7 +1123,8 @@ byte* ...@@ -1123,7 +1123,8 @@ byte*
page_copy_rec_list_to_created_page_write_log( page_copy_rec_list_to_created_page_write_log(
/*=========================================*/ /*=========================================*/
/* out: 4-byte field where to /* out: 4-byte field where to
write the log data length */ write the log data length,
or NULL if logging is disabled */
page_t* page, /* in: index page */ page_t* page, /* in: index page */
dict_index_t* index, /* in: record descriptor */ dict_index_t* index, /* in: record descriptor */
mtr_t* mtr) /* in: mtr */ mtr_t* mtr) /* in: mtr */
...@@ -1136,8 +1137,9 @@ page_copy_rec_list_to_created_page_write_log( ...@@ -1136,8 +1137,9 @@ page_copy_rec_list_to_created_page_write_log(
page_is_comp(page) page_is_comp(page)
? MLOG_COMP_LIST_END_COPY_CREATED ? MLOG_COMP_LIST_END_COPY_CREATED
: MLOG_LIST_END_COPY_CREATED, 4); : MLOG_LIST_END_COPY_CREATED, 4);
ut_a(log_ptr); if (UNIV_LIKELY(log_ptr != NULL)) {
mlog_close(mtr, log_ptr + 4); mlog_close(mtr, log_ptr + 4);
}
return(log_ptr); return(log_ptr);
} }
...@@ -1335,7 +1337,9 @@ page_copy_rec_list_end_to_created_page( ...@@ -1335,7 +1337,9 @@ page_copy_rec_list_end_to_created_page(
ut_a(log_data_len < 100 * UNIV_PAGE_SIZE); ut_a(log_data_len < 100 * UNIV_PAGE_SIZE);
mach_write_to_4(log_ptr, log_data_len); if (UNIV_LIKELY(log_ptr != NULL)) {
mach_write_to_4(log_ptr, log_data_len);
}
if (page_is_comp(new_page)) { if (page_is_comp(new_page)) {
rec_set_next_offs_new(insert_rec, PAGE_NEW_SUPREMUM); rec_set_next_offs_new(insert_rec, PAGE_NEW_SUPREMUM);
......
...@@ -2045,7 +2045,7 @@ page_zip_write_rec( ...@@ -2045,7 +2045,7 @@ page_zip_write_rec(
externs - ext_end); externs - ext_end);
} }
ut_a(blob_no + n_ext < page_zip->n_blobs); ut_a(blob_no + n_ext <= page_zip->n_blobs);
} }
/* Store separately trx_id, roll_ptr and /* Store separately trx_id, roll_ptr and
...@@ -2829,12 +2829,13 @@ Write a log record of writing to the uncompressed header portion of a page. */ ...@@ -2829,12 +2829,13 @@ Write a log record of writing to the uncompressed header portion of a page. */
void void
page_zip_write_header_log( page_zip_write_header_log(
/*======================*/ /*======================*/
const page_zip_des_t* page_zip,/* in: compressed page */ const byte* data, /* in: data on the uncompressed page */
ulint offset, /* in: offset to the data */ ulint length, /* in: length of the data */
ulint length, /* in: length of the data */ mtr_t* mtr) /* in: mini-transaction */
mtr_t* mtr) /* in: mini-transaction */
{ {
byte* log_ptr = mlog_open(mtr, 11 + 1 + 1); byte* log_ptr = mlog_open(mtr, 11 + 1 + 1);
ulint offset = ut_align_offset(data, UNIV_PAGE_SIZE);
ut_ad(offset < PAGE_DATA); ut_ad(offset < PAGE_DATA);
ut_ad(offset + length < PAGE_DATA); ut_ad(offset + length < PAGE_DATA);
#if PAGE_DATA > 255 #if PAGE_DATA > 255
...@@ -2848,13 +2849,13 @@ page_zip_write_header_log( ...@@ -2848,13 +2849,13 @@ page_zip_write_header_log(
return; return;
} }
log_ptr = mlog_write_initial_log_record_fast(page_zip->data + offset, log_ptr = mlog_write_initial_log_record_fast((byte*) data,
MLOG_ZIP_WRITE_HEADER, log_ptr, mtr); MLOG_ZIP_WRITE_HEADER, log_ptr, mtr);
*log_ptr++ = (byte) offset; *log_ptr++ = (byte) offset;
*log_ptr++ = (byte) length; *log_ptr++ = (byte) length;
mlog_close(mtr, log_ptr); mlog_close(mtr, log_ptr);
mlog_catenate_string(mtr, page_zip->data + offset, length); mlog_catenate_string(mtr, data, length);
} }
/************************************************************************** /**************************************************************************
......
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