This is an automated email from the ASF dual-hosted git repository.

kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 64466b8f2fbb74a9a66d28436e03318bb79f58d4
Author: zhannngchen <[email protected]>
AuthorDate: Tue Sep 26 20:32:23 2023 +0800

    [fix](merge-on-write) MergeIndexDeleteBitmapCalculator stack overflow 
(#24913)
---
 be/src/olap/delete_bitmap_calculator.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/be/src/olap/delete_bitmap_calculator.cpp 
b/be/src/olap/delete_bitmap_calculator.cpp
index a370f0c06bf..9be277d8742 100644
--- a/be/src/olap/delete_bitmap_calculator.cpp
+++ b/be/src/olap/delete_bitmap_calculator.cpp
@@ -120,6 +120,8 @@ bool 
MergeIndexDeleteBitmapCalculatorContext::Comparator::operator()(
 
 bool MergeIndexDeleteBitmapCalculatorContext::Comparator::is_key_same(Slice 
const& lhs,
                                                                       Slice 
const& rhs) const {
+    DCHECK(lhs.get_size() >= _sequence_length);
+    DCHECK(rhs.get_size() >= _sequence_length);
     auto lhs_without_seq = Slice(lhs.get_data(), lhs.get_size() - 
_sequence_length);
     auto rhs_without_seq = Slice(rhs.get_data(), rhs.get_size() - 
_sequence_length);
     return lhs_without_seq.compare(rhs_without_seq) == 0;
@@ -154,7 +156,7 @@ Status 
MergeIndexDeleteBitmapCalculator::calculate_one(RowLocation& loc) {
         _heap->pop();
         Slice cur_key;
         RETURN_IF_ERROR(cur_ctx->get_current_key(cur_key));
-        if (_comparator.is_key_same(cur_key, _last_key)) {
+        if (!_last_key.empty() && _comparator.is_key_same(cur_key, _last_key)) 
{
             loc.segment_id = cur_ctx->segment_id();
             loc.row_id = cur_ctx->row_id();
             auto st = cur_ctx->advance();


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to