state: sunken token fallback_req logging and case fixup (#1)

pull/12560/head
John A. Lotoski 3 years ago committed by GitHub
parent 298cbc2a6f
commit 15bc463a87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1315,7 +1315,7 @@ func (l *State) deleteService(key structs.ServiceID) error {
var out struct{} var out struct{}
err := l.Delegate.RPC("Catalog.Deregister", &fallback_req, &out) err := l.Delegate.RPC("Catalog.Deregister", &fallback_req, &out)
switch { switch {
case err == nil: case err == nil || strings.Contains(err.Error(), "Unknown service"):
delete(l.services, key) delete(l.services, key)
// service deregister also deletes associated checks // service deregister also deletes associated checks
for _, c := range l.checks { for _, c := range l.checks {
@ -1326,10 +1326,19 @@ func (l *State) deleteService(key structs.ServiceID) error {
} }
} }
} }
l.logger.Info("Deregistered service", "service", key.ID) l.logger.Info("Deregistered service with fallback_req", "service", key.ID)
return nil
case acl.IsErrPermissionDenied(err):
// todo(fs): mark the service to be in sync to prevent excessive retrying before next full sync
// todo(fs): some backoff strategy might be a better solution
l.services[key].InSync = true
accessorID := l.aclAccessorID(st)
l.logger.Warn("Service deregistration blocked by ACLs with fallback_req", "service", key.String(), "accessorID", accessorID)
metrics.IncrCounter([]string{"acl", "blocked", "service", "deregistration"}, 1)
return nil return nil
default: default:
l.logger.Warn("Deregistering service failed.", l.logger.Warn("Deregistering service failed with fallback_req.",
"service", key.String(), "service", key.String(),
"error", err, "error", err,
) )
@ -1542,17 +1551,25 @@ func (l *State) syncCheck(key structs.CheckID) error {
// Given how the register API works, this info is also updated // Given how the register API works, this info is also updated
// every time we sync a check. // every time we sync a check.
l.nodeInfoInSync = true l.nodeInfoInSync = true
l.logger.Info("Synced check", "check", key.String()) l.logger.Info("Synced check with fallback_req", "check", key.String())
return nil
case acl.IsErrPermissionDenied(err):
// todo(fs): mark the check to be in sync to prevent excessive retrying before next full sync
// todo(fs): some backoff strategy might be a better solution
l.checks[key].InSync = true
accessorID := l.aclAccessorID(ct)
l.logger.Warn("Check registration blocked by ACLs with fallback_req", "check", key.String(), "accessorID", accessorID)
metrics.IncrCounter([]string{"acl", "blocked", "check", "registration"}, 1)
return nil return nil
default: default:
l.logger.Warn("Syncing check failed.", l.logger.Warn("Syncing check failed with fallback_req.",
"check", key.String(), "check", key.String(),
"error", err, "error", err,
) )
return err return err
} }
case acl.IsErrPermissionDenied(err), acl.IsErrNotFound(err): case acl.IsErrPermissionDenied(err):
// todo(fs): mark the check to be in sync to prevent excessive retrying before next full sync // todo(fs): mark the check to be in sync to prevent excessive retrying before next full sync
// todo(fs): some backoff strategy might be a better solution // todo(fs): some backoff strategy might be a better solution
l.checks[key].InSync = true l.checks[key].InSync = true

Loading…
Cancel
Save