mirror of
https://github.com/talent-plan/tinykv.git
synced 2025-01-13 13:50:43 +08:00
return nil when genearte snapshot failed (#206)
Co-authored-by: Connor <zbk602423539@gmail.com>
This commit is contained in:
parent
3513f5d1b4
commit
cb91131143
@ -156,7 +156,9 @@ func (ps *PeerStorage) Snapshot() (eraftpb.Snapshot, error) {
|
||||
if ps.snapState.StateType == snap.SnapState_Generating {
|
||||
select {
|
||||
case s := <-ps.snapState.Receiver:
|
||||
snapshot = *s
|
||||
if s != nil {
|
||||
snapshot = *s
|
||||
}
|
||||
default:
|
||||
return snapshot, raft.ErrSnapshotTemporarilyUnavailable
|
||||
}
|
||||
|
@ -82,6 +82,7 @@ func (snapCtx *snapContext) handleGen(regionId uint64, notifier chan<- *eraftpb.
|
||||
snap, err := doSnapshot(snapCtx.engines, snapCtx.mgr, regionId)
|
||||
if err != nil {
|
||||
log.Errorf("failed to generate snapshot!!!, [regionId: %d, err : %v]", regionId, err)
|
||||
notifier <- nil
|
||||
} else {
|
||||
notifier <- snap
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user