-
Notifications
You must be signed in to change notification settings - Fork 660
Closed
Description
I noticed this code:
updates, cancel, err := store.ViewAndWatch(
s.store,
func(readTx store.ReadTx) error {
clusters, err := store.FindClusters(readTx, store.ByName(store.DefaultClusterName))
if err != nil {
return err
}
if len(clusters) != 1 {
return errors.New("could not find cluster object")
}
s.UpdateRootCA(ctx, clusters[0]) // call once to ensure that the join tokens are always set
nodes, err = store.FindNodes(readTx, store.All)
return err
},
api.EventCreateNode{},
api.EventUpdateNode{},
api.EventDeleteNode{},
)s.UpdateRootCA does some file I/O when it saves the root CA cert. It also acquires another lock.
ViewAndWatch holds the raft lock to give a strong consistency guarantee that the caller won't receive events whose effects were already visible in the View portion, but I'm not sure this code needs this guarantee.
cc @cyli
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels