Commit 6ba1aed1 authored by marko's avatar marko

branches/zip: Minor improvements

btr_page_get_father_for_rec(): Remove redundant assertion.
Add UNIV_UNLIKELY to an assertion-like test.

btr_validate_level(): Add debug assertions on page_zip_validate().

page_zip_compress(): Remove bogus assertion.

page_zip_write_rec(): Assert that the record written is neither delete-marked
nor deleted.
parent 4596d491
......@@ -600,8 +600,8 @@ btr_page_get_father_for_rec(
offsets = rec_get_offsets(node_ptr, index, offsets,
ULINT_UNDEFINED, &heap);
if (btr_node_ptr_get_child_page_no(node_ptr, offsets) !=
buf_frame_get_page_no(page)) {
if (UNIV_UNLIKELY(btr_node_ptr_get_child_page_no(node_ptr, offsets) !=
buf_frame_get_page_no(page))) {
rec_t* print_rec;
fputs("InnoDB: Dump of the child page:\n", stderr);
buf_page_print(buf_frame_align(page));
......@@ -630,10 +630,9 @@ btr_page_get_father_for_rec(
"InnoDB: corruption. If the crash happens at the database startup, see\n"
"InnoDB: http://dev.mysql.com/doc/mysql/en/Forcing_recovery.html about\n"
"InnoDB: forcing recovery. Then dump + drop + reimport.\n", stderr);
}
ut_a(btr_node_ptr_get_child_page_no(node_ptr, offsets) ==
buf_frame_get_page_no(page));
ut_error;
}
mem_heap_free(heap);
return(node_ptr);
......@@ -2842,6 +2841,9 @@ btr_validate_level(
mem_heap_t* heap = mem_heap_create(256);
ulint* offsets = NULL;
ulint* offsets2= NULL;
#ifdef UNIV_DEBUG
page_zip_des_t* page_zip;
#endif
mtr_start(&mtr);
......@@ -2854,7 +2856,10 @@ btr_validate_level(
index = UT_LIST_GET_FIRST(tree->tree_indexes);
while (level != btr_page_get_level(page, &mtr)) {
#ifdef UNIV_DEBUG
page_zip = buf_block_get_page_zip(buf_block_align(page));
ut_ad(!page_zip || page_zip_validate(page_zip, page));
#endif
ut_a(btr_page_get_level(page, &mtr) > 0);
page_cur_set_before_first(page, &cursor);
......@@ -2878,6 +2883,11 @@ btr_validate_level(
offsets = offsets2 = NULL;
mtr_x_lock(dict_tree_get_lock(tree), &mtr);
#ifdef UNIV_DEBUG
page_zip = buf_block_get_page_zip(buf_block_align(page));
ut_ad(!page_zip || page_zip_validate(page_zip, page));
#endif
/* Check ordering etc. of records */
if (!page_validate(page, index)) {
......
......@@ -675,11 +675,6 @@ page_zip_compress(
ut_ad(!c_stream.avail_in);
ut_ad(c_stream.next_in == src);
ut_ad(slot < page_get_n_recs(
(page_t*) page)
|| !memcmp(src, zero,
DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN));
memcpy(storage - (DATA_TRX_ID_LEN
+ DATA_ROLL_PTR_LEN)
* (rec_get_heap_no_new(rec) - 1),
......@@ -1871,6 +1866,7 @@ page_zip_write_rec(
byte* data;
byte* storage;
ulint heap_no;
byte* slot;
ut_ad(buf_block_get_page_zip(buf_block_align((byte*)rec)) == page_zip);
ut_ad(page_zip_simple_validate(page_zip));
......@@ -1883,6 +1879,13 @@ page_zip_write_rec(
page_zip->data, PAGE_DATA));
page = ut_align_down((rec_t*) rec, UNIV_PAGE_SIZE);
slot = page_zip_dir_find(page_zip,
ut_align_offset(rec, UNIV_PAGE_SIZE));
ut_a(slot);
/* Clear the delete mark bit. */
ut_ad(!(rec_get_info_bits((rec_t*) rec, TRUE)
& REC_INFO_DELETED_FLAG));
*slot &= ~(PAGE_ZIP_DIR_SLOT_DEL >> 8);
ut_ad(rec_get_start((rec_t*) rec, offsets) >= page + PAGE_ZIP_START);
ut_ad(rec_get_end((rec_t*) rec, offsets) <= page + UNIV_PAGE_SIZE
......
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