-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Automatically connect to a writer instance of PostgreSQL #40384
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
Automatically connect to a writer instance of PostgreSQL #40384
Conversation
b94241e
to
cd5f5df
Compare
@vmuzikar / @shawkins - I am trying to set a DB property by default similar to Lines 451 to 461 in 24910d9
but I didn't find a similar spot in Quarkus. When someone passes in a JDBC URL, there is no way good way I found intercept this to add a suffix. This also keep me wondering how much automation / magic should be done here. Still IMHO this is a very common reason why people struggle with the DB connection pools, as we've seen in support tickets. Is there a different way for this? cc: @sguilhen |
@ahus1 It should be possible to use the transformer for the DB_URL_PROPERTIES property mapper. It'd always append the |
@mabartos @ahus1 there is general quarkus mechanism via: quarkus.datasource.jdbc.additional-jdbc-properties.targetServerType=primary - but setting that only for pg would require some new logic, or less ideal it would have a side effect (setting a system property) of the db-kind propertymapper. |
Using |
411f85a
to
24c1183
Compare
I have a Quarkus Unit test KeycloakPathConfigurationTest#testAuthEndpointAvailable failing with
I did some debugging but without success. I would be happy for a pointer from the @keycloak/cloud-native team. |
This is due to it being a quarkus test - the test logic is performing a quarkus build, not our build command. Then because the option has a default - and it is currently forced to by this code keycloak/quarkus/config-api/src/main/java/org/keycloak/config/OptionBuilder.java Line 149 in f4d5fa6
From there it does not have a value because it will map to a null value. Not sure if there's a great way to inhibit the quarkus build, or not contribute our interceptors / configsources which are coming in from classpath mechanisms. |
afe12dd
to
ac7e1ff
Compare
@shawkins, thank you for the pointer. I changed the property to a String without a default, and then that one unit test passed. Let's wait for the full CI results. |
Build is now green, looking for a @keycloak/cloud-native team member to review when you have the time. Thanks! |
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.
@ahus1 Thanks for the PR.
quarkus/config-api/src/main/java/org/keycloak/config/DatabaseOptions.java
Outdated
Show resolved
Hide resolved
quarkus/config-api/src/main/java/org/keycloak/config/DatabaseOptions.java
Show resolved
Hide resolved
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.
LGTM, just a few things to improve it.
...rc/main/java/org/keycloak/quarkus/runtime/configuration/mappers/DatabasePropertyMappers.java
Outdated
Show resolved
Hide resolved
quarkus/runtime/src/test/java/org/keycloak/quarkus/runtime/configuration/ConfigurationTest.java
Outdated
Show resolved
Hide resolved
quarkus/runtime/src/test/java/org/keycloak/quarkus/runtime/configuration/ConfigurationTest.java
Outdated
Show resolved
Hide resolved
2d7c5cb
to
d406837
Compare
@mabartos - your review comments should now be addressed. Please re-review when you have the time. |
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.
Unreported flaky test detected, please review
Unreported flaky test detectedIf the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR. org.keycloak.testsuite.cluster.SessionFailoverClusterTest#sessionFailover
|
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.
@ahus1 LGTM in general, just a few "polishing" comments to have it fine :))
...rc/main/java/org/keycloak/quarkus/runtime/configuration/mappers/DatabasePropertyMappers.java
Outdated
Show resolved
Hide resolved
...rc/main/java/org/keycloak/quarkus/runtime/configuration/mappers/DatabasePropertyMappers.java
Outdated
Show resolved
Hide resolved
docs/documentation/upgrading/topics/changes/changes-26_4_0.adoc
Outdated
Show resolved
Hide resolved
Closes keycloak#40383 Co-authored-by: Václav Muzikář <vaclav@muzikari.cz> Co-authored-by: Martin Bartoš <mabartos@redhat.com> Co-authored-by: Alexander Schwartz <aschwart@redhat.com> Signed-off-by: Alexander Schwartz <alexander.schwartz@gmx.net>
2da429b
to
bb71905
Compare
@mabartos - your comments have been addressed. Please re-review. Thanks! |
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.
@ahus1 Nice, thanks! LGTM
@vmuzikar Do you want to do a final look? |
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.
LGTM, thank you @ahus1!
Closes #40383