Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,12 @@ protected <R> R retryLoopMutator(ZKFunctionMutator<R> zkf,
try {
return zkf.apply(getZooKeeper());
} catch (KeeperException e) {
if (alwaysRetryCondition.test(e) || useRetryForTransient(retries, e)) {
if (alwaysRetryCondition.test(e)) {
retries.waitForNextAttempt(log,
Comment thread
keith-turner marked this conversation as resolved.
"attempting to communicate with zookeeper after exception that always requires retry: "
+ e.getMessage());
continue;
} else if (useRetryForTransient(retries, e)) {
continue;
}
throw e;
Expand All @@ -201,7 +206,8 @@ private static boolean useRetryForTransient(Retry retries, KeeperException e)
log.warn("Saw (possibly) transient exception communicating with ZooKeeper", e);
if (retries.canRetry()) {
retries.useRetry();
retries.waitForNextAttempt(log, "attempting to communicate with zookeeper after exception");
retries.waitForNextAttempt(log,
"attempting to communicate with zookeeper after exception: " + e.getMessage());
return true;
}
log.error("Retry attempts ({}) exceeded trying to communicate with ZooKeeper",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ public void testMutateWithBadVersion() throws Exception {
// Let 2nd setData succeed
expect(zk.setData(path, mutatedBytes, 0)).andReturn(null);

retry.waitForNextAttempt(anyObject(), anyObject());
expectLastCall().once();

replay(zk, zrw, retryFactory, retry);

assertArrayEquals(new byte[] {1}, zrw.mutateOrCreate(path, value, mutator));
Expand Down