-
Notifications
You must be signed in to change notification settings - Fork 5
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
event store #124
base: main
Are you sure you want to change the base?
event store #124
Conversation
Signed-off-by: Garth <[email protected]>
Signed-off-by: Garth <[email protected]>
Signed-off-by: Garth <[email protected]>
Signed-off-by: Garth <[email protected]>
Signed-off-by: Garth <[email protected]>
… the results we are skipping. Signed-off-by: Garth <[email protected]>
…ges. Signed-off-by: Garth <[email protected]>
Signed-off-by: Garth <[email protected]>
Signed-off-by: Garth <[email protected]>
Signed-off-by: Garth <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please squash your commits to one.
@@ -164,9 +172,20 @@ public void init(Config.Scope scope) { | |||
repository = createRepository(cqlSession); | |||
} | |||
|
|||
public CqlSessionBuilder configure(CqlSessionBuilder cqlSessionBuilder) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be done with external file based configuration and not hardcoded
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @opdt I was having problems getting the migration to run in the tests without a timeout. Can you point me to some documentation/examples of how this is achieved using external file based configuration? I'm not super familiar with cassandra, so the options are new to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been struggling to figure out how to load an external file based configuration @opdt. Is there an example you're aware of?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finally figured out how to load config from a file. I have a branch here, so let me know if you want me to do a separate PR. https://github.com/opdt/keycloak-cassandra-extension/compare/main...xgp:keycloak-cassandra-extension:xgp/config-file?expand=1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You dont need any custom code to load the config from a file. The cassandra driver does it automatically: https://docs.datastax.com/en/developer/java-driver/4.17/manual/core/configuration/ (application.conf in Classpath)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. But if you want to allow it to be put somewhere else and not bundled with the jar, then you have to tell Cassandra where to load it from.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example, I might want to have k8s mount the conf file in the pod and then need to tell the extension where to load it from. This decouples the configuration from the library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats possible via -Dconfig.file=/path/to/application.conf
via the underyling Lightbend configuration library (which also supports loading from other resources/URLs).
You can pass additional Java arguments via JAVA_OPTS_APPEND
environment variable in Keycloak.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem I encounter when I specify that is that the init method still runs. So even though the underlying library supports the -Dconfig.file
override, it appears that it never gets there because of the exceptions thrown when the variables are missing.
Also, if I set both, the variables in the config scope are what gets used.
...java/de/arbeitsagentur/opdt/keycloak/cassandra/event/CassandraEventStoreProviderFactory.java
Outdated
Show resolved
Hide resolved
...a/de/arbeitsagentur/opdt/keycloak/cassandra/event/persistence/entities/AdminEventEntity.java
Outdated
Show resolved
Hide resolved
...n/java/de/arbeitsagentur/opdt/keycloak/cassandra/event/persistence/entities/EventEntity.java
Outdated
Show resolved
Hide resolved
Thank you @opdt Most requested updates made. I'll squash once we're done with all the changes. Please see my comments on two of the issues and let me know your answers/recommendations. |
Adding an
EventStoreProvider
implementation per #3Submitting a DRAFT PR for feedback.
Current issues:
Schema questions
Need feedback on the schema, as I'm not experienced with Cassandra https://github.com/xgp/keycloak-cassandra-extension/blob/xgp/event-store/core/src/main/resources/cassandra/migration/0003_events.cql
Admin event
resourcePath
LIKEBecause
LIKE
queries require secondary indexes to be enabled in Cassandra, they are not currently supported for queryingresourcePath
of admin events.Query performance
Performance of event queries using sparse fields (i.e. those generated by the Admin UI) are not performant, as Cassandra is forced to use
ALLOW FILTERING
. Future work could include a separate lookup table with client-side result filtering.Pagination performance
Because Cassandra does not support OFFSET/LIMIT type queries, this is done in Java. This will likely consume significant resources for large event result sets.