Commit 98eda4e9 authored by marko's avatar marko

branches/zip: Make test-insert --small-test pass.

btr_compress(): Pass the correct page_zip to btr_node_ptr_set_child_page_no().

page_mem_free(): Remove parameter mtr.  Do not call page_zip_clear_rec() here.

page_cur_delete_rec(): Call page_zip_clear_rec() here.  Decrement PAGE_N_RECS
only after calling page_mem_free().  Assert page_zip_validate().
parent ee152b82
...@@ -2144,7 +2144,6 @@ btr_compress( ...@@ -2144,7 +2144,6 @@ btr_compress(
page_t* merge_page; page_t* merge_page;
ibool is_left; ibool is_left;
page_t* page; page_t* page;
page_zip_des_t* page_zip;
rec_t* node_ptr; rec_t* node_ptr;
ulint data_size; ulint data_size;
ulint n_recs; ulint n_recs;
...@@ -2153,7 +2152,6 @@ btr_compress( ...@@ -2153,7 +2152,6 @@ btr_compress(
ulint level; ulint level;
page = btr_cur_get_page(cursor); page = btr_cur_get_page(cursor);
page_zip = buf_block_get_page_zip(buf_block_align(page));
tree = btr_cur_get_tree(cursor); tree = btr_cur_get_tree(cursor);
ut_a((ibool) !!page_is_comp(page) ut_a((ibool) !!page_is_comp(page)
== dict_table_is_comp(cursor->index->table) ); == dict_table_is_comp(cursor->index->table) );
...@@ -2251,7 +2249,9 @@ btr_compress( ...@@ -2251,7 +2249,9 @@ btr_compress(
/* Replace the address of the old child node (= page) with the /* Replace the address of the old child node (= page) with the
address of the merge page to the right */ address of the merge page to the right */
btr_node_ptr_set_child_page_no(node_ptr, page_zip, btr_node_ptr_set_child_page_no(node_ptr,
buf_block_get_page_zip(
buf_block_align(node_ptr)),
rec_get_offsets(node_ptr, cursor->index, rec_get_offsets(node_ptr, cursor->index,
offsets_, ULINT_UNDEFINED, &heap), offsets_, ULINT_UNDEFINED, &heap),
right_page_no, mtr); right_page_no, mtr);
......
...@@ -605,9 +605,7 @@ page_mem_free( ...@@ -605,9 +605,7 @@ page_mem_free(
6 bytes available, or NULL */ 6 bytes available, or NULL */
rec_t* rec, /* in: pointer to the (origin of) record */ rec_t* rec, /* in: pointer to the (origin of) record */
dict_index_t* index, /* in: record descriptor */ dict_index_t* index, /* in: record descriptor */
const ulint* offsets,/* in: array returned by rec_get_offsets() */ const ulint* offsets);/* in: array returned by rec_get_offsets() */
mtr_t* mtr); /* in: mini-transaction handle, or NULL
if page_zip==NULL */
/************************************************************** /**************************************************************
The index page creation function. */ The index page creation function. */
......
...@@ -910,9 +910,7 @@ page_mem_free( ...@@ -910,9 +910,7 @@ page_mem_free(
6 bytes available, or NULL */ 6 bytes available, or NULL */
rec_t* rec, /* in: pointer to the (origin of) record */ rec_t* rec, /* in: pointer to the (origin of) record */
dict_index_t* index, /* in: record descriptor */ dict_index_t* index, /* in: record descriptor */
const ulint* offsets,/* in: array returned by rec_get_offsets() */ const ulint* offsets)/* in: array returned by rec_get_offsets() */
mtr_t* mtr) /* in: mini-transaction handle, or NULL
if page_zip==NULL */
{ {
rec_t* free; rec_t* free;
ulint garbage; ulint garbage;
...@@ -933,14 +931,6 @@ page_mem_free( ...@@ -933,14 +931,6 @@ page_mem_free(
/* Update the dense page directory. */ /* Update the dense page directory. */
page_zip_dir_delete(page_zip, rec, free); page_zip_dir_delete(page_zip, rec, free);
/* Clear the data bytes of the deleted record in order
to improve the compression ratio of the page. The fixed extra
bytes of the record, which will be omitted from the
stream compression algorithm, cannot be cleared, because
page_mem_alloc() needs them in order to determine the size
of the deleted record. */
page_zip_clear_rec(page_zip, rec, index, offsets, mtr);
} }
garbage = page_header_get_field(page, PAGE_GARBAGE); garbage = page_header_get_field(page, PAGE_GARBAGE);
......
...@@ -1469,6 +1469,7 @@ page_cur_delete_rec( ...@@ -1469,6 +1469,7 @@ page_cur_delete_rec(
current_rec = cursor->rec; current_rec = cursor->rec;
ut_ad(rec_offs_validate(current_rec, index, offsets)); ut_ad(rec_offs_validate(current_rec, index, offsets));
ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table)); ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table));
ut_ad(!page_zip || page_zip_validate(page_zip, page));
/* The record must not be the supremum or infimum record. */ /* The record must not be the supremum or infimum record. */
ut_ad(page_rec_is_user_rec(current_rec)); ut_ad(page_rec_is_user_rec(current_rec));
...@@ -1513,8 +1514,6 @@ page_cur_delete_rec( ...@@ -1513,8 +1514,6 @@ page_cur_delete_rec(
/* 3. Remove the record from the linked list of records */ /* 3. Remove the record from the linked list of records */
page_rec_set_next(prev_rec, next_rec); page_rec_set_next(prev_rec, next_rec);
page_header_set_field(page, page_zip, PAGE_N_RECS,
(ulint)(page_get_n_recs(page) - 1));
/* 4. If the deleted record is pointed to by a dir slot, update the /* 4. If the deleted record is pointed to by a dir slot, update the
record pointer in slot. In the following if-clause we assume that record pointer in slot. In the following if-clause we assume that
...@@ -1535,7 +1534,18 @@ page_cur_delete_rec( ...@@ -1535,7 +1534,18 @@ page_cur_delete_rec(
page_dir_slot_set_n_owned(cur_dir_slot, page_zip, cur_n_owned - 1); page_dir_slot_set_n_owned(cur_dir_slot, page_zip, cur_n_owned - 1);
/* 6. Free the memory occupied by the record */ /* 6. Free the memory occupied by the record */
page_mem_free(page, page_zip, current_rec, index, offsets, mtr); page_mem_free(page, page_zip, current_rec, index, offsets);
page_header_set_field(page, page_zip, PAGE_N_RECS,
(ulint)(page_get_n_recs(page) - 1));
if (UNIV_LIKELY_NULL(page_zip)) {
/* Clear the data bytes of the deleted record in order
to improve the compression ratio of the page. The fixed extra
bytes of the record, which will be omitted from the
stream compression algorithm, cannot be cleared, because
page_mem_alloc() needs them in order to determine the size
of the deleted record. */
page_zip_clear_rec(page_zip, rec, index, offsets, mtr);
}
/* 7. Now we have decremented the number of owned records of the slot. /* 7. Now we have decremented the number of owned records of the slot.
If the number drops below PAGE_DIR_SLOT_MIN_N_OWNED, we balance the If the number drops below PAGE_DIR_SLOT_MIN_N_OWNED, we balance the
......
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