This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch opt_memtable_speed in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/opt_memtable_speed by this push: new 0b2f50a36a [fix](load) fix nullptr when memtable limiter flush (#23158) 0b2f50a36a is described below commit 0b2f50a36a6587451eec991ae8b6b2f6e1bd9dee Author: Kaijie Chen <c...@apache.org> AuthorDate: Fri Aug 18 12:22:35 2023 +0800 [fix](load) fix nullptr when memtable limiter flush (#23158) --- be/src/olap/memtable_flush_executor.cpp | 2 +- be/src/olap/memtable_writer.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/be/src/olap/memtable_flush_executor.cpp b/be/src/olap/memtable_flush_executor.cpp index 70cd74e214..c46b02cd02 100644 --- a/be/src/olap/memtable_flush_executor.cpp +++ b/be/src/olap/memtable_flush_executor.cpp @@ -72,7 +72,7 @@ Status FlushToken::submit(std::unique_ptr<MemTable> mem_table) { if (s != OK) { return Status::Error(s, "FlushToken meet error"); } - if (mem_table->empty()) { + if (mem_table == nullptr || mem_table->empty()) { return Status::OK(); } int64_t submit_task_time = MonotonicNanos(); diff --git a/be/src/olap/memtable_writer.cpp b/be/src/olap/memtable_writer.cpp index 5434e918e3..dfdf384184 100644 --- a/be/src/olap/memtable_writer.cpp +++ b/be/src/olap/memtable_writer.cpp @@ -132,9 +132,9 @@ Status MemTableWriter::_flush_memtable_async() { Status MemTableWriter::flush_memtable_and_wait(bool need_wait) { std::lock_guard<std::mutex> l(_lock); - if (!_is_init) { - // This writer is not initialized before flushing. Do nothing - // But we return OK instead of Status::Error<ALREADY_CANCELLED>(), + if (!_is_init || _is_closed) { + // This writer is uninitialized or closed before flushing, do nothing. + // We return OK instead of NOT_INITIALIZED or ALREADY_CLOSED. // Because this method maybe called when trying to reduce mem consumption, // and at that time, the writer may not be initialized yet and that is a normal case. return Status::OK(); @@ -164,8 +164,8 @@ Status MemTableWriter::flush_memtable_and_wait(bool need_wait) { Status MemTableWriter::wait_flush() { { std::lock_guard<std::mutex> l(_lock); - if (!_is_init) { - // return OK instead of Status::Error<ALREADY_CANCELLED>() for same reason + if (!_is_init || _is_closed) { + // return OK instead of NOT_INITIALIZED or ALREADY_CLOSED for same reason // as described in flush_memtable_and_wait() return Status::OK(); } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org