Skip to content

Commit

Permalink
update to bypass unexpected code path.
Browse files Browse the repository at this point in the history
  • Loading branch information
thawk105 committed Oct 6, 2023
1 parent de63cfd commit 4cbdb68
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
9 changes: 2 additions & 7 deletions include/common_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ find_border(base_node* const root, const key_slice_type key_slice,
const key_length_type key_slice_length, status& special_status) {
special_status = status::OK;
retry:
#ifndef NDEBUG
if (root == nullptr) {
LOG(ERROR) << log_location_prefix << "find_border: root: " << root
<< ", key_slice: " << key_slice
Expand All @@ -39,7 +38,6 @@ find_border(base_node* const root, const key_slice_type key_slice,
// if special status is ok, it is just after called.
// if special status is warn, it is just after retry one.
}
#endif

base_node* n = root;
node_version64_body v = n->get_stable_version();
Expand All @@ -49,14 +47,13 @@ find_border(base_node* const root, const key_slice_type key_slice,
}
if (v.get_deleted()) {
// root && deleted node.
#ifndef NDEBUG
if (n == nullptr) {
LOG(ERROR) << log_location_prefix << "find_border: root: " << root
<< ", key_slice: " << key_slice
<< ", key_slice_length: " << key_slice_length
<< ", special_status: " << special_status;
<< ", special_status: " << special_status
<< ", version: " << v;
}
#endif
return std::make_tuple(dynamic_cast<border_node*>(n), v);
}
/**
Expand All @@ -79,14 +76,12 @@ find_border(base_node* const root, const key_slice_type key_slice,
}
n = n_child;
}
#ifndef NDEBUG
if (n == nullptr) {
LOG(ERROR) << log_location_prefix << "find_border: root: " << root
<< ", key_slice: " << key_slice
<< ", key_slice_length: " << key_slice_length
<< ", special_status: " << special_status;
}
#endif
return std::make_tuple(dynamic_cast<border_node*>(n), v);
}

Expand Down
18 changes: 10 additions & 8 deletions include/interface_remove.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,23 +65,25 @@ namespace yakushima {
constexpr std::size_t tuple_node_index = 0;
constexpr std::size_t tuple_v_index = 1;
border_node* target_border = std::get<tuple_node_index>(node_and_v);
#ifndef NDEBUG
node_version64_body v_at_fb = std::get<tuple_v_index>(node_and_v);

// check target_border is not nullptr
if (target_border == nullptr) {
LOG(ERROR) << log_location_prefix << "root: " << root
<< ", key_slice: " << key_slice
<< ", key_length: " << key_length
<< ", special_status: " << special_status;
return status::ERR_FATAL;
// TODO
/**
* This code path is not expected to be reached. However, sometimes
* this code path is reached. You may need to make appropriate use of
* compiler fences.
*/
goto retry_from_root;
}
// check target_border is border node.
if (typeid(*target_border) != typeid(border_node)) {
LOG(ERROR) << log_location_prefix
<< "find_border return not border node.";
return status::ERR_FATAL;
}
#endif
node_version64_body v_at_fb = std::get<tuple_v_index>(node_and_v);

retry_fetch_lv:
node_version64_body v_at_fetch_lv{};
std::size_t lv_pos = 0;
Expand Down

0 comments on commit 4cbdb68

Please sign in to comment.