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,12 +1386,10 @@ btr_page_get_sure_split_rec( ...@@ -1386,12 +1386,10 @@ 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) {
if (incl_data + page_dir_calc_reserved_space(n)
<= free_space) {
/* The next record will be the first on /* The next record will be the first on
the right half page if it is not the the right half page if it is not the
supremum record of page */ supremum record of page */
...@@ -1409,6 +1407,8 @@ btr_page_get_sure_split_rec( ...@@ -1409,6 +1407,8 @@ btr_page_get_sure_split_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:
...@@ -1416,8 +1416,6 @@ func_exit: ...@@ -1416,8 +1416,6 @@ func_exit:
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