Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v15] Add fallback to cache.GetAccessList call #41326

Merged
merged 2 commits into from
May 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion lib/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -2981,7 +2981,17 @@ func (c *Cache) GetAccessList(ctx context.Context, name string) (*accesslist.Acc
return nil, trace.Wrap(err)
}
defer rg.Release()
return rg.reader.GetAccessList(ctx, name)
item, err := rg.reader.GetAccessList(ctx, name)
if trace.IsNotFound(err) && rg.IsCacheRead() {
// release read lock early
rg.Release()
// fallback is sane because method is never used
// in construction of derivative caches.
if item, err := c.Config.AccessLists.GetAccessList(ctx, name); err == nil {
return item, nil
}
}
return item, trace.Wrap(err)
}

// CountAccessListMembers will count all access list members.
Expand Down
Loading