Skip to content

Conversation

@nva
Copy link
Contributor

@nva nva commented Nov 21, 2025

https://issues.apache.org/jira/browse/IGNITE-26893

Thank you for submitting the pull request.

To streamline the review process of the patch and ensure better code quality
we ask both an author and a reviewer to verify the following:

The Review Checklist

  • Formal criteria: TC status, codestyle, mandatory documentation. Also make sure to complete the following:
    - There is a single JIRA ticket related to the pull request.
    - The web-link to the pull request is attached to the JIRA ticket.
    - The JIRA ticket has the Patch Available state.
    - The description of the JIRA ticket explains WHAT was made, WHY and HOW.
    - The pull request title is treated as the final commit message. The following pattern must be used: IGNITE-XXXX Change summary where XXXX - number of JIRA issue.
  • Design: new code conforms with the design principles of the components it is added to.
  • Patch quality: patch cannot be split into smaller pieces, its size must be reasonable.
  • Code quality: code is clean and readable, necessary developer documentation is added if needed.
  • Tests code quality: test set covers positive/negative scenarios, happy/edge cases. Tests are effective in terms of execution time and resources.

Notes

@nva nva changed the title Ignite 26893 IGNITE-26893 Java thin: improve DNS resolution logic. Nov 21, 2025
nva added 8 commits November 24, 2025 13:12
…to ignite-26893

# Conflicts:
#	docs/_docs/index.adoc
…-26893

# Conflicts:
#	modules/client/src/main/java/org/apache/ignite/internal/client/TcpIgniteClient.java
#	modules/jdbc/src/main/java/org/apache/ignite/internal/jdbc/JdbcConnection.java
@nva nva marked this pull request as ready for review November 27, 2025 04:56
@nva nva requested a review from ptupitsyn November 27, 2025 06:13
Comment on lines +441 to +445
// Special handling for "localhost" to avoid unnecessary DNS resolution.
if ("localhost".equalsIgnoreCase(addr.host())) {
map.merge(InetSocketAddress.createUnresolved(addr.host(), addr.port()), 1, Integer::sum);

continue;
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure about this, localhost can be customized in the hosts file for various reasons. And the OS should deal with that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like you're right. Potentially, we have more than one name (localhost, InetAddress.getLocalHost().getHostName()) for the loopback interface.
It might be a problem since the client will try to connect to all loopback addresses (127.0.0.1, 0:0:0:0:0:0:0:1) if you set "localhost".

}

for (InetAddress inetAddr : addressResolver.getAllByName(addr.host())) {
// Preserve unresolved address if the resolved address equals to the original host string.
Copy link
Contributor

Choose a reason for hiding this comment

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

Please elaborate, why do we need this special case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All IP addresses remain unresolved to preserve connection order in tests. Without this fix, we need to fix RequestBalancingTest, ClientPartitionManagerTest, ...

return ranges.stream()
.map(p -> InetSocketAddress.createUnresolved(p.host(), p.port()))
.collect(Collectors.toMap(a -> a, a -> 1, Integer::sum));
var map = new HashMap<InetSocketAddress, Integer>(parsedAddrs.size());
Copy link
Contributor

Choose a reason for hiding this comment

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

org.apache.ignite.internal.util.IgniteUtils#newHashMap need to be used if you want to predict the sizing

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.

4 participants