enhance(metanode).add interface of IsRestoring to raft store for better performace while do IsFollowerRead jugement

Signed-off-by: leonrayang <chl696@sina.com>
This commit is contained in:
leonrayang 2023-08-30 19:52:23 +08:00 committed by Whale Tang
parent 179b964033
commit 9db9e6ed1f
2 changed files with 2 additions and 3 deletions

View File

@ -222,7 +222,7 @@ func (rs *RaftServer) IsRestoring(id uint64) bool {
rs.mu.RLock()
defer rs.mu.RUnlock()
if raft, ok := rs.rafts[id]; ok {
return raft.restoringSnapshot.Get() || raft.applied() == 0
return raft.restoringSnapshot.Get() && raft.applied() == 0
}
return true
}

View File

@ -900,8 +900,7 @@ func (mp *metaPartition) IsFollowerRead() (ok bool) {
return false
}
status := mp.raftPartition.Status()
if status == nil || status.RestoringSnapshot || status.Applied == 0 {
if mp.raftPartition.IsRestoring() {
return false
}