-
Bug
-
Resolution: Done
-
Undefined
-
None
Before reporting an issue
[x] I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.
Area
core
Describe the bug
When trying to update a Keycloak instance from 26.3.5 to 26.4.4, CustomCreateIndexChange froze the Keycloak boot because of the following SQL query:
SELECT COUNT(*) FROM public.EVENT_ENTITY
The jstack pinpointed https://github.com/keycloak/keycloak/blob/39c4c1ed942a4bdcc0a3c4d68a9b853a082ea9a2/model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/custom/CustomCreateIndexChange.java#L82-L82 .
In this instance, table EVENT_ENTITY is huge with many records. The count request is very slow.
I guess that, ironically, CustomCreateIndexChange performs this count to avoid triggering an index creation that would take too much time.
Version
26.4.4
Regression
[ ] The issue is a regression
Expected behavior
Keycloak automatic database update should take a reasonable amount of time.
Actual behavior
Keycloak automatic database update hangs forever.
How to Reproduce?
Make sure to have a huge EVENT_ENTITY table on version 26.3.5 then update Keycloak to 26.4.4
Anything else?
No response
- links to