Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
922262f
GG-36168 Added client comparison table (#88)
isapego Feb 6, 2023
16373c0
Resolve all addresses
ptupitsyn Oct 10, 2025
0140b6c
Reinit channels on topology update
ptupitsyn Oct 10, 2025
b8326c2
wip
ptupitsyn Oct 10, 2025
00a3a7d
wip ClientDnsDiscoveryTest
ptupitsyn Oct 10, 2025
c129d76
testClientResolvesAllHostNameAddresses done
ptupitsyn Oct 10, 2025
e49b1dd
wip testClientRefreshesDnsOnNodeFailure
ptupitsyn Oct 10, 2025
06be924
wip TestServer builder
ptupitsyn Oct 10, 2025
4b76859
Fix build
ptupitsyn Oct 10, 2025
2beaaac
wip ClientDnsDiscoveryTest
ptupitsyn Oct 10, 2025
b82768a
wip testClientRefreshesDnsOnNodeFailure
ptupitsyn Oct 10, 2025
a889a2f
wip
ptupitsyn Oct 10, 2025
108d695
testClientRefreshesDnsOnNodeFailure works
ptupitsyn Oct 10, 2025
b670f4a
restore some removed code
ptupitsyn Oct 10, 2025
17ea8aa
testClientRefreshesDnsOnNodeFailure done
ptupitsyn Oct 10, 2025
5b61926
cleanup
ptupitsyn Oct 10, 2025
dc95bd7
Fix checkstyle
ptupitsyn Oct 10, 2025
8374856
wip testMultipleIpsSameNode
ptupitsyn Oct 10, 2025
6a1d740
Merge branch 'main' of https://github.com/apache/ignite-3 into ignite…
nva Nov 19, 2025
6017707
IGNITE-26893 Add background address re-resolution interval to IgniteC…
nva Nov 21, 2025
ec63e7f
Merge branch 'main' of https://github.com/apache/ignite-3 into ignite…
nva Nov 21, 2025
9c05836
IGNITE-26893 Fixed tests.
nva Nov 24, 2025
d487fc1
Merge branch 'main' of https://github.com/gridgain/apache-ignite-3 in…
nva Nov 24, 2025
923ce1b
Merge branch 'main' of https://github.com/apache/ignite-3 into ignite…
nva Nov 24, 2025
8bc262a
IGNITE-26893 Fixed unit tests.
nva Nov 24, 2025
80929ba
IGNITE-26893 Revert unexpected changes.
nva Nov 24, 2025
ce629e1
IGNITE-26893 Fixed unit tests.
nva Nov 24, 2025
a41b70f
IGNITE-26893 Fixed integration tests.
nva Nov 24, 2025
a019d79
IGNITE-26893 Cleanup.
nva Nov 24, 2025
9dbb39c
IGNITE-26893 Cleanup.
nva Nov 24, 2025
d08bd23
IGNITE-26893 Fixed tests.
nva Nov 25, 2025
89755e5
Merge branch 'main' of https://github.com/apache/ignite-3 into ignite…
nva Nov 25, 2025
3e114fc
IGNITE-26893 Fixed checkstyle and tests.
nva Nov 25, 2025
a9881ee
IGNITE-26893 Fixed tests.
nva Nov 25, 2025
8b96244
IGNITE-26893 Fixed tests.
nva Nov 26, 2025
28e724c
IGNITE-26893 WIP.
nva Nov 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/checkstyle-idea.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.ignite.client;

import static org.apache.ignite.client.IgniteClientConfiguration.DFLT_BACKGROUND_RECONNECT_INTERVAL;
import static org.apache.ignite.client.IgniteClientConfiguration.DFLT_BACKGROUND_RE_RESOLVE_ADDRESSES_INTERVAL;
import static org.apache.ignite.client.IgniteClientConfiguration.DFLT_CONNECT_TIMEOUT;
import static org.apache.ignite.client.IgniteClientConfiguration.DFLT_HEARTBEAT_INTERVAL;
import static org.apache.ignite.client.IgniteClientConfiguration.DFLT_HEARTBEAT_TIMEOUT;
Expand Down Expand Up @@ -115,6 +116,8 @@ class Builder {

private @Nullable String name;

long backgroundReResolveAddressesInterval = DFLT_BACKGROUND_RE_RESOLVE_ADDRESSES_INTERVAL;

/**
* Sets the addresses of Ignite server nodes within a cluster. An address can be an IP address or a hostname, with or without port.
* If port is not set then Ignite will use the default one - see {@link IgniteClientConfiguration#DFLT_PORT}.
Expand Down Expand Up @@ -406,6 +409,28 @@ public Builder name(@Nullable String name) {
return this;
}

/**
* Sets how long the resolved addresses will be considered valid, in milliseconds. Set to {@code 0} for infinite validity.
*
* <p>Ignite client resolve the provided hostnames into multiple IP addresses, each corresponds to an active cluster node.
* However, additional IP addresses can be collected after updating the DNS records. This property controls how often Ignite
* client will try to re-resolve provided hostnames and connect to newly discovered addresses.
*
* @param backgroundReResolveAddressesInterval Background re-resolve interval, in milliseconds.
* @return This instance.
* @throws IllegalArgumentException When value is less than zero.
*/
public Builder backgroundReResolveAddressesInterval(long backgroundReResolveAddressesInterval) {
if (backgroundReResolveAddressesInterval < 0) {
throw new IllegalArgumentException("backgroundReResolveAddressesInterval ["
+ backgroundReResolveAddressesInterval + "] must be a non-negative integer value.");
}

this.backgroundReResolveAddressesInterval = backgroundReResolveAddressesInterval;

return this;
}

/**
* Builds the client.
*
Expand Down Expand Up @@ -436,7 +461,8 @@ public CompletableFuture<IgniteClient> buildAsync() {
authenticator,
operationTimeout,
sqlPartitionAwarenessMetadataCacheSize,
name
name,
backgroundReResolveAddressesInterval
);

return TcpIgniteClient.startAsync(cfg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public interface IgniteClientConfiguration {
/** Default background reconnect interval, in milliseconds. */
long DFLT_BACKGROUND_RECONNECT_INTERVAL = 30_000L;

/** Default interval sets how long the resolved addresses will be considered valid, in milliseconds. */
long DFLT_BACKGROUND_RE_RESOLVE_ADDRESSES_INTERVAL = 30_000L;

/** Default operation timeout, in milliseconds. */
int DFLT_OPERATION_TIMEOUT = 0;

Expand Down Expand Up @@ -222,4 +225,16 @@ public interface IgniteClientConfiguration {
* @return Client name.
*/
@Nullable String name();

/**
* Gets how long the resolved addresses will be considered valid, in milliseconds. Set to {@code 0} for infinite validity.
* Default is {@link #DFLT_BACKGROUND_RE_RESOLVE_ADDRESSES_INTERVAL}.
*
* <p>Ignite client resolve the provided hostnames into multiple IP addresses, each corresponds to an active cluster node.
* However, additional IP addresses can be collected after updating the DNS records. This property controls how often Ignite
* client will try to re-resolve provided hostnames and connect to newly discovered addresses.
*
* @return Background re-resolve interval, in milliseconds.
*/
long backgroundReResolveAddressesInterval();
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.apache.ignite.client.SslConfiguration;
import org.apache.ignite.lang.LoggerFactory;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.VisibleForTesting;

/**
* Immutable client configuration.
Expand Down Expand Up @@ -68,6 +69,10 @@ public final class IgniteClientConfigurationImpl implements IgniteClientConfigur

private final @Nullable String name;

private final InetAddressResolver addressResolver;

private final long backgroundReResolveAddressesInterval;

/**
* Constructor.
*
Expand All @@ -86,7 +91,10 @@ public final class IgniteClientConfigurationImpl implements IgniteClientConfigur
* @param operationTimeout Operation timeout.
* @param sqlPartitionAwarenessMetadataCacheSize Size of the cache to store partition awareness metadata.
* @param name Client name.
* @param backgroundReResolveAddressesInterval Background re-resolve addresses interval.
* @param addressResolver Address resolver.
*/
@VisibleForTesting
public IgniteClientConfigurationImpl(
@Nullable IgniteClientAddressFinder addressFinder,
String[] addresses,
Expand All @@ -102,7 +110,9 @@ public IgniteClientConfigurationImpl(
@Nullable IgniteClientAuthenticator authenticator,
long operationTimeout,
int sqlPartitionAwarenessMetadataCacheSize,
@Nullable String name
@Nullable String name,
long backgroundReResolveAddressesInterval,
@Nullable InetAddressResolver addressResolver
) {
this.addressFinder = addressFinder;

Expand All @@ -122,6 +132,66 @@ public IgniteClientConfigurationImpl(
this.operationTimeout = operationTimeout;
this.sqlPartitionAwarenessMetadataCacheSize = sqlPartitionAwarenessMetadataCacheSize;
this.name = name;
this.backgroundReResolveAddressesInterval = backgroundReResolveAddressesInterval;
this.addressResolver = addressResolver;
}

/**
* Constructor.
*
* @param addressFinder Address finder.
* @param addresses Addresses.
* @param connectTimeout Socket connect timeout.
* @param backgroundReconnectInterval Background reconnect interval.
* @param asyncContinuationExecutor Async continuation executor.
* @param heartbeatInterval Heartbeat message interval.
* @param heartbeatTimeout Heartbeat message timeout.
* @param retryPolicy Retry policy.
* @param loggerFactory Logger factory which will be used to create a logger instance for this this particular client when
* needed.
* @param metricsEnabled Whether metrics are enabled.
* @param authenticator Authenticator.
* @param operationTimeout Operation timeout.
* @param sqlPartitionAwarenessMetadataCacheSize Size of the cache to store partition awareness metadata.
* @param name Client name.
*/
public IgniteClientConfigurationImpl(
@Nullable IgniteClientAddressFinder addressFinder,
String[] addresses,
long connectTimeout,
long backgroundReconnectInterval,
@Nullable Executor asyncContinuationExecutor,
long heartbeatInterval,
long heartbeatTimeout,
@Nullable RetryPolicy retryPolicy,
@Nullable LoggerFactory loggerFactory,
@Nullable SslConfiguration sslConfiguration,
boolean metricsEnabled,
@Nullable IgniteClientAuthenticator authenticator,
long operationTimeout,
int sqlPartitionAwarenessMetadataCacheSize,
@Nullable String name,
long backgroundReResolveAddressesInterval
) {
this(
addressFinder,
addresses,
connectTimeout,
backgroundReconnectInterval,
asyncContinuationExecutor,
heartbeatInterval,
heartbeatTimeout,
retryPolicy,
loggerFactory,
sslConfiguration,
metricsEnabled,
authenticator,
operationTimeout,
sqlPartitionAwarenessMetadataCacheSize,
name,
backgroundReResolveAddressesInterval,
null
);
}

/** {@inheritDoc} */
Expand Down Expand Up @@ -210,4 +280,18 @@ public int sqlPartitionAwarenessMetadataCacheSize() {
public @Nullable String name() {
return name;
}

@Override
public long backgroundReResolveAddressesInterval() {
return backgroundReResolveAddressesInterval;
}

/**
* Gets custom address resolver.
*
* @return Custom address resolver.
*/
@Nullable InetAddressResolver addressResolver() {
return addressResolver;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.ignite.internal.client;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
* DNS resolver.
*/
@FunctionalInterface
public interface InetAddressResolver {
InetAddressResolver DEFAULT = InetAddress::getAllByName;

/**
* Resolves the given host name to its IP addresses.
*
* @param host the host name to be resolved
* @return an array of {@code InetAddress} objects representing the IP addresses of the host
* @throws UnknownHostException if the host name could not be resolved
*/
InetAddress[] getAllByName(String host) throws UnknownHostException;
}
Loading