Pavel Pereslegin created IGNITE-27214:
-----------------------------------------
Summary: Java thin. Connection to the cluster is not established
if the first node in the list is unavailable and RetryPolicy is not set.
Key: IGNITE-27214
URL: https://issues.apache.org/jira/browse/IGNITE-27214
Project: Ignite
Issue Type: Improvement
Components: thin clients ai3
Reporter: Pavel Pereslegin
When establishing an initial connection to a cluster, if the first node in the
list is unavailable and {{RetryPolicy}} is not specified, the client does not
attempt to connect to other nodes.
It seems we should not rely on {{RetryPolicy}} when initially connecting to a
cluster, and even if it is not set, we should iterate through all nodes from
the list.
Reproducer
{code:java}
@Test
void initialConnectionToClusterFirstNodeIsDownNoRetryPolicy() {
cluster.startAndInit(3, new int[]{2});
String[] addresses = {
"127.0.0.1:10804", // Stopped node.
"127.0.0.1:10800" // Alive node.
};
try (IgniteClient ignored = IgniteClient.builder()
// works fine
// .retryPolicy(new RetryReadPolicy().retryLimit(1))
// not working
.retryPolicy(null)
.addresses(addresses).build()) {
// No-op.
}
}
{code}
Fails with:
{noformat}
org.apache.ignite.client.IgniteClientConnectionException: IGN-CLIENT-1 Client
failed to connect: Connection refused: /127.0.0.1:10804
[endpoint=127.0.0.1:10804]
TraceId:3069d739
at
java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:710)
at
org.apache.ignite.internal.util.ExceptionUtils$1.copy(ExceptionUtils.java:952)
at
org.apache.ignite.internal.util.ExceptionUtils$ExceptionFactory.createCopy(ExceptionUtils.java:886)
at
org.apache.ignite.internal.util.ExceptionUtils.copyExceptionWithCause(ExceptionUtils.java:688)
at
org.apache.ignite.internal.util.ViewUtils.copyExceptionWithCauseIfPossible(ViewUtils.java:91)
at
org.apache.ignite.internal.util.ViewUtils.ensurePublicException(ViewUtils.java:71)
at org.apache.ignite.internal.util.ViewUtils.sync(ViewUtils.java:54)
at
org.apache.ignite.client.IgniteClient$Builder.build(IgniteClient.java:415)
at
org.apache.ignite.internal.runner.app.client.ItThinConnectionTest.initialConnectionToClusterFirstNodeIsDownNoRetryPolicy(ItThinConnectionTest.java:30)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
Caused by: org.apache.ignite.client.IgniteClientConnectionException:
IGN-CLIENT-1 Client failed to connect: Connection refused: /127.0.0.1:10804
[endpoint=127.0.0.1:10804] TraceId:3069d739
at
org.apache.ignite.internal.client.io.netty.NettyClientConnectionMultiplexer.lambda$openAsync$1(NettyClientConnectionMultiplexer.java:193)
{noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)