From f2867168997bc2f5f3f558c80c4e345918a1c12e Mon Sep 17 00:00:00 2001 From: James Phillips Date: Wed, 25 Jan 2017 09:45:25 -0800 Subject: [PATCH] Tweaks a few comments. --- consul/fsm.go | 6 +++--- consul/rpc.go | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/consul/fsm.go b/consul/fsm.go index de77eac0f..6bfb10297 100644 --- a/consul/fsm.go +++ b/consul/fsm.go @@ -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 diff --git a/consul/rpc.go b/consul/rpc.go index 0c17ea5ec..cf7b55890 100644 --- a/consul/rpc.go +++ b/consul/rpc.go @@ -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.