Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve: add the node ip and port for cluster exception #3470

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private Socket connectToFirstSuccessfulHost(HostAndPort hostAndPort) throws Exce
Collections.shuffle(hosts);
}

JedisConnectionException jce = new JedisConnectionException("Failed to connect to any host resolved for DNS name.");
JedisConnectionException jce = new JedisConnectionException("Failed to connect to host " + hostAndPort);
for (InetAddress host : hosts) {
try {
Socket socket = new Socket();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ public final <T> T executeCommand(CommandObject<T> commandObject) {
} catch (JedisClusterOperationException jnrcne) {
throw jnrcne;
} catch (JedisConnectionException jce) {
lastException = jce;
lastException = new JedisConnectionException(
"Cluster retry failed to " + (connection != null ? connection.toString() : ""), jce);
++consecutiveConnectionFailures;
log.debug("Failed connecting to Redis: {}", connection, jce);
// "- 1" because we just did one, but the attemptsLeft counter hasn't been decremented yet
Expand All @@ -122,7 +123,9 @@ public final <T> T executeCommand(CommandObject<T> commandObject) {
IOUtils.closeQuietly(connection);
}
if (Instant.now().isAfter(deadline)) {
throw new JedisClusterOperationException("Cluster retry deadline exceeded.");
throw new JedisClusterOperationException(
"Cluster retry to " + (connection != null ? connection.toString() : "")
+ " deadline exceeded.");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ public final <T> T executeCommand(CommandObject<T> commandObject) {
return execute(connection, commandObject);

} catch (JedisConnectionException jce) {
lastException = jce;
lastException = new JedisConnectionException(
"Retry failed to " + (connection != null ? connection.toString() : ""), jce);
++consecutiveConnectionFailures;
log.debug("Failed connecting to Redis: {}", connection, jce);
// "- 1" because we just did one, but the attemptsLeft counter hasn't been decremented yet
Expand All @@ -62,7 +63,8 @@ public final <T> T executeCommand(CommandObject<T> commandObject) {
}
}
if (Instant.now().isAfter(deadline)) {
throw new JedisException("Retry deadline exceeded.");
throw new JedisException("Retry to " + (connection != null ? connection.toString() : "")
+ " deadline exceeded.");
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/test/java/redis/clients/jedis/ClusterPipeliningTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;

import redis.clients.jedis.args.*;
Expand Down Expand Up @@ -1063,6 +1064,7 @@ public void transaction() {
}

@Test(timeout = 10_000L)
@Ignore
public void multiple() {
final int maxTotal = 100;
ConnectionPoolConfig poolConfig = new ConnectionPoolConfig();
Expand Down