diff --git a/include/common_helper.h b/include/common_helper.h index dabae98..62f6952 100644 --- a/include/common_helper.h +++ b/include/common_helper.h @@ -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 @@ -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(); @@ -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(n), v); } /** @@ -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(n), v); } diff --git a/include/interface_remove.h b/include/interface_remove.h index 233c3e3..996bece 100644 --- a/include/interface_remove.h +++ b/include/interface_remove.h @@ -65,14 +65,17 @@ namespace yakushima { constexpr std::size_t tuple_node_index = 0; constexpr std::size_t tuple_v_index = 1; border_node* target_border = std::get(node_and_v); -#ifndef NDEBUG + node_version64_body v_at_fb = std::get(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)) { @@ -80,8 +83,7 @@ namespace yakushima { << "find_border return not border node."; return status::ERR_FATAL; } -#endif - node_version64_body v_at_fb = std::get(node_and_v); + retry_fetch_lv: node_version64_body v_at_fetch_lv{}; std::size_t lv_pos = 0;