Skip to content

debezium/dbz#1089 Add Infinispan connection validator#288

Merged
mfvitale merged 5 commits intodebezium:mainfrom
yuanglili:dbz#1089-infinispan-conn-validator
Mar 26, 2026
Merged

debezium/dbz#1089 Add Infinispan connection validator#288
mfvitale merged 5 commits intodebezium:mainfrom
yuanglili:dbz#1089-infinispan-conn-validator

Conversation

@yuanglili
Copy link
Copy Markdown
Contributor

Summary
Implements InfinispanConnectionValidator for checking connection to Infinispan.

Changes

  • Add Infinispan connection schema to connection-schemas.json
  • Add InfinispanConnectionValidator using infinispan-client-hotrod for HotRod protocol validation
  • Add destinations.infinispan.connection.timeout to application.yml
  • Add InfinispanConnectionValidatorIT integration test with Testcontainers

Fixes debezium/dbz#1089


String serverUri;
if (user != null && password != null) {
serverUri = String.format("hotrod://%s:%s@%s:%d", user, password, serverHost, serverPort);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you create a constant for "hotrod://%s:%s@%s:%d" and the use the "".formatted() method?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hi @mfvitale, thanks for the review! Here's what I've updated:
Extracted HOTROD_URI_WITH_AUTH / HOTROD_URI_NO_AUTH as constants and switched to .formatted()

Copy link
Copy Markdown
Member

@mfvitale mfvitale left a comment

Choose a reason for hiding this comment

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

hi @yuanglili Overall it LGTM. I just left some minor improvements.

@yuanglili yuanglili requested a review from Naros March 13, 2026 20:01
@mfvitale
Copy link
Copy Markdown
Member

@yuanglili Could you please rebase on main?

Comment on lines +132 to +134
if (user != null && password != null) {
serverUri = HOTROD_URI_WITH_AUTH.formatted(user, password, serverHost, serverPort);
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What about if the supplied user/password is not null but is an empty string? Is the expectation that this should go through the "auth" path or the "no auth" path?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

What about if the supplied user/password is not null but is an empty string? Is the expectation that this should go through the "auth" path or the "no auth" path?

@Naros Good catch! But in the case, I think neither auth nor no-auth is the right path here, it should fail validation instead. Because if a user puts in a value, even a blank one, they probably mean to use authentication, so silently ignoring it seems wrong.

Also noticed I was missing another case: if only one of user or password is set, that should be an error too.

My plan to updated the logic to handle all cases:

  • Both non-blank → auth path
  • Both absent → no-auth path
  • One missing, or either is blank → validation error

WDYT?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@Naros @yuanglili I think the correct anwer is to check ISPN and confir if either username or password can be empty. Based on that it will either go through auth path or fail validation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I checked the Infinispan codebase:

  • AuthenticationConfigurationBuilder (L165-168): username() just assigns the value with no empty string check
  • validate() (L231-243): only checks username == null, so empty string passes right through
  • HotRodURI (L59): parses hotrod://:@host:port and assigns "" directly without converting to null

Test results:

  • Both blank (hotrod://:@host) → connected successfully (treated as no-auth)
  • Only one blank (e.g. hotrod://:secret@host or hotrod://admin:@host) → TransportException (auth failure)

So I think the updated logic should be :

  • Both non-blank → auth path
  • Both null or both blank → no-auth path
  • One blank, one not → validation error

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated the PR:

  • Fail validation when only one of user/password is provided or is empty
  • Add parameterized tests to cover partial credential scenarios

@yuanglili yuanglili force-pushed the dbz#1089-infinispan-conn-validator branch from 8438ff8 to cf51b63 Compare March 16, 2026 23:14
@yuanglili yuanglili marked this pull request as draft March 18, 2026 01:25
@yuanglili yuanglili marked this pull request as ready for review March 18, 2026 01:26
Comment on lines +139 to +147
boolean hasUser = user != null && !user.isEmpty();
boolean hasPassword = password != null && !password.isEmpty();

if (hasUser && hasPassword) {
serverUri = HOTROD_URI_WITH_AUTH.formatted(user, password, serverHost, serverPort);
}
else {
serverUri = HOTROD_URI_NO_AUTH.formatted(serverHost, serverPort);
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since you have already done the check for the password and user, could you move this block out of this function and then just pass the serverUri as parameter here?

boolean hasUser = user != null && !user.isEmpty();
boolean hasPassword = password != null && !password.isEmpty();

if (hasUser && hasPassword) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
if (hasUser && hasPassword) {
if (!Strings.isNullOrEmpty(user) && !Strings.isNullOrEmpty(password)) {

Then you can also remove the hasUser and hasPassword local vars.

@yuanglili yuanglili force-pushed the dbz#1089-infinispan-conn-validator branch from f64c2c5 to 869bab5 Compare March 23, 2026 23:45
@mfvitale
Copy link
Copy Markdown
Member

Waiting this #313 for test stabilization

@mfvitale
Copy link
Copy Markdown
Member

@yuanglili Could you please rebase with latest changes on main?

…n tests

Signed-off-by: nonononoonononon <yuangli971@gmail.com>
Signed-off-by: nonononoonononon <yuangli971@gmail.com>
Signed-off-by: nonononoonononon <yuangli971@gmail.com>
Signed-off-by: nonononoonononon <yuangli971@gmail.com>
Signed-off-by: nonononoonononon <yuangli971@gmail.com>
@yuanglili yuanglili force-pushed the dbz#1089-infinispan-conn-validator branch from bdc9cca to 94b7a6a Compare March 25, 2026 03:07
@yuanglili
Copy link
Copy Markdown
Contributor Author

@yuanglili Could you please rebase with latest changes on main?

Rebased , thanks!

@mfvitale
Copy link
Copy Markdown
Member

@yuanglili Applied, thanks!

@mfvitale mfvitale merged commit e853f27 into debezium:main Mar 26, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add connection validator for Infinispan [DBZ-9432]

4 participants