summaryrefslogtreecommitdiff
path: root/storage/innobase/page
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase/page')
-rw-r--r--storage/innobase/page/page0cur.cc173
-rw-r--r--storage/innobase/page/page0page.cc252
-rw-r--r--storage/innobase/page/page0zip.cc69
3 files changed, 204 insertions, 290 deletions
diff --git a/storage/innobase/page/page0cur.cc b/storage/innobase/page/page0cur.cc
index f777e7b8378..2c69b87cea4 100644
--- a/storage/innobase/page/page0cur.cc
+++ b/storage/innobase/page/page0cur.cc
@@ -1243,6 +1243,139 @@ page_direction_increment(
1U + page_header_get_field(page, PAGE_N_DIRECTION));
}
+/** Split a directory slot which owns too many records.
+@param[in,out] page index page
+@param[in,out] page_zip ROW_FORMAT=COMPRESSED page, or NULL
+@param[in] s the slot that needs to be split */
+static void page_dir_split_slot(page_t* page, page_zip_des_t* page_zip,
+ ulint s)
+{
+ ut_ad(!page_zip || page_is_comp(page));
+ ut_ad(s);
+
+ page_dir_slot_t* slot = page_dir_get_nth_slot(page, s);
+ const ulint n_owned = PAGE_DIR_SLOT_MAX_N_OWNED + 1;
+
+ ut_ad(page_dir_slot_get_n_owned(slot) == n_owned);
+ compile_time_assert((PAGE_DIR_SLOT_MAX_N_OWNED + 1) / 2
+ >= PAGE_DIR_SLOT_MIN_N_OWNED);
+
+ /* 1. We loop to find a record approximately in the middle of the
+ records owned by the slot. */
+
+ const rec_t* rec = page_dir_slot_get_rec(slot + PAGE_DIR_SLOT_SIZE);
+
+ for (ulint i = n_owned / 2; i--; ) {
+ rec = page_rec_get_next_const(rec);
+ }
+
+ /* 2. Add a directory slot immediately below this one. */
+ const ulint n_slots = page_dir_get_n_slots(page);
+ page_dir_set_n_slots(page, page_zip, n_slots + 1);
+ page_dir_slot_t* last_slot = page_dir_get_nth_slot(page, n_slots);
+ memmove(last_slot, last_slot + PAGE_DIR_SLOT_SIZE, slot - last_slot);
+
+ /* 3. We store the appropriate values to the new slot. */
+
+ page_dir_slot_set_rec(slot, rec);
+ page_dir_slot_set_n_owned(slot, page_zip, n_owned / 2);
+
+ /* 4. Finally, we update the number of records field of the
+ original slot */
+
+ page_dir_slot_set_n_owned(slot - PAGE_DIR_SLOT_SIZE,
+ page_zip, n_owned - (n_owned / 2));
+}
+
+/** Try to balance an underfilled directory slot with an adjacent one,
+so that there are at least the minimum number of records owned by the slot;
+this may result in merging the two slots.
+@param[in,out] page index page
+@param[in,out] page_zip ROW_FORMAT=COMPRESSED page, or NULL
+@param[in] s the slot to be balanced */
+static void page_dir_balance_slot(page_t* page, page_zip_des_t* page_zip,
+ ulint s)
+{
+ ut_ad(!page_zip || page_is_comp(page));
+ ut_ad(s > 0);
+
+ const ulint n_slots = page_dir_get_n_slots(page);
+
+ if (UNIV_UNLIKELY(s + 1 == n_slots)) {
+ /* The last directory slot cannot be balanced. */
+ return;
+ }
+
+ ut_ad(s < n_slots);
+
+ page_dir_slot_t* slot = page_dir_get_nth_slot(page, s);
+ page_dir_slot_t* up_slot = slot - PAGE_DIR_SLOT_SIZE;
+ const ulint up_n_owned = page_dir_slot_get_n_owned(up_slot);
+
+ ut_ad(page_dir_slot_get_n_owned(slot)
+ == PAGE_DIR_SLOT_MIN_N_OWNED - 1);
+
+ if (up_n_owned <= PAGE_DIR_SLOT_MIN_N_OWNED) {
+ compile_time_assert(2 * PAGE_DIR_SLOT_MIN_N_OWNED - 1
+ <= PAGE_DIR_SLOT_MAX_N_OWNED);
+ /* Merge the slots. */
+ ulint n_owned = page_dir_slot_get_n_owned(slot);
+ page_dir_slot_set_n_owned(slot, page_zip, 0);
+ page_dir_slot_set_n_owned(up_slot, page_zip,
+ n_owned
+ + page_dir_slot_get_n_owned(up_slot));
+ /* Shift the slots */
+ page_dir_slot_t* last_slot = page_dir_get_nth_slot(
+ page, n_slots - 1);
+ memmove(last_slot + PAGE_DIR_SLOT_SIZE, last_slot,
+ slot - last_slot);
+ mach_write_to_2(last_slot, 0);
+ page_dir_set_n_slots(page, page_zip, n_slots - 1);
+ return;
+ }
+
+ /* Transfer one record to the underfilled slot */
+ rec_t* old_rec = const_cast<rec_t*>(page_dir_slot_get_rec(slot));
+ rec_t* new_rec;
+
+ if (page_is_comp(page)) {
+ new_rec = rec_get_next_ptr(old_rec, TRUE);
+
+ rec_set_n_owned_new(old_rec, page_zip, 0);
+ rec_set_n_owned_new(new_rec, page_zip,
+ PAGE_DIR_SLOT_MIN_N_OWNED);
+ } else {
+ new_rec = rec_get_next_ptr(old_rec, FALSE);
+
+ rec_set_n_owned_old(old_rec, 0);
+ rec_set_n_owned_old(new_rec, PAGE_DIR_SLOT_MIN_N_OWNED);
+ }
+
+ page_dir_slot_set_rec(slot, new_rec);
+ page_dir_slot_set_n_owned(up_slot, page_zip, up_n_owned - 1);
+}
+
+/** Allocate space for inserting an index record.
+@param[in,out] page index page
+@param[in,out] page_zip ROW_FORMAT=COMPRESSED page, or NULL
+@param[in] need number of bytes needed
+@param[out] heap_no record heap number
+@return pointer to the start of the allocated buffer
+@retval NULL if allocation fails */
+static byte* page_mem_alloc_heap(page_t* page, page_zip_des_t* page_zip,
+ ulint need, ulint* heap_no)
+{
+ if (need > page_get_max_insert_size(page, 1)) {
+ return NULL;
+ }
+
+ byte* top = page_header_get_ptr(page, PAGE_HEAP_TOP);
+ page_header_set_ptr(page, page_zip, PAGE_HEAP_TOP, top + need);
+ *heap_no = page_dir_get_n_heap(page);
+ page_dir_set_n_heap(page, page_zip, 1 + *heap_no);
+ return top;
+}
+
/***********************************************************//**
Inserts a record next to page cursor on an uncompressed page.
Returns pointer to inserted record if succeed, i.e., enough
@@ -1636,8 +1769,8 @@ page_cur_insert_rec_zip(
if (!log_compressed) {
if (page_zip_compress(
- page_zip, page, index,
- level, NULL)) {
+ page_cur_get_block(cursor),
+ index, level, NULL)) {
page_cur_insert_rec_write_log(
insert_rec, rec_size,
cursor->rec, index, mtr);
@@ -2280,6 +2413,36 @@ page_cur_parse_delete_rec(
return(ptr);
}
+/** Prepend a record to the PAGE_FREE list.
+@param[in,out] page index page
+@param[in,out] page_zip ROW_FORMAT=COMPRESSED page, or NULL
+@param[in,out] rec record being deleted
+@param[in] index the index that the page belongs to
+@param[in] offsets rec_get_offsets(rec, index) */
+static void page_mem_free(page_t* page, page_zip_des_t* page_zip, rec_t* rec,
+ const dict_index_t* index, const ulint* offsets)
+{
+ ut_ad(rec_offs_validate(rec, index, offsets));
+ const rec_t* free = page_header_get_ptr(page, PAGE_FREE);
+
+ if (srv_immediate_scrub_data_uncompressed) {
+ /* scrub record */
+ memset(rec, 0, rec_offs_data_size(offsets));
+ }
+
+ page_rec_set_next(rec, free);
+ page_header_set_ptr(page, page_zip, PAGE_FREE, rec);
+ page_header_set_field(page, page_zip, PAGE_GARBAGE,
+ rec_offs_size(offsets)
+ + page_header_get_field(page, PAGE_GARBAGE));
+ if (page_zip) {
+ page_zip_dir_delete(page_zip, rec, index, offsets, free);
+ } else {
+ page_header_set_field(page, page_zip, PAGE_N_RECS,
+ ulint(page_get_n_recs(page)) - 1);
+ }
+}
+
/***********************************************************//**
Deletes a record at the page cursor. The cursor is moved to the next
record after the deleted one. */
@@ -2352,11 +2515,6 @@ page_cur_delete_rec(
cur_dir_slot = page_dir_get_nth_slot(page, cur_slot_no);
cur_n_owned = page_dir_slot_get_n_owned(cur_dir_slot);
- /* 0. Write the log record */
- if (mtr != 0) {
- page_cur_delete_rec_write_log(current_rec, index, mtr);
- }
-
/* 1. Reset the last insert info in the page header and increment
the modify clock for the frame */
@@ -2369,6 +2527,7 @@ page_cur_delete_rec(
if (mtr != 0) {
buf_block_modify_clock_inc(page_cur_get_block(cursor));
+ page_cur_delete_rec_write_log(current_rec, index, mtr);
}
/* 2. Find the next and the previous record. Note that the cursor is
diff --git a/storage/innobase/page/page0page.cc b/storage/innobase/page/page0page.cc
index 36dfabb7c49..3b12ebe2224 100644
--- a/storage/innobase/page/page0page.cc
+++ b/storage/innobase/page/page0page.cc
@@ -250,43 +250,6 @@ page_set_autoinc(
}
}
-/************************************************************//**
-Allocates a block of memory from the heap of an index page.
-@return pointer to start of allocated buffer, or NULL if allocation fails */
-byte*
-page_mem_alloc_heap(
-/*================*/
- page_t* page, /*!< in/out: index page */
- page_zip_des_t* page_zip,/*!< in/out: compressed page with enough
- space available for inserting the record,
- or NULL */
- ulint need, /*!< in: total number of bytes needed */
- ulint* heap_no)/*!< out: this contains the heap number
- of the allocated record
- if allocation succeeds */
-{
- byte* block;
- ulint avl_space;
-
- ut_ad(page && heap_no);
-
- avl_space = page_get_max_insert_size(page, 1);
-
- if (avl_space >= need) {
- block = page_header_get_ptr(page, PAGE_HEAP_TOP);
-
- page_header_set_ptr(page, page_zip, PAGE_HEAP_TOP,
- block + need);
- *heap_no = page_dir_get_n_heap(page);
-
- page_dir_set_n_heap(page, page_zip, 1 + *heap_no);
-
- return(block);
- }
-
- return(NULL);
-}
-
/**********************************************************//**
Writes a log record of page creation. */
UNIV_INLINE
@@ -456,10 +419,9 @@ page_create_zip(
handle */
{
page_t* page;
- page_zip_des_t* page_zip = buf_block_get_page_zip(block);
ut_ad(block);
- ut_ad(page_zip);
+ ut_ad(buf_block_get_page_zip(block));
ut_ad(dict_table_is_comp(index->table));
/* PAGE_MAX_TRX_ID or PAGE_ROOT_AUTO_INC are always 0 for
@@ -482,7 +444,7 @@ page_create_zip(
mach_write_to_2(PAGE_HEADER + PAGE_LEVEL + page, level);
mach_write_to_8(PAGE_HEADER + PAGE_MAX_TRX_ID + page, max_trx_id);
- if (!page_zip_compress(page_zip, page, index, page_zip_level, mtr)) {
+ if (!page_zip_compress(block, index, page_zip_level, mtr)) {
/* The compression of a newly created
page should always succeed. */
ut_error;
@@ -703,7 +665,7 @@ page_copy_rec_list_end(
if (new_page_zip) {
mtr_set_log_mode(mtr, log_mode);
- if (!page_zip_compress(new_page_zip, new_page, index,
+ if (!page_zip_compress(new_block, index,
page_zip_level, mtr)) {
/* Before trying to reorganize the page,
store the number of preceding records on the page. */
@@ -868,7 +830,7 @@ page_copy_rec_list_start(
DBUG_EXECUTE_IF("page_copy_rec_list_start_compress_fail",
goto zip_reorganize;);
- if (!page_zip_compress(new_page_zip, new_page, index,
+ if (!page_zip_compress(new_block, index,
page_zip_level, mtr)) {
ulint ret_pos;
#ifndef DBUG_OFF
@@ -1389,212 +1351,6 @@ page_move_rec_list_start(
return(TRUE);
}
-/**************************************************************//**
-Used to delete n slots from the directory. This function updates
-also n_owned fields in the records, so that the first slot after
-the deleted ones inherits the records of the deleted slots. */
-UNIV_INLINE
-void
-page_dir_delete_slot(
-/*=================*/
- page_t* page, /*!< in/out: the index page */
- page_zip_des_t* page_zip,/*!< in/out: compressed page, or NULL */
- ulint slot_no)/*!< in: slot to be deleted */
-{
- page_dir_slot_t* slot;
- ulint n_owned;
- ulint i;
- ulint n_slots;
-
- ut_ad(!page_zip || page_is_comp(page));
- ut_ad(slot_no > 0);
- ut_ad(slot_no + 1 < page_dir_get_n_slots(page));
-
- n_slots = page_dir_get_n_slots(page);
-
- /* 1. Reset the n_owned fields of the slots to be
- deleted */
- slot = page_dir_get_nth_slot(page, slot_no);
- n_owned = page_dir_slot_get_n_owned(slot);
- page_dir_slot_set_n_owned(slot, page_zip, 0);
-
- /* 2. Update the n_owned value of the first non-deleted slot */
-
- slot = page_dir_get_nth_slot(page, slot_no + 1);
- page_dir_slot_set_n_owned(slot, page_zip,
- n_owned + page_dir_slot_get_n_owned(slot));
-
- /* 3. Destroy the slot by copying slots */
- for (i = slot_no + 1; i < n_slots; i++) {
- rec_t* rec = (rec_t*)
- page_dir_slot_get_rec(page_dir_get_nth_slot(page, i));
- page_dir_slot_set_rec(page_dir_get_nth_slot(page, i - 1), rec);
- }
-
- /* 4. Zero out the last slot, which will be removed */
- mach_write_to_2(page_dir_get_nth_slot(page, n_slots - 1), 0);
-
- /* 5. Update the page header */
- page_header_set_field(page, page_zip, PAGE_N_DIR_SLOTS, n_slots - 1);
-}
-
-/**************************************************************//**
-Used to add n slots to the directory. Does not set the record pointers
-in the added slots or update n_owned values: this is the responsibility
-of the caller. */
-UNIV_INLINE
-void
-page_dir_add_slot(
-/*==============*/
- page_t* page, /*!< in/out: the index page */
- page_zip_des_t* page_zip,/*!< in/out: comprssed page, or NULL */
- ulint start) /*!< in: the slot above which the new slots
- are added */
-{
- page_dir_slot_t* slot;
- ulint n_slots;
-
- n_slots = page_dir_get_n_slots(page);
-
- ut_ad(start < n_slots - 1);
-
- /* Update the page header */
- page_dir_set_n_slots(page, page_zip, n_slots + 1);
-
- /* Move slots up */
- slot = page_dir_get_nth_slot(page, n_slots);
- memmove(slot, slot + PAGE_DIR_SLOT_SIZE,
- (n_slots - 1 - start) * PAGE_DIR_SLOT_SIZE);
-}
-
-/****************************************************************//**
-Splits a directory slot which owns too many records. */
-void
-page_dir_split_slot(
-/*================*/
- page_t* page, /*!< in/out: index page */
- page_zip_des_t* page_zip,/*!< in/out: compressed page whose
- uncompressed part will be written, or NULL */
- ulint slot_no)/*!< in: the directory slot */
-{
- rec_t* rec;
- page_dir_slot_t* new_slot;
- page_dir_slot_t* prev_slot;
- page_dir_slot_t* slot;
- ulint i;
- ulint n_owned;
-
- ut_ad(!page_zip || page_is_comp(page));
- ut_ad(slot_no > 0);
-
- slot = page_dir_get_nth_slot(page, slot_no);
-
- n_owned = page_dir_slot_get_n_owned(slot);
- ut_ad(n_owned == PAGE_DIR_SLOT_MAX_N_OWNED + 1);
-
- /* 1. We loop to find a record approximately in the middle of the
- records owned by the slot. */
-
- prev_slot = page_dir_get_nth_slot(page, slot_no - 1);
- rec = (rec_t*) page_dir_slot_get_rec(prev_slot);
-
- for (i = 0; i < n_owned / 2; i++) {
- rec = page_rec_get_next(rec);
- }
-
- ut_ad(n_owned / 2 >= PAGE_DIR_SLOT_MIN_N_OWNED);
-
- /* 2. We add one directory slot immediately below the slot to be
- split. */
-
- page_dir_add_slot(page, page_zip, slot_no - 1);
-
- /* The added slot is now number slot_no, and the old slot is
- now number slot_no + 1 */
-
- new_slot = page_dir_get_nth_slot(page, slot_no);
- slot = page_dir_get_nth_slot(page, slot_no + 1);
-
- /* 3. We store the appropriate values to the new slot. */
-
- page_dir_slot_set_rec(new_slot, rec);
- page_dir_slot_set_n_owned(new_slot, page_zip, n_owned / 2);
-
- /* 4. Finally, we update the number of records field of the
- original slot */
-
- page_dir_slot_set_n_owned(slot, page_zip, n_owned - (n_owned / 2));
-}
-
-/*************************************************************//**
-Tries to balance the given directory slot with too few records with the upper
-neighbor, so that there are at least the minimum number of records owned by
-the slot; this may result in the merging of two slots. */
-void
-page_dir_balance_slot(
-/*==================*/
- page_t* page, /*!< in/out: index page */
- page_zip_des_t* page_zip,/*!< in/out: compressed page, or NULL */
- ulint slot_no)/*!< in: the directory slot */
-{
- page_dir_slot_t* slot;
- page_dir_slot_t* up_slot;
- ulint n_owned;
- ulint up_n_owned;
- rec_t* old_rec;
- rec_t* new_rec;
-
- ut_ad(!page_zip || page_is_comp(page));
- ut_ad(slot_no > 0);
-
- slot = page_dir_get_nth_slot(page, slot_no);
-
- /* The last directory slot cannot be balanced with the upper
- neighbor, as there is none. */
-
- if (UNIV_UNLIKELY(slot_no + 1 == page_dir_get_n_slots(page))) {
-
- return;
- }
-
- up_slot = page_dir_get_nth_slot(page, slot_no + 1);
-
- n_owned = page_dir_slot_get_n_owned(slot);
- up_n_owned = page_dir_slot_get_n_owned(up_slot);
-
- ut_ad(n_owned == PAGE_DIR_SLOT_MIN_N_OWNED - 1);
-
- /* If the upper slot has the minimum value of n_owned, we will merge
- the two slots, therefore we assert: */
- ut_ad(2 * PAGE_DIR_SLOT_MIN_N_OWNED - 1 <= PAGE_DIR_SLOT_MAX_N_OWNED);
-
- if (up_n_owned > PAGE_DIR_SLOT_MIN_N_OWNED) {
-
- /* In this case we can just transfer one record owned
- by the upper slot to the property of the lower slot */
- old_rec = (rec_t*) page_dir_slot_get_rec(slot);
-
- if (page_is_comp(page)) {
- new_rec = rec_get_next_ptr(old_rec, TRUE);
-
- rec_set_n_owned_new(old_rec, page_zip, 0);
- rec_set_n_owned_new(new_rec, page_zip, n_owned + 1);
- } else {
- new_rec = rec_get_next_ptr(old_rec, FALSE);
-
- rec_set_n_owned_old(old_rec, 0);
- rec_set_n_owned_old(new_rec, n_owned + 1);
- }
-
- page_dir_slot_set_rec(slot, new_rec);
-
- page_dir_slot_set_n_owned(up_slot, page_zip, up_n_owned -1);
- } else {
- /* In this case we may merge the two slots */
- page_dir_delete_slot(page, page_zip, slot_no);
- }
-}
-
/************************************************************//**
Returns the nth record of the record list.
This is the inverse function of page_rec_get_n_recs_before().
diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc
index d0318b51f4a..27f58727a4c 100644
--- a/storage/innobase/page/page0zip.cc
+++ b/storage/innobase/page/page0zip.cc
@@ -365,16 +365,12 @@ page_zip_dir_get(
- PAGE_ZIP_DIR_SLOT_SIZE * (slot + 1)));
}
-/**********************************************************************//**
-Write a log record of compressing an index page. */
-static
-void
-page_zip_compress_write_log(
-/*========================*/
- const page_zip_des_t* page_zip,/*!< in: compressed page */
- const page_t* page, /*!< in: uncompressed page */
- dict_index_t* index, /*!< in: index of the B-tree node */
- mtr_t* mtr) /*!< in: mini-transaction */
+/** Write a MLOG_ZIP_PAGE_COMPRESS record of compressing an index page.
+@param[in,out] block ROW_FORMAT=COMPRESSED index page
+@param[in] index the index that the block belongs to
+@param[in,out] mtr mini-transaction */
+static void page_zip_compress_write_log(buf_block_t* block,
+ dict_index_t* index, mtr_t* mtr)
{
byte* log_ptr;
ulint trailer_size;
@@ -388,6 +384,8 @@ page_zip_compress_write_log(
return;
}
+ const page_t* page = block->frame;
+ const page_zip_des_t* page_zip = &block->page.zip;
/* Read the number of user records. */
trailer_size = ulint(page_dir_get_n_heap(page_zip->data))
- PAGE_HEAP_NO_USER_LOW;
@@ -406,9 +404,10 @@ page_zip_compress_write_log(
compile_time_assert(FIL_PAGE_DATA <= PAGE_DATA);
ut_a(page_zip->m_end + trailer_size <= page_zip_get_size(page_zip));
- log_ptr = mlog_write_initial_log_record_fast((page_t*) page,
- MLOG_ZIP_PAGE_COMPRESS,
- log_ptr, mtr);
+ log_ptr = mlog_write_initial_log_record_low(MLOG_ZIP_PAGE_COMPRESS,
+ block->page.id.space(),
+ block->page.id.page_no(),
+ log_ptr, mtr);
mach_write_to_2(log_ptr, ulint(page_zip->m_end - FIL_PAGE_TYPE));
log_ptr += 2;
mach_write_to_2(log_ptr, trailer_size);
@@ -425,6 +424,9 @@ page_zip_compress_write_log(
/* Write the uncompressed trailer of the compressed page. */
mlog_catenate_string(mtr, page_zip->data + page_zip_get_size(page_zip)
- trailer_size, trailer_size);
+ if (!innodb_log_optimize_ddl) {
+ block->page.init_on_flush = true;
+ }
}
/******************************************************//**
@@ -1225,17 +1227,12 @@ page_zip_compress_clust(
func_exit:
return(err);}
-/**********************************************************************//**
-Compress a page.
-@return TRUE on success, FALSE on failure; page_zip will be left
-intact on failure. */
-ibool
+/** Attempt to compress a ROW_FORMAT=COMPRESSED page.
+@retval true on success
+@retval false on failure; block->page.zip will be left intact. */
+bool
page_zip_compress(
-/*==============*/
- page_zip_des_t* page_zip, /*!< in: size; out: data,
- n_blobs, m_start, m_end,
- m_nonempty */
- const page_t* page, /*!< in: uncompressed page */
+ buf_block_t* block, /*!< in/out: buffer block */
dict_index_t* index, /*!< in: index of the B-tree
node */
ulint level, /*!< in: commpression level */
@@ -1268,6 +1265,9 @@ page_zip_compress(
my_bool cmp_per_index_enabled;
cmp_per_index_enabled = srv_cmp_per_index_enabled;
+ page_t* page = block->frame;
+ page_zip_des_t* page_zip = &block->page.zip;
+
ut_a(page_is_comp(page));
ut_a(fil_page_index_page_check(page));
ut_ad(page_simple_validate_new((page_t*) page));
@@ -1518,7 +1518,7 @@ err_exit:
+= time_diff;
mutex_exit(&page_zip_stat_per_index_mutex);
}
- return(FALSE);
+ return false;
}
err = deflateEnd(&c_stream);
@@ -1558,7 +1558,7 @@ err_exit:
#endif /* UNIV_ZIP_DEBUG */
if (mtr) {
- page_zip_compress_write_log(page_zip, page, index, mtr);
+ page_zip_compress_write_log(block, index, mtr);
}
UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
@@ -1589,7 +1589,7 @@ err_exit:
dict_index_zip_success(index);
}
- return(TRUE);
+ return true;
}
/**********************************************************************//**
@@ -4700,7 +4700,6 @@ page_zip_reorganize(
mtr_t* mtr) /*!< in: mini-transaction */
{
buf_pool_t* buf_pool = buf_pool_from_block(block);
- page_zip_des_t* page_zip = buf_block_get_page_zip(block);
page_t* page = buf_block_get_frame(block);
buf_block_t* temp_block;
page_t* temp_page;
@@ -4711,7 +4710,8 @@ page_zip_reorganize(
ut_ad(!index->table->is_temporary());
/* Note that page_zip_validate(page_zip, page, index) may fail here. */
UNIV_MEM_ASSERT_RW(page, srv_page_size);
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
+ UNIV_MEM_ASSERT_RW(buf_block_get_page_zip(block)->data,
+ page_zip_get_size(buf_block_get_page_zip(block)));
/* Disable logging */
mtr_log_t log_mode = mtr_set_log_mode(mtr, MTR_LOG_NONE);
@@ -4751,7 +4751,7 @@ page_zip_reorganize(
/* Restore logging. */
mtr_set_log_mode(mtr, log_mode);
- if (!page_zip_compress(page_zip, page, index, page_zip_level, mtr)) {
+ if (!page_zip_compress(block, index, page_zip_level, mtr)) {
buf_block_free(temp_block);
return(FALSE);
}
@@ -4769,16 +4769,15 @@ related to the storage of records. Also copy PAGE_MAX_TRX_ID.
NOTE: The caller must update the lock table and the adaptive hash index. */
void
page_zip_copy_recs(
-/*===============*/
- page_zip_des_t* page_zip, /*!< out: copy of src_zip
- (n_blobs, m_start, m_end,
- m_nonempty, data[0..size-1]) */
- page_t* page, /*!< out: copy of src */
+ buf_block_t* block, /*!< in/out: buffer block */
const page_zip_des_t* src_zip, /*!< in: compressed page */
const page_t* src, /*!< in: page */
dict_index_t* index, /*!< in: index of the B-tree */
mtr_t* mtr) /*!< in: mini-transaction */
{
+ page_t* page = block->frame;
+ page_zip_des_t* page_zip = &block->page.zip;
+
ut_ad(mtr_memo_contains_page(mtr, page, MTR_MEMO_PAGE_X_FIX));
ut_ad(mtr_memo_contains_page(mtr, src, MTR_MEMO_PAGE_X_FIX));
ut_ad(!dict_index_is_ibuf(index));
@@ -4854,7 +4853,7 @@ page_zip_copy_recs(
#ifdef UNIV_ZIP_DEBUG
ut_a(page_zip_validate(page_zip, page, index));
#endif /* UNIV_ZIP_DEBUG */
- page_zip_compress_write_log(page_zip, page, index, mtr);
+ page_zip_compress_write_log(block, index, mtr);
}
/** Parse and optionally apply MLOG_ZIP_PAGE_COMPRESS.