You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2022/05/16 16:39:24 UTC

[incubator-doris] 14/17: [bugfix](load) fix coredump in ordinal index flush (#9518)

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

morningman pushed a commit to branch dev-1.0.1
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git

commit ff4f4a3f1bfccd03d15903146bcac69626ffc6c5
Author: yixiutt <10...@users.noreply.github.com>
AuthorDate: Thu May 12 21:10:49 2022 +0800

    [bugfix](load) fix coredump in ordinal index flush (#9518)
    
    commit #9123 introduce the bug. bitshuffle page return error when
    page is full, so scalar column write cannot switch to next page, which make
    ordinal index is null when flush.
    
    All page builder should return ok when page full, and column writer procedure
    shoud be append_data, check is_page_full, switch to next page
    
    Co-authored-by: yixiutt <yi...@selectdb.com>
---
 be/src/olap/rowset/segment_v2/binary_dict_page.cpp | 6 +++---
 be/src/olap/rowset/segment_v2/bitshuffle_page.h    | 2 +-
 be/src/olap/rowset/segment_v2/page_builder.h       | 4 +++-
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/be/src/olap/rowset/segment_v2/binary_dict_page.cpp b/be/src/olap/rowset/segment_v2/binary_dict_page.cpp
index 9cee35f997..7a62f74c6a 100644
--- a/be/src/olap/rowset/segment_v2/binary_dict_page.cpp
+++ b/be/src/olap/rowset/segment_v2/binary_dict_page.cpp
@@ -76,13 +76,13 @@ Status BinaryDictPageBuilder::add(const uint8_t* vals, size_t* count) {
         }
 
         for (int i = 0; i < *count; ++i, ++src) {
+            if (is_page_full()) {
+                break;
+            }
             auto iter = _dictionary.find(*src);
             if (iter != _dictionary.end()) {
                 value_code = iter->second;
             } else {
-                if (_dict_builder->is_page_full()) {
-                    break;
-                }
                 Slice dict_item(src->data, src->size);
                 if (src->size > 0) {
                     char* item_mem = (char*)_pool.allocate(src->size);
diff --git a/be/src/olap/rowset/segment_v2/bitshuffle_page.h b/be/src/olap/rowset/segment_v2/bitshuffle_page.h
index 9bada3f764..bfd85217f5 100644
--- a/be/src/olap/rowset/segment_v2/bitshuffle_page.h
+++ b/be/src/olap/rowset/segment_v2/bitshuffle_page.h
@@ -105,7 +105,7 @@ public:
         DCHECK(!_finished);
         if (_remain_element_capacity <= 0) {
             *count = 0;
-            return Status::RuntimeError("page is full.");
+            return Status::OK();
         }
         int to_add = std::min<int>(_remain_element_capacity, *count);
         int to_add_size = to_add * SIZE_OF_TYPE;
diff --git a/be/src/olap/rowset/segment_v2/page_builder.h b/be/src/olap/rowset/segment_v2/page_builder.h
index 26eec4b430..ab74ad7fca 100644
--- a/be/src/olap/rowset/segment_v2/page_builder.h
+++ b/be/src/olap/rowset/segment_v2/page_builder.h
@@ -49,7 +49,9 @@ public:
     // Add a sequence of values to the page.
     // The number of values actually added will be returned through count, which may be less
     // than requested if the page is full.
-    //
+
+    // check page if full before truly add, return ok when page is full so that column write
+    // will switch to next page
     // vals size should be decided according to the page build type
     // TODO make sure vals is naturally-aligned to its type so that impls can use aligned load
     // instead of memcpy to copy values.


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org