Commit 44e33c23 authored by marko's avatar marko

branches/zip: btr_page_get_sure_split_rec(): Rewrite the

for (;;) { ... if (condition) { ... return }} loop as
do { ... } while (!condition); ... return.

On compressed pages, return NULL if incl_data > free_space.
parent 71e8ea62
...@@ -1364,7 +1364,7 @@ btr_page_get_sure_split_rec( ...@@ -1364,7 +1364,7 @@ btr_page_get_sure_split_rec(
otherwise the last included record will be the first on the right otherwise the last included record will be the first on the right
half page */ half page */
for (;;) { do {
/* Decide the next record to include */ /* Decide the next record to include */
if (rec == ins_rec) { if (rec == ins_rec) {
rec = NULL; /* NULL denotes that tuple is rec = NULL; /* NULL denotes that tuple is
...@@ -1386,38 +1386,36 @@ btr_page_get_sure_split_rec( ...@@ -1386,38 +1386,36 @@ btr_page_get_sure_split_rec(
} }
n++; n++;
} while (incl_data + page_dir_calc_reserved_space(n)
< total_space / 2);
if (incl_data + page_dir_calc_reserved_space(n) if (incl_data + page_dir_calc_reserved_space(n) <= free_space) {
>= total_space / 2) { /* The next record will be the first on
the right half page if it is not the
if (incl_data + page_dir_calc_reserved_space(n) supremum record of page */
<= free_space) {
/* The next record will be the first on
the right half page if it is not the
supremum record of page */
if (rec == ins_rec) { if (rec == ins_rec) {
rec = NULL; rec = NULL;
goto func_exit; goto func_exit;
} else if (rec == NULL) { } else if (rec == NULL) {
next_rec = page_rec_get_next(ins_rec); next_rec = page_rec_get_next(ins_rec);
} else { } else {
next_rec = page_rec_get_next(rec); next_rec = page_rec_get_next(rec);
} }
ut_ad(next_rec); ut_ad(next_rec);
if (!page_rec_is_supremum(next_rec)) { if (!page_rec_is_supremum(next_rec)) {
rec = next_rec; rec = next_rec;
} }
} } else if (page_zip) {
rec = NULL;
}
func_exit: func_exit:
if (UNIV_LIKELY_NULL(heap)) { if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap); mem_heap_free(heap);
}
return(rec);
}
} }
return(rec);
} }
/***************************************************************** /*****************************************************************
......
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