diff --git a/core/src/db/snapshot/SnapshotHolder.cpp b/core/src/db/snapshot/SnapshotHolder.cpp index 6a9bfebbd1..70c70fb85c 100644 --- a/core/src/db/snapshot/SnapshotHolder.cpp +++ b/core/src/db/snapshot/SnapshotHolder.cpp @@ -206,7 +206,7 @@ SnapshotHolder::Add(StorePtr store, ID_TYPE id) { LOG_SERVER_DEBUG_ << "SSLoad CCID=" << id << " for CID=" << ss->GetCollectionId() << " CNAME=" << ss->GetName(); active_[id] = ss; IDS_TYPE to_eject; - if (policy_->ShouldEject(active_, to_eject, false) == 0) { + if (policy_->ShouldEject(active_, to_eject, true) == 0) { return status; } for (auto& id : to_eject) { diff --git a/core/src/db/snapshot/SnapshotPolicy.cpp b/core/src/db/snapshot/SnapshotPolicy.cpp index 43d5c75459..5e11fc8a86 100644 --- a/core/src/db/snapshot/SnapshotPolicy.cpp +++ b/core/src/db/snapshot/SnapshotPolicy.cpp @@ -56,7 +56,7 @@ SnapshotDurationPolicy::ShouldEject(const MapT& ids, IDS_TYPE& to_eject, bool al auto now_us = GetMicroSecTimeStamp(); auto max_id = ids.rbegin()->first; for (auto& [id, ss] : ids) { - if ((now_us - ss->GetCollectionCommit()->GetCreatedTime() < us_) && (id != max_id)) { + if ((now_us - ss->GetCollectionCommit()->GetCreatedTime() > us_) && (!alive || id != max_id)) { to_eject.push_back(id); } } diff --git a/core/src/db/snapshot/Snapshots.cpp b/core/src/db/snapshot/Snapshots.cpp index 2319089073..97a5cf33d8 100644 --- a/core/src/db/snapshot/Snapshots.cpp +++ b/core/src/db/snapshot/Snapshots.cpp @@ -25,7 +25,7 @@ namespace milvus::engine::snapshot { -static constexpr int DEFAULT_READER_TIMER_INTERVAL_US = 60 * 1000; +static constexpr int DEFAULT_READER_TIMER_INTERVAL_US = 100 * 1000; static constexpr int DEFAULT_WRITER_TIMER_INTERVAL_US = 2000 * 1000; Status @@ -345,10 +345,10 @@ Snapshots::OnReaderTimer(const boost::system::error_code& ec) { holders_.erase(cid); } auto exe_time = - std::chrono::duration_cast(std::chrono::high_resolution_clock::now() - start) + std::chrono::duration_cast(std::chrono::high_resolution_clock::now() - start) .count(); if (exe_time > DEFAULT_READER_TIMER_INTERVAL_US) { - LOG_ENGINE_WARNING_ << "OnReaderTimer takes too much time: " << exe_time << " ms"; + LOG_ENGINE_WARNING_ << "OnReaderTimer takes too much time: " << exe_time << " us"; } }