Closed llersch closed 9 years ago
Hi Lucas,
could you try changing it to:
// first, pick the center point according to the skewness of past insertions to this page.
slotid_t center_point = (nrecs() / 2); // usually just in the middle
if (nrecs() > 10) {
if (is_insertion_skewed_right()) {
// last 5 inserts were on right-most, so let split on right-skewed point (90%)
center_point = (nrecs() * 9 / 10);
} else if (is_insertion_skewed_left()) {
// last 5 inserts were on left-most, so let split on left-skewed point (10%)
center_point = (nrecs() * 1 / 10);
}
}
I.e., only consider skew if there are more than 10 records, since the skew points are picked in multiples of 10 (10% and 90%).
When using btree_populate_records(...) for tests, there is an assertion failure at btree_page_h.cpp:1625, the method is: suggest_fence_for_split(...).
The assertion that fails is at the end of the method:
Inside suggest_fence_for_split(...), there are the following lines:
btree_populate_records(...) inserts new key-value pairs in descending order. For some reason, at some point the lines above are executed with nrecs() = 4 and is_insertion_skewed_left() = true. This causes center_point = 0
With center_point = 0, the execution never goes through the for-loop in the following code of suggest_fence_for_split():
In other words, sep_key value is initialized as NULL and never changed, causing the assertion to failure right after this for-loop.
Work-around: by changing btree_populate_records(...) to insert records in ascending order, this assertion failure does not occur.