Tweaks a few comments.

This commit is contained in:
James Phillips 2017-01-25 09:45:25 -08:00
parent 8fcf695fa1
commit f286716899
No known key found for this signature in database
GPG Key ID: 77183E682AC5FC11
2 changed files with 7 additions and 4 deletions

View File

@ -28,8 +28,8 @@ type consulFSM struct {
// stateLock is only used to protect outside callers to State() from
// racing with Restore(), which is called by Raft (it puts in a totally
// new state store). Everything else is synchronized by the Raft side,
// so doesn't need to lock this.
// new state store). Everything internal here is synchronized by the
// Raft side, so doesn't need to lock this.
stateLock sync.RWMutex
state *state.StateStore
@ -336,7 +336,7 @@ func (c *consulFSM) Restore(old io.ReadCloser) error {
// The old state store has been abandoned already since we've replaced
// it with an empty one, but we defer telling watchers about it until
// the restore is done, so they wake up one we have the latest data.
// the restore is done, so they wake up once we have the latest data.
defer stateOld.Abandon()
// Set up a new restore transaction

View File

@ -354,7 +354,10 @@ func (s *Server) raftApply(t structs.MessageType, msg interface{}) (interface{},
}
// queryFn is used to perform a query operation. If a re-query is needed, the
// passed-in watch set will be used to block for changes.
// passed-in watch set will be used to block for changes. The passed-in state
// store should be used (vs. calling fsm.State()) since the given state store
// will be correctly watched for changes if the state store is restored from
// a snapshot.
type queryFn func(memdb.WatchSet, *state.StateStore) error
// blockingQuery is used to process a potentially blocking query operation.