This is an automated email from the ASF dual-hosted git repository.
kxiao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new bdacefa734 [Fix](status)Fix leaky abstraction and shield the status
code `END_OF_FILE` from upper layers (#24165)
bdacefa734 is described below
commit bdacefa734b05a6375022abbf3546e2d7b82caa8
Author: bobhan1 <[email protected]>
AuthorDate: Tue Sep 12 11:10:52 2023 +0800
[Fix](status)Fix leaky abstraction and shield the status code `END_OF_FILE`
from upper layers (#24165)
---
be/src/olap/delete_bitmap_calculator.cpp | 1 +
be/src/olap/rowset/segment_v2/binary_prefix_page.cpp | 8 +++++++-
be/src/olap/rowset/segment_v2/segment.cpp | 7 +++++--
be/src/olap/tablet.cpp | 2 +-
be/test/olap/primary_key_index_test.cpp | 2 +-
5 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/be/src/olap/delete_bitmap_calculator.cpp
b/be/src/olap/delete_bitmap_calculator.cpp
index b1d9226eaf..e529336747 100644
--- a/be/src/olap/delete_bitmap_calculator.cpp
+++ b/be/src/olap/delete_bitmap_calculator.cpp
@@ -17,6 +17,7 @@
#include "olap/delete_bitmap_calculator.h"
+#include "common/status.h"
#include "olap/primary_key_index.h"
#include "vec/data_types/data_type_factory.hpp"
diff --git a/be/src/olap/rowset/segment_v2/binary_prefix_page.cpp
b/be/src/olap/rowset/segment_v2/binary_prefix_page.cpp
index ab9056def1..183e7bb085 100644
--- a/be/src/olap/rowset/segment_v2/binary_prefix_page.cpp
+++ b/be/src/olap/rowset/segment_v2/binary_prefix_page.cpp
@@ -202,7 +202,13 @@ Status
BinaryPrefixPageDecoder::seek_at_or_after_value(const void* value, bool*
return Status::OK();
}
_cur_pos++;
- RETURN_IF_ERROR(_read_next_value());
+ auto st = _read_next_value();
+ if (st.is<ErrorCode::END_OF_FILE>()) {
+ return Status::Error<ErrorCode::ENTRY_NOT_FOUND>("all value small
than the value");
+ }
+ if (!st.ok()) {
+ return st;
+ }
}
}
diff --git a/be/src/olap/rowset/segment_v2/segment.cpp
b/be/src/olap/rowset/segment_v2/segment.cpp
index bc64e5cf4b..53b50e7746 100644
--- a/be/src/olap/rowset/segment_v2/segment.cpp
+++ b/be/src/olap/rowset/segment_v2/segment.cpp
@@ -363,8 +363,11 @@ Status Segment::lookup_row_key(const Slice& key, bool
with_seq_col, RowLocation*
bool exact_match = false;
std::unique_ptr<segment_v2::IndexedColumnIterator> index_iterator;
RETURN_IF_ERROR(_pk_index_reader->new_iterator(&index_iterator));
- RETURN_IF_ERROR(index_iterator->seek_at_or_after(&key_without_seq,
&exact_match));
- if (!has_seq_col && !exact_match) {
+ auto st = index_iterator->seek_at_or_after(&key_without_seq, &exact_match);
+ if (!st.ok() && !st.is<ErrorCode::ENTRY_NOT_FOUND>()) {
+ return st;
+ }
+ if (st.is<ErrorCode::ENTRY_NOT_FOUND>() || (!has_seq_col && !exact_match))
{
return Status::Error<ErrorCode::KEY_NOT_FOUND>("Can't find key in the
segment");
}
row_location->row_id = index_iterator->get_current_ordinal();
diff --git a/be/src/olap/tablet.cpp b/be/src/olap/tablet.cpp
index d4029f22be..7617c80334 100644
--- a/be/src/olap/tablet.cpp
+++ b/be/src/olap/tablet.cpp
@@ -2835,7 +2835,7 @@ Status Tablet::lookup_row_key(const Slice& encoded_key,
bool with_seq_col,
for (auto id : picked_segments) {
Status s = segments[id]->lookup_row_key(encoded_key, with_seq_col,
&loc);
- if (s.is<ENTRY_NOT_FOUND>() || s.is<KEY_NOT_FOUND>()) {
+ if (s.is<KEY_NOT_FOUND>()) {
continue;
}
if (!s.ok() && !s.is<KEY_ALREADY_EXISTS>()) {
diff --git a/be/test/olap/primary_key_index_test.cpp
b/be/test/olap/primary_key_index_test.cpp
index 46b87b712d..42abaeadb1 100644
--- a/be/test/olap/primary_key_index_test.cpp
+++ b/be/test/olap/primary_key_index_test.cpp
@@ -129,7 +129,7 @@ TEST_F(PrimaryKeyIndexTest, builder) {
EXPECT_FALSE(exists);
auto status = index_iterator->seek_at_or_after(&slice, &exact_match);
EXPECT_FALSE(exact_match);
- EXPECT_TRUE(status.is<ErrorCode::END_OF_FILE>());
+ EXPECT_TRUE(status.is<ErrorCode::ENTRY_NOT_FOUND>());
}
// read all key
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]