Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@pruivo
Copy link
Member

@pruivo pruivo commented Apr 22, 2025

Closes #38497

Notes

  • Removed DefaultInfinispanConnectionProviderFactory#initEmbedded() -> it was used by the store model tests.
  • A Infinispan configuration file is always required -> create a basic configuration file for the store model tests
  • Most of the logic is present in DefaultCacheEmbeddedConfigProviderFactory
  • CacheConfigurator has the logic to configure caches based on CLI options; JGroupsConfigurator is the same for the JGroups configuration. Trying to keep the class DefaultCacheEmbeddedConfigProviderFactory small and easy to read.

Tasks

  • Update changes documentation
  • Review documentation
  • Javadoc
  • Statis analysis: remove or deprecate unused code

@pruivo pruivo force-pushed the t_37912_config_spi branch 4 times, most recently from 650cd5e to 9ba029c Compare April 23, 2025 17:30
@ahus1
Copy link
Contributor

ahus1 commented Apr 23, 2025

Failing FIPS tests have been fixed in #39125

@pruivo pruivo force-pushed the t_37912_config_spi branch from 9ba029c to 42075c3 Compare April 24, 2025 08:12
Copy link
Contributor

@ahus1 ahus1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, see pruivo#8 for two changes:

  • Removal of some files which are IMHO not part of the public API, and I also don't see how they are being used.
  • I saw you added an option to disable the ISPN metrics. IMHO this wasn't available earlier. When we add it, I want to make this option explicit and documented in the CLI. I moved it to the other metrics open that we have for the embedded caches, so they are in a similar place.

See pruivo#8 for the two commits.

Once these items are resolve, I'm happy to merge it.

@ahus1 ahus1 self-assigned this Apr 25, 2025
@ryanemerson ryanemerson self-requested a review April 28, 2025 07:38
@pruivo
Copy link
Member Author

pruivo commented Apr 28, 2025

CLI option

It is not a new option, it is a bridge to map the --metrics-enabled option to the SPI option. It should not be exposed.

The current code is reacting to this option to enable the metrics in Infinispan

But the option is already mapped to a quarkus option here

fromOption(MetricsOptions.METRICS_ENABLED)
.to("quarkus.micrometer.enabled")
.build(),

Steven may implement another alternative to get rid of the mapping:

#39123

Site Name

jboss.site.name has been removed but we never documented it and I added that piece of information to the changelog.

if (System.getProperty(InfinispanConnectionProvider.JBOSS_SITE_NAME) != null) {
throw new IllegalArgumentException(
String.format("System property %s is in use. Use --spi-connections-infinispan-%s-site-name config option instead",
InfinispanConnectionProvider.JBOSS_SITE_NAME, providerId));
}

Multi-site has never used the site's name value. There is no clustering and all the events use DCNotify.ALL_DCS. It is ignored here:

senderSite = dcNotify == ClusterProvider.DCNotify.ALL_DCS ? null : senderSite;

It was used by the code that Michal removed and, at the moment has no use. It will become relevant for stretched clusters.

This PR changes --spi-connections-infinispan-quarkus-site-name (still reads this SPI options) to --spi-cache-embedded-default-site-name

Node Name

jboss.node.name is not documented anywhere. It is not used at all in production as it uses the address generated by JGroups.

var addr = cacheManager.getAddress();
if (addr != null) {
nodeName = addr.toString();
siteName = cacheManager.getCacheManagerConfiguration().transport().siteId();
if (siteName == null) {
siteName = config.get("siteName");
}
} else {

I'm changing quite a bit in the PR

  • node name is taken into consideration and used to configure JGroups. Worth mentioning that it is only used for logging purposes (a friendly name than using internal uuid)
  • Keycloak fails to start if jboss.node.name is set.
  • A new SPI option to set the node's name.

@ahus1 I hope this clarifies my decision in this PR.

@pruivo pruivo force-pushed the t_37912_config_spi branch from 42075c3 to 515a858 Compare April 28, 2025 08:23
@ahus1
Copy link
Contributor

ahus1 commented Apr 28, 2025

It is not a new option, it is a bridge to map the --metrics-enabled option to the SPI option. It should not be exposed.

Thanks, this explains it. A comment would have been helpful to state that "why" it was added. If you think exposing it adds value and would be a feature, consider picking my changes from the other PR. I leave that up to you.

Signed-off-by: Alexander Schwartz <[email protected]>
/**
* @deprecated to be removed without replacement.
*/
@Deprecated(since = "26.3", forRemoval = true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The deprecated methods in this class (and others) are not used internally anymore. @ahus1 @pruivo What's the policy for deprecating/removing classes in the model modules. Should all code in this module be considered public API or just interfaces? I don't see a package-info.java so it's not clear to me what the expectations are here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically we are allowed to change them in any release, as they are not considered public. Sometimes it is still nice to keep them around for a while if we think people might use them anyway and to allow them a smoother migration.

I assume keeping this methods comes only at the cost that we would need to have an extra PR later to actually remove the code.

I'll leave that final call with @pruivo.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not clear what is public API and what users are using (I'm aware some users are creating caches for their providers). I'm playing safe and keeping them around and removing them in 26.4 or 26.5.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fine by me. I see we're now making better use of impl.* packages, so in the future hopefully what is/isn't supported will be clearer.


@Override
public Set<Class<? extends Provider>> dependsOn() {
return Set.of(JGroupsCertificateProvider.class);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to these changes per se, but I noticed that RemoteLoadBalancerCheckProviderFactory depends on InfinispanConnectionProvider but does not have a dependsOn implementation. Is there a reason for this, or should I create an issue to address this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume it is because dependsOn() method was added after RemoteLoadBalancerCheckProviderFactory.
This is a "lazy provider" and is only instantiated when the REST endpoint is invoked.

@ahus1 ahus1 marked this pull request as ready for review April 28, 2025 10:04
@ahus1 ahus1 requested review from a team as code owners April 28, 2025 10:05
@ahus1 ahus1 enabled auto-merge (squash) April 28, 2025 10:06
@ahus1 ahus1 merged commit eafe08a into keycloak:main Apr 28, 2025
80 checks passed
@pruivo pruivo deleted the t_37912_config_spi branch April 28, 2025 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create CacheEmbeddedConfigProvider

3 participants