Commit cafaf715 authored by marko's avatar marko

branches/zip: Improve assertions related to the linked lists of records

on B-tree index pages.

page_rec_set_next(): Assert that rec != next.

rec_get_next_ptr(), rec_get_next_offs(): On compact pages, assert that
there are at least REC_N_NEW_EXTRA_BYTES + 1 between records.

page_cur_insert_rec_write_log(): Replace a buf_frame_align() call
with ut_align_offset().

page_cur_insert_rec_low(): Assert that current_rec != insert_rec.
parent 6b077aa8
......@@ -652,6 +652,7 @@ page_rec_set_next(
ut_ad(page_rec_check(rec));
ut_ad(!page_rec_is_supremum(rec));
ut_ad(rec != next);
ut_ad(!next || !page_rec_is_infimum(next));
ut_ad(!next || ut_align_down(rec, UNIV_PAGE_SIZE)
......
......@@ -269,6 +269,12 @@ rec_get_next_ptr(
+ ut_align_offset(rec, UNIV_PAGE_SIZE)
< UNIV_PAGE_SIZE);
#endif
/* There must be at least REC_N_NEW_EXTRA_BYTES + 1
between each record. */
ut_ad((field_value > REC_N_NEW_EXTRA_BYTES
&& field_value < 32768)
|| field_value < (uint16) -REC_N_NEW_EXTRA_BYTES);
return((byte*) ut_align_down(rec, UNIV_PAGE_SIZE)
+ ut_align_offset(rec + field_value, UNIV_PAGE_SIZE));
} else {
......@@ -323,6 +329,12 @@ rec_get_next_offs(
return(0);
}
/* There must be at least REC_N_NEW_EXTRA_BYTES + 1
between each record. */
ut_ad((field_value > REC_N_NEW_EXTRA_BYTES
&& field_value < 32768)
|| field_value < (uint16) -REC_N_NEW_EXTRA_BYTES);
return(ut_align_offset(rec + field_value, UNIV_PAGE_SIZE));
} else {
ut_ad(field_value < UNIV_PAGE_SIZE);
......
......@@ -621,8 +621,8 @@ page_cur_insert_rec_write_log(
log_end = &log_ptr[2 + 5 + 1 + 5 + 5 + MLOG_BUF_MARGIN];
/* Write the cursor rec offset as a 2-byte ulint */
mach_write_to_2(log_ptr, cursor_rec
- buf_frame_align(cursor_rec));
mach_write_to_2(log_ptr,
ut_align_offset(cursor_rec, UNIV_PAGE_SIZE));
log_ptr += 2;
} else {
log_ptr = mlog_open(mtr, 5 + 1 + 5 + 5 + MLOG_BUF_MARGIN);
......@@ -1022,6 +1022,7 @@ page_cur_insert_rec_low(
/* 4. Insert the record in the linked list of records */
current_rec = cursor->rec;
ut_ad(current_rec != insert_rec);
{
/* next record after current before the insertion */
......
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