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

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


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 66565085796 [fix](agg) fix DCHECK failure of agg when failed to alloc 
memory (#35011)
66565085796 is described below

commit 665650857961b335376d97e8611069da31e00050
Author: TengJianPing <[email protected]>
AuthorDate: Mon May 20 10:10:11 2024 +0800

    [fix](agg) fix DCHECK failure of agg when failed to alloc memory (#35011)
    
    * [fix](agg) fix DCHECK failure of agg when failed to alloc memory
    
    * add comment
---
 be/src/vec/common/string_buffer.hpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/be/src/vec/common/string_buffer.hpp 
b/be/src/vec/common/string_buffer.hpp
index 84f0dffbff7..3be04ad15e6 100644
--- a/be/src/vec/common/string_buffer.hpp
+++ b/be/src/vec/common/string_buffer.hpp
@@ -40,10 +40,12 @@ public:
         _now_offset += 1;
     }
 
-    inline void commit() {
-        ColumnString::check_chars_length(_offsets.back() + _now_offset, 0);
-        _offsets.push_back(_offsets.back() + _now_offset);
+    void commit() {
+        auto now_offset = _now_offset;
         _now_offset = 0;
+        // the following code may throw exception, and DCHECK in destructor 
will fail if _now_offset is not reset to 0
+        ColumnString::check_chars_length(_offsets.back() + now_offset, 0);
+        _offsets.push_back(_offsets.back() + now_offset);
     }
 
     ~BufferWritable() { DCHECK(_now_offset == 0); }


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

Reply via email to