From e897ad60fa4a6c88e38a007bfbbff23a11f01f4b Mon Sep 17 00:00:00 2001 From: Doodle <13706157+critical27@users.noreply.github.com> Date: Tue, 12 Apr 2022 18:00:10 +0800 Subject: [PATCH] skip leader lease check in snapshot manager (#793) Co-authored-by: Sophie <84560950+Sophie-Xie@users.noreply.github.com> --- src/kvstore/NebulaSnapshotManager.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/kvstore/NebulaSnapshotManager.cpp b/src/kvstore/NebulaSnapshotManager.cpp index cf2df2dd828..440f612096e 100644 --- a/src/kvstore/NebulaSnapshotManager.cpp +++ b/src/kvstore/NebulaSnapshotManager.cpp @@ -92,9 +92,9 @@ nebula::cpp2::ErrorCode NebulaSnapshotManager::prefixScan(Part* part, const std::string& prefix, std::unique_ptr* iter, const void* snapshot) { - if (!part->isLeader() || !part->leaseValid()) { - return nebula::cpp2::ErrorCode::E_LEADER_CHANGED; - } + // Use kv-engine directly to avoid acquire lock in kvstore, and we **DO NOT** check leader lease: + // 1. To avoid lots of snapshot impact leader stability + // 2. The snapshot of state machine could be applied to other nodes even if leader has changed return part->engine()->prefix(prefix, iter, snapshot); }