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 eeec26d68d [refactor](load) rename flush_memtable_and_wait to
flush_async (#23204)
eeec26d68d is described below
commit eeec26d68da01f86be0ed73ae6ad895b9385652d
Author: Kaijie Chen <[email protected]>
AuthorDate: Tue Aug 22 20:07:50 2023 +0800
[refactor](load) rename flush_memtable_and_wait to flush_async (#23204)
---
be/src/olap/memtable_memory_limiter.cpp | 2 +-
be/src/olap/memtable_writer.cpp | 15 +++------------
be/src/olap/memtable_writer.h | 11 ++++-------
3 files changed, 8 insertions(+), 20 deletions(-)
diff --git a/be/src/olap/memtable_memory_limiter.cpp
b/be/src/olap/memtable_memory_limiter.cpp
index 6c3981696c..9ef9d041ad 100644
--- a/be/src/olap/memtable_memory_limiter.cpp
+++ b/be/src/olap/memtable_memory_limiter.cpp
@@ -124,7 +124,7 @@ void MemTableMemoryLimiter::handle_memtable_flush() {
}
int64_t mem_size = mem_item.mem_size;
writers_to_reduce_mem.emplace_back(writer, mem_size);
- st = writer->flush_memtable_and_wait(false);
+ st = writer->flush_async();
if (!st.ok()) {
auto err_msg = fmt::format(
"tablet writer failed to reduce mem consumption by
flushing memtable, "
diff --git a/be/src/olap/memtable_writer.cpp b/be/src/olap/memtable_writer.cpp
index dfdf384184..955a961f0a 100644
--- a/be/src/olap/memtable_writer.cpp
+++ b/be/src/olap/memtable_writer.cpp
@@ -130,7 +130,7 @@ Status MemTableWriter::_flush_memtable_async() {
return _flush_token->submit(std::move(_mem_table));
}
-Status MemTableWriter::flush_memtable_and_wait(bool need_wait) {
+Status MemTableWriter::flush_async() {
std::lock_guard<std::mutex> l(_lock);
if (!_is_init || _is_closed) {
// This writer is uninitialized or closed before flushing, do nothing.
@@ -149,16 +149,7 @@ Status MemTableWriter::flush_memtable_and_wait(bool
need_wait) {
<< ", load id: " << print_id(_req.load_id);
auto s = _flush_memtable_async();
_reset_mem_table();
- if (UNLIKELY(!s.ok())) {
- return s;
- }
-
- if (need_wait) {
- // wait all memtables in flush queue to be flushed.
- SCOPED_RAW_TIMER(&_wait_flush_time_ns);
- RETURN_IF_ERROR(_flush_token->wait());
- }
- return Status::OK();
+ return s;
}
Status MemTableWriter::wait_flush() {
@@ -166,7 +157,7 @@ Status MemTableWriter::wait_flush() {
std::lock_guard<std::mutex> l(_lock);
if (!_is_init || _is_closed) {
// return OK instead of NOT_INITIALIZED or ALREADY_CLOSED for same
reason
- // as described in flush_memtable_and_wait()
+ // as described in flush_async()
return Status::OK();
}
if (_is_cancelled) {
diff --git a/be/src/olap/memtable_writer.h b/be/src/olap/memtable_writer.h
index e9ec3dc6fb..b374f10bde 100644
--- a/be/src/olap/memtable_writer.h
+++ b/be/src/olap/memtable_writer.h
@@ -91,16 +91,13 @@ public:
Status cancel();
Status cancel_with_status(const Status& st);
- // submit current memtable to flush queue, and wait all memtables in flush
queue
- // to be flushed.
- // This is currently for reducing mem consumption of this delta writer.
- // If need_wait is true, it will wait for all memtable in flush queue to
be flushed.
- // Otherwise, it will just put memtables to the flush queue and return.
- Status flush_memtable_and_wait(bool need_wait);
-
int64_t mem_consumption(MemType mem);
int64_t active_memtable_mem_consumption();
+ // Submit current memtable to flush queue, and return without waiting.
+ // This is currently for reducing mem consumption of this memtable writer.
+ Status flush_async();
+
// Wait all memtable in flush queue to be flushed
Status wait_flush();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]