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