From d15487656cdb590ce9bb55ae127fb2b22a7c55d8 Mon Sep 17 00:00:00 2001 From: groot Date: Tue, 23 Jun 2020 15:30:21 +0800 Subject: [PATCH] fix potential problem (#2657) Signed-off-by: yhmo --- core/src/db/DBImpl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/db/DBImpl.cpp b/core/src/db/DBImpl.cpp index e1d689caba..722c14b352 100644 --- a/core/src/db/DBImpl.cpp +++ b/core/src/db/DBImpl.cpp @@ -2538,7 +2538,7 @@ DBImpl::ExecWalRecord(const wal::MXLogRecord& record) { auto collections_flushed = [&](const std::string collection_id, const std::set& target_collection_names) -> uint64_t { uint64_t max_lsn = 0; - if (options_.wal_enable_) { + if (options_.wal_enable_ && !target_collection_names.empty()) { uint64_t lsn = 0; for (auto& collection : target_collection_names) { meta_ptr_->GetCollectionFlushLSN(collection, lsn); @@ -2737,7 +2737,7 @@ DBImpl::BackgroundWalThread() { if (options_.auto_flush_interval_ > 0) { next_auto_flush_time = get_next_auto_flush_time(); } - + InternalFlush(); while (true) { if (options_.auto_flush_interval_ > 0) { if (std::chrono::system_clock::now() >= next_auto_flush_time) {