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

dataroaring 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 c2eabbd4410 [fix](load) fix nullptr when getting memtable flush 
running count (#28942)
c2eabbd4410 is described below

commit c2eabbd441021732560d1e81365fb6e29fb812fd
Author: Kaijie Chen <c...@apache.org>
AuthorDate: Mon Dec 25 13:49:18 2023 +0800

    [fix](load) fix nullptr when getting memtable flush running count (#28942)
    
    * [fix](load) fix nullptr when getting memtable flush running count
    
    * style
---
 be/src/olap/delta_writer.cpp    | 3 +--
 be/src/olap/delta_writer_v2.cpp | 4 +---
 be/src/olap/memtable_writer.cpp | 4 ++++
 be/src/olap/memtable_writer.h   | 2 ++
 4 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/be/src/olap/delta_writer.cpp b/be/src/olap/delta_writer.cpp
index 1c2f24ae6d9..f49a68985d8 100644
--- a/be/src/olap/delta_writer.cpp
+++ b/be/src/olap/delta_writer.cpp
@@ -126,8 +126,7 @@ Status BaseDeltaWriter::write(const vectorized::Block* 
block, const std::vector<
     if (!_is_init && !_is_cancelled) {
         RETURN_IF_ERROR(init());
     }
-    while (_memtable_writer->get_flush_token_stats().flush_running_count >=
-           config::memtable_flush_running_count_limit) {
+    while (_memtable_writer->flush_running_count() >= 
config::memtable_flush_running_count_limit) {
         std::this_thread::sleep_for(std::chrono::milliseconds(10));
     }
     return _memtable_writer->write(block, row_idxs, is_append);
diff --git a/be/src/olap/delta_writer_v2.cpp b/be/src/olap/delta_writer_v2.cpp
index cfe059f1890..bca1213b047 100644
--- a/be/src/olap/delta_writer_v2.cpp
+++ b/be/src/olap/delta_writer_v2.cpp
@@ -37,7 +37,6 @@
 #include "gutil/strings/numbers.h"
 #include "io/fs/file_writer.h" // IWYU pragma: keep
 #include "olap/data_dir.h"
-#include "olap/memtable_flush_executor.h"
 #include "olap/olap_define.h"
 #include "olap/rowset/beta_rowset.h"
 #include "olap/rowset/beta_rowset_writer_v2.h"
@@ -153,8 +152,7 @@ Status DeltaWriterV2::write(const vectorized::Block* block, 
const std::vector<ui
     if (!_is_init && !_is_cancelled) {
         RETURN_IF_ERROR(init());
     }
-    while (_memtable_writer->get_flush_token_stats().flush_running_count >=
-           config::memtable_flush_running_count_limit) {
+    while (_memtable_writer->flush_running_count() >= 
config::memtable_flush_running_count_limit) {
         std::this_thread::sleep_for(std::chrono::milliseconds(10));
     }
     SCOPED_RAW_TIMER(&_write_memtable_time);
diff --git a/be/src/olap/memtable_writer.cpp b/be/src/olap/memtable_writer.cpp
index 1faed6c328b..c967cdbd483 100644
--- a/be/src/olap/memtable_writer.cpp
+++ b/be/src/olap/memtable_writer.cpp
@@ -345,6 +345,10 @@ const FlushStatistic& 
MemTableWriter::get_flush_token_stats() {
     return _flush_token->get_stats();
 }
 
+uint64_t MemTableWriter::flush_running_count() const {
+    return _flush_token == nullptr ? 0 : 
_flush_token->get_stats().flush_running_count.load();
+}
+
 int64_t MemTableWriter::mem_consumption(MemType mem) {
     if (!_is_init) {
         // This method may be called before this writer is initialized.
diff --git a/be/src/olap/memtable_writer.h b/be/src/olap/memtable_writer.h
index c5459c09065..a2687d9402c 100644
--- a/be/src/olap/memtable_writer.h
+++ b/be/src/olap/memtable_writer.h
@@ -109,6 +109,8 @@ public:
 
     const FlushStatistic& get_flush_token_stats();
 
+    uint64_t flush_running_count() const;
+
 private:
     // push a full memtable to flush executor
     Status _flush_memtable_async();


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

Reply via email to