mirror of https://github.com/milvus-io/milvus.git
fix write node snapshot eject logic bug (#4523)
* fix snapshot eject logic error for write node Signed-off-by: XuPeng-SH <xupeng3112@163.com> * fix code static check Signed-off-by: XuPeng-SH <xupeng3112@163.com> Signed-off-by: shengjun.li <shengjun.li@zilliz.com>pull/4533/head^2
parent
ee6693d133
commit
d07ae649d5
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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::milliseconds>(std::chrono::high_resolution_clock::now() - start)
|
||||
std::chrono::duration_cast<std::chrono::microseconds>(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";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue