-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add CachingGroupProviderModule to trino-plugin-toolkit #18174
Conversation
cd9a62a
to
974b8b7
Compare
The test failure is caused by the test removed in #18202. |
Let's provide a caching in the plugin toolkit and then we could apply caching to specific group providers where caching is needed only. |
974b8b7
to
8fa87c9
Compare
Pushed a second version. PTAL. |
c519115
to
569ce68
Compare
lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/group/CachingGroupProvider.java
Outdated
Show resolved
Hide resolved
...rino-plugin-toolkit/src/main/java/io/trino/plugin/base/group/CachingGroupProviderModule.java
Show resolved
Hide resolved
lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/group/GroupProviderConfig.java
Outdated
Show resolved
Hide resolved
...rino-plugin-toolkit/src/main/java/io/trino/plugin/base/group/CachingGroupProviderModule.java
Outdated
Show resolved
Hide resolved
...rino-plugin-toolkit/src/main/java/io/trino/plugin/base/group/CachingGroupProviderConfig.java
Show resolved
Hide resolved
lib/trino-plugin-toolkit/src/test/java/io/trino/plugin/base/group/TestCachingGroupProvider.java
Show resolved
Hide resolved
184e6fe
to
1e39460
Compare
Added the ability to invalidate individual keys or all of the cache. |
Oh, and the first commit is refactored somewhat :) |
1e39460
to
28493ab
Compare
ff64aae
to
35c091b
Compare
I believe this is now fully ready for review. |
Flaky hit: #18392 (already fixed, rebase needed) |
35c091b
to
8ae67a8
Compare
This pull request has gone a while without any activity. Tagging the Trino developer relations team: @bitsondatadev @colebow @mosabua |
@mosabua I believe this has stalled because this has the most value with Group Providers that are not (yet) in Trino itself. I am aware of 2 (two) proposed PRs to add an LDAP Group Provider and it may be valuable for them, but one of them has also stalled and the other I haven't looked at yet to see if it does any "native" caching. |
I will leave it in your hands to decide how to proceed @ksobolew ;-) |
This pull request has gone a while without any activity. Tagging the Trino developer relations team: @bitsondatadev @colebow @mosabua |
This Guice Module can be used to enable caching in the group provider, by adding it to the list of modules in a Guice context in a group provider factory, or to any other Guice context as needed. Features: * Configurable configuration prefix * Ability to bind the final `GroupProvider` with a custom binding annotation * useful especially when the Guice context is not entirely isolated and there are other `GroupProvider` bindings in it * An `@Inject`-able hook for cache invalidation
8ae67a8
to
88dd9e6
Compare
This pull request has gone a while without any activity. Tagging the Trino developer relations team: @bitsondatadev @colebow @mosabua |
This work has been technically merged into #20157, but it seems that one has also stalled. |
This pull request has gone a while without any activity. Tagging the Trino developer relations team: @bitsondatadev @colebow @mosabua |
Closing this pull request, as it has been stale for six weeks. Feel free to re-open at any time. |
Description
If added to the list of
Module
s used in initialization of a Guice context in aGroupProviderFactory
, it will (almost) automatically add caching capability to the group provider. Requirements:GroupProvider
available in the Guice context must be bound annotated with@ForCachingGroupProvider
binding annotationThe module will make the following configuration options available (to be set in
etc/group-provider.properties
:<prefix>.cache.enabled
- the toggle to enable or disable caching<prefix>.cache.ttl
- determines how long group information will be cached for each user<prefix>.cache.maximum-size
- maximum number of users for which groups are stored in the cacheWhere
<prefix>
is optional and configurable. Also configurable is a binding annotation with which the "output"GroupProvider
interface will be bound (useful in some cases when the module is not strictly isolated).Release notes
( ) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
(x) Release notes are required, with the following suggested text: