Treat a uuid prefix lookup error as a soft error, as if a node name

lookup returned nil.

Add a TODO to note where a future point of logging should occur once a
logger is present and a few additional comments to explain the program
flow.
This commit is contained in:
Sean Chittenden 2017-02-01 15:51:25 -08:00
parent 62527c1698
commit c16f33402a
No known key found for this signature in database
GPG Key ID: 4EBC9DC16C2E5E16

View File

@ -710,16 +710,18 @@ func (s *StateStore) NodeServices(ws memdb.WatchSet, nodeNameOrID string) (uint6
// failing once a logger has been introduced to the catalog. // failing once a logger has been introduced to the catalog.
return 0, nil, nil return 0, nil, nil
} }
n = iter.Next() n = iter.Next()
if n == nil { if n == nil {
// No nodes matched, even with the Node ID: add a watch on the node name.
ws.Add(watchCh) ws.Add(watchCh)
return 0, nil, nil return 0, nil, nil
} }
idWatchCh := iter.WatchCh() idWatchCh := iter.WatchCh()
if iter.Next() != nil { if iter.Next() != nil {
// Watch on the channel that did a node name lookup if we don't find // More than one match present: Watch on the node name channel and return
// anything when searching by Node ID. // an empty result (node lookups can not be ambiguous).
ws.Add(watchCh) ws.Add(watchCh)
return 0, nil, nil return 0, nil, nil
} }