Commit 17eb5eab authored by marko's avatar marko

branches/zip: Minor cleanup.

btr_cur_compress_if_useful(): Replace if () return(); return() with return.

page_rec_get_next_low(): New function.

page_rec_get_prev(): Invoke page_is_comp() outside the loop.
Replace page_rec_get_next() with loop-specific instances of
page_rec_get_next_low().

page_copy_rec_list_end(): Add some debug assertions.
parent b7364399
......@@ -2535,12 +2535,8 @@ btr_cur_compress_if_useful(
ut_ad(mtr_memo_contains(mtr, buf_block_align(btr_cur_get_rec(cursor)),
MTR_MEMO_PAGE_X_FIX));
if (btr_cur_compress_recommendation(cursor, mtr)) {
return(btr_compress(cursor, mtr));
}
return(FALSE);
return(btr_cur_compress_recommendation(cursor, mtr)
&& btr_compress(cursor, mtr));
}
/***********************************************************
......
......@@ -416,11 +416,19 @@ page_is_leaf(
Gets the pointer to the next record on the page. */
UNIV_INLINE
rec_t*
page_rec_get_next_low(
/*==================*/
/* out: pointer to next record */
rec_t* rec, /* in: pointer to record */
ulint comp); /* in: nonzero=compact page layout */
/****************************************************************
Gets the pointer to the next record on the page. */
UNIV_INLINE
rec_t*
page_rec_get_next(
/*==============*/
/* out: pointer to next record */
rec_t* rec); /* in: pointer to record, must not be page
supremum */
rec_t* rec); /* in: pointer to record */
/****************************************************************
Sets the pointer to the next record on the page. */
UNIV_INLINE
......
......@@ -589,10 +589,11 @@ page_dir_calc_reserved_space(
Gets the pointer to the next record on the page. */
UNIV_INLINE
rec_t*
page_rec_get_next(
/*==============*/
page_rec_get_next_low(
/*==================*/
/* out: pointer to next record */
rec_t* rec) /* in: pointer to record */
rec_t* rec, /* in: pointer to record */
ulint comp) /* in: nonzero=compact page layout */
{
ulint offs;
page_t* page;
......@@ -601,7 +602,7 @@ page_rec_get_next(
page = ut_align_down(rec, UNIV_PAGE_SIZE);
offs = rec_get_next_offs(rec, page_is_comp(page));
offs = rec_get_next_offs(rec, comp);
if (UNIV_UNLIKELY(offs >= UNIV_PAGE_SIZE)) {
fprintf(stderr,
......@@ -625,6 +626,17 @@ page_rec_get_next(
return(page + offs);
}
/****************************************************************
Gets the pointer to the next record on the page. */
UNIV_INLINE
rec_t*
page_rec_get_next(
/*==============*/
/* out: pointer to next record */
rec_t* rec) /* in: pointer to record */
{
return(page_rec_get_next_low(rec, page_rec_is_comp(rec)));
}
/****************************************************************
Sets the pointer to the next record on the page. */
UNIV_INLINE
......@@ -688,9 +700,16 @@ page_rec_get_prev(
rec2 = page_dir_slot_get_rec(slot);
while (rec != rec2) {
prev_rec = rec2;
rec2 = page_rec_get_next(rec2);
if (page_is_comp(page)) {
while (rec != rec2) {
prev_rec = rec2;
rec2 = page_rec_get_next_low(rec2, TRUE);
}
} else {
while (rec != rec2) {
prev_rec = rec2;
rec2 = page_rec_get_next_low(rec2, FALSE);
}
}
ut_a(prev_rec);
......
......@@ -599,10 +599,12 @@ page_copy_rec_list_end(
dict_index_t* index, /* in: record descriptor */
mtr_t* mtr) /* in: mtr */
{
page_t* page;
ulint log_mode = 0; /* remove warning */
page_t* page = ut_align_down(rec, UNIV_PAGE_SIZE);
ulint log_mode= 0; /* remove warning */
ut_ad(!new_page_zip || page_zip_validate(new_page_zip, new_page));
ut_ad(page_is_leaf(page) == page_is_leaf(new_page));
ut_ad(page_is_comp(page) == page_is_comp(new_page));
if (UNIV_LIKELY_NULL(new_page_zip)) {
log_mode = mtr_set_log_mode(mtr, MTR_LOG_NONE);
......@@ -615,8 +617,6 @@ page_copy_rec_list_end(
page_copy_rec_list_end_no_locks(new_page, rec, index, mtr);
}
page = ut_align_down(rec, UNIV_PAGE_SIZE);
if (UNIV_LIKELY_NULL(new_page_zip)) {
mtr_set_log_mode(mtr, log_mode);
......
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