You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Most implementations[1][2] of raft StableStore interface; when you do a get for a key and the value returned happens to be a nil []byte, then they return an error.
Since we are using StableStore interface to persist (ballots and state), we need to check if the state exists(ie do a get). But instead of throwing an error if state is nil []byte, we need to 'catch' it and set it to nil.
state, err:=a.acceptorStore.Get(key)
iferr!=nil&&err.Error() =="not found" {
state, err=nil, nil
}
iferr!=nil {
returnacceptorState{}, errors.Wrap(err, fmt.Sprintf("unable to get state for key:%v from acceptor:%v", key, a.ID))
}
it looks hideous and should be replaced with something better.
ref:
The text was updated successfully, but these errors were encountered: