diff --git a/kv/urm.go b/kv/urm.go index 13c77d14a3d..358c37a394d 100644 --- a/kv/urm.go +++ b/kv/urm.go @@ -195,13 +195,16 @@ func (s *Service) findUserResourceMappingsByIndex(ctx context.Context, tx Tx, fi } for k, v := cursor.Next(); k != nil && v != nil; k, v = cursor.Next() { - v, err := bkt.Get(v) + nv, err := bkt.Get(v) if err != nil { - return nil, err + return nil, &influxdb.Error{ + Code: influxdb.ENotFound, + Err: err, + } } m := &influxdb.UserResourceMapping{} - if err := json.Unmarshal(v, m); err != nil { + if err := json.Unmarshal(nv, m); err != nil { return nil, CorruptURMError(err) } @@ -531,11 +534,13 @@ func (s *Service) deleteOrgDependentMappings(ctx context.Context, tx Tx, m *infl return err } for _, b := range bs { - if err := s.deleteUserResourceMapping(ctx, tx, influxdb.UserResourceMappingFilter{ + filter := influxdb.UserResourceMappingFilter{ ResourceType: influxdb.BucketsResourceType, ResourceID: b.ID, UserID: m.UserID, - }); err != nil { + } + + if err := s.deleteUserResourceMapping(ctx, tx, filter); err != nil { if influxdb.ErrorCode(err) == influxdb.ENotFound { s.log.Info("URM bucket is missing", zap.Stringer("orgID", m.ResourceID)) continue