diff --git a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/connections/DefaultHotRodConnectionProviderFactory.java b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/connections/DefaultHotRodConnectionProviderFactory.java index 75a98cad92..912dfe065d 100644 --- a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/connections/DefaultHotRodConnectionProviderFactory.java +++ b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/connections/DefaultHotRodConnectionProviderFactory.java @@ -118,20 +118,19 @@ public class DefaultHotRodConnectionProviderFactory implements HotRodConnectionP registerSchemata(ProtoSchemaInitializer.INSTANCE); + + String reindexCaches = config.get("reindexCaches", null); RemoteCacheManagerAdmin administration = remoteCacheManager.administration(); - if (config.getBoolean("reindexAllCaches", false)) { + if (reindexCaches != null && reindexCaches.equals("all")) { LOG.infof("Reindexing all caches. This can take a long time to complete. While the rebuild operation is in progress, queries might return fewer results."); remoteCaches.forEach(administration::reindexCache); - } else { - String reindexCaches = config.get("reindexCaches", ""); - if (reindexCaches != null) { - Arrays.stream(reindexCaches.split(",")) - .map(String::trim) - .filter(e -> !e.isEmpty()) - .filter(remoteCaches::contains) - .peek(cacheName -> LOG.infof("Reindexing %s cache. This can take a long time to complete. While the rebuild operation is in progress, queries might return fewer results.", cacheName)) - .forEach(administration::reindexCache); - } + } else if (reindexCaches != null && !reindexCaches.isEmpty()){ + Arrays.stream(reindexCaches.split(",")) + .map(String::trim) + .filter(e -> !e.isEmpty()) + .filter(remoteCaches::contains) + .peek(cacheName -> LOG.infof("Reindexing %s cache. This can take a long time to complete. While the rebuild operation is in progress, queries might return fewer results.", cacheName)) + .forEach(administration::reindexCache); } } diff --git a/testsuite/integration-arquillian/tests/base/src/test/resources/META-INF/keycloak-server.json b/testsuite/integration-arquillian/tests/base/src/test/resources/META-INF/keycloak-server.json index a2c489313e..e6b6f12d1e 100755 --- a/testsuite/integration-arquillian/tests/base/src/test/resources/META-INF/keycloak-server.json +++ b/testsuite/integration-arquillian/tests/base/src/test/resources/META-INF/keycloak-server.json @@ -264,7 +264,7 @@ "username": "${keycloak.connectionsHotRod.username:myuser}", "password": "${keycloak.connectionsHotRod.password:qwer1234!}", "enableSecurity": "${keycloak.connectionsHotRod.enableSecurity:true}", - "reindexCaches": "${keycloak.connectionsHotRod.reindexCaches:auth-sessions,clients,client-scopes,groups,users,user-login-failures,user-sessions,client-sessions,roles,realms,authz}" + "reindexCaches": "${keycloak.connectionsHotRod.reindexCaches:all}" } }, diff --git a/testsuite/utils/src/main/resources/META-INF/keycloak-server.json b/testsuite/utils/src/main/resources/META-INF/keycloak-server.json index 00e2dac3ec..1bc04a124b 100755 --- a/testsuite/utils/src/main/resources/META-INF/keycloak-server.json +++ b/testsuite/utils/src/main/resources/META-INF/keycloak-server.json @@ -231,10 +231,15 @@ "default": { "embedded": "${keycloak.connectionsHotRod.embedded:true}", "embeddedPort": "${keycloak.connectionsHotRod.embeddedPort:11444}", - "enableSecurity": "${keycloak.connectionsHotRod.enableSecurity:false}" + "enableSecurity": "${keycloak.connectionsHotRod.enableSecurity:false}", + "port": "${keycloak.connectionsHotRod.port:11444}", + "host": "${keycloak.connectionsHotRod.host:localhost}", + "configureRemoteCaches": "${keycloak.connectionsHotRod.configureRemoteCaches:false}", + "username": "${keycloak.connectionsHotRod.username:admin}", + "password": "${keycloak.connectionsHotRod.password:admin}", + "reindexCaches": "${keycloak.connectionsHotRod.reindexCaches:}" } }, - "scripting": { },