Commit 7b57df22 authored by marko's avatar marko

branches/zip: Minor cleanup.

Replace btr_page_get_level() with page_is_leaf() where possible.

row_purge_upd_exist_or_extern(): Remove obsolete TODO comment.

dtuple_convert_big_rec(): Replace a flag variable with goto.
parent e14e7186
......@@ -511,7 +511,7 @@ btr_node_ptr_set_child_page_no(
ulint len;
ut_ad(rec_offs_validate(rec, NULL, offsets));
ut_ad(0 < btr_page_get_level(buf_frame_align(rec), mtr));
ut_ad(!page_is_leaf(buf_frame_align(rec)));
ut_ad(!rec_offs_comp(offsets) || rec_get_node_ptr_flag(rec));
/* The child address is in the last field */
......@@ -1762,7 +1762,7 @@ func_start:
NULL, NULL, tuple, heap);
}
if (insert_will_fit && (btr_page_get_level(page, mtr) == 0)) {
if (insert_will_fit && page_is_leaf(page)) {
mtr_memo_release(mtr, dict_tree_get_lock(tree),
MTR_MEMO_X_LOCK);
......@@ -2398,7 +2398,7 @@ btr_discard_page(
ut_a(page_is_comp(merge_page) == page_is_comp(page));
btr_search_drop_page_hash_index(page);
if (left_page_no == FIL_NULL && btr_page_get_level(page, mtr) > 0) {
if (left_page_no == FIL_NULL && !page_is_leaf(page)) {
/* We have to mark the leftmost node pointer on the right
side page as the predefined minimum record */
......@@ -2506,7 +2506,7 @@ btr_print_recursive(
while (!page_cur_is_after_last(&cursor)) {
if (0 == btr_page_get_level(page, mtr)) {
if (page_is_leaf(page)) {
/* If this is the leaf level, do nothing */
......@@ -2590,7 +2590,7 @@ btr_check_node_ptr(
node_ptr = btr_page_get_father_node_ptr(tree, page, mtr);
if (btr_page_get_level(page, mtr) == 0) {
if (page_is_leaf(page)) {
return(TRUE);
}
......@@ -2856,7 +2856,7 @@ btr_validate_level(
page_zip = buf_block_get_page_zip(buf_block_align(page));
ut_ad(!page_zip || page_zip_validate(page_zip, page));
#endif
ut_a(btr_page_get_level(page, &mtr) > 0);
ut_a(!page_is_leaf(page));
page_cur_set_before_first(page, &cursor);
page_cur_move_to_next(&cursor);
......@@ -2994,7 +2994,7 @@ loop:
goto node_ptr_fails;
}
if (btr_page_get_level(page, &mtr) > 0) {
if (!page_is_leaf(page)) {
offsets = rec_get_offsets(node_ptr, index,
offsets, ULINT_UNDEFINED, &heap);
......
......@@ -2569,7 +2569,7 @@ btr_cur_optimistic_delete(
page = btr_cur_get_page(cursor);
ut_ad(btr_page_get_level(page, mtr) == 0);
ut_ad(page_is_leaf(page));
rec = btr_cur_get_rec(cursor);
offsets = rec_get_offsets(rec, cursor->index, offsets,
......
......@@ -494,7 +494,6 @@ dtuple_convert_big_rec(
ulint n_fields;
ulint longest;
ulint longest_i = ULINT_MAX;
ibool is_externally_stored;
ulint i;
ulint j;
......@@ -536,28 +535,26 @@ dtuple_convert_big_rec(
/* Skip over fields which already are externally
stored */
is_externally_stored = FALSE;
if (ext_vec) {
for (j = 0; j < n_ext_vec; j++) {
if (ext_vec[j] == i) {
is_externally_stored = TRUE;
goto is_externally_stored;
}
}
}
if (!is_externally_stored) {
dfield = dtuple_get_nth_field(entry, i);
dfield = dtuple_get_nth_field(entry, i);
if (dfield->len != UNIV_SQL_NULL &&
dfield->len > longest) {
if (dfield->len != UNIV_SQL_NULL
&& dfield->len > longest) {
longest = dfield->len;
longest = dfield->len;
longest_i = i;
}
longest_i = i;
}
is_externally_stored:
continue;
}
/* We do not store externally fields which are smaller than
......
......@@ -772,7 +772,7 @@ ibuf_set_free_bits_low(
return;
}
if (btr_page_get_level_low(page) != 0) {
if (!page_is_leaf(page)) {
return;
}
......@@ -817,7 +817,7 @@ ibuf_set_free_bits(
return;
}
if (btr_page_get_level_low(page) != 0) {
if (!page_is_leaf(page)) {
return;
}
......
......@@ -2175,8 +2175,7 @@ page_validate(
if (page_is_comp(page) && page_rec_is_user_rec(rec)
&& UNIV_UNLIKELY(rec_get_node_ptr_flag(rec)
!= (ibool)
(btr_page_get_level_low(page) != 0))) {
== page_is_leaf(page))) {
fputs("InnoDB: node_ptr flag mismatch\n", stderr);
goto func_exit;
}
......
......@@ -453,7 +453,6 @@ skip_secondaries:
SYNC_TRX_UNDO_PAGE);
#endif /* UNIV_SYNC_DEBUG */
ut_a(ufield->new_val.len >= BTR_EXTERN_FIELD_REF_SIZE);
/* TODO: observe dict_table_is_zip(index->table) */
btr_free_externally_stored_field(index, data_field
+ ufield->new_val.len
- BTR_EXTERN_FIELD_REF_SIZE,
......
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