Skip to content

Commit

Permalink
HBASE-25743: Retry REQUESTTIMEOUT based KeeperExceptions in ZK client. (
Browse files Browse the repository at this point in the history
apache#3131)

Starting ZOOKEEPER-2251, client requests exceeding a timeout can throw
a KeeperException with REQUESTTIMEOUT opcode set. RecoverableZookeeper
doesn't transparently retry in such cases.

Reviewed-by: Rushabh Shah <[email protected]>
Signed-off-by: Michael Stack <[email protected]>
  • Loading branch information
bharathv committed Apr 8, 2021
1 parent d9f4f41 commit a59ac48
Showing 1 changed file with 9 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,8 @@ public void delete(String path, int version) throws InterruptedException, Keeper
throw e;

case CONNECTIONLOSS:
retryOrThrow(retryCounter, e, "delete");
break;
case OPERATIONTIMEOUT:
case REQUESTTIMEOUT:
retryOrThrow(retryCounter, e, "delete");
break;

Expand Down Expand Up @@ -222,9 +221,8 @@ private Stat exists(String path, Watcher watcher, Boolean watch)
} catch (KeeperException e) {
switch (e.code()) {
case CONNECTIONLOSS:
retryOrThrow(retryCounter, e, "exists");
break;
case OPERATIONTIMEOUT:
case REQUESTTIMEOUT:
retryOrThrow(retryCounter, e, "exists");
break;

Expand Down Expand Up @@ -279,9 +277,8 @@ private List<String> getChildren(String path, Watcher watcher, Boolean watch)
} catch (KeeperException e) {
switch (e.code()) {
case CONNECTIONLOSS:
retryOrThrow(retryCounter, e, "getChildren");
break;
case OPERATIONTIMEOUT:
case REQUESTTIMEOUT:
retryOrThrow(retryCounter, e, "getChildren");
break;

Expand Down Expand Up @@ -328,9 +325,8 @@ private byte[] getData(String path, Watcher watcher, Boolean watch, Stat stat)
} catch (KeeperException e) {
switch (e.code()) {
case CONNECTIONLOSS:
retryOrThrow(retryCounter, e, "getData");
break;
case OPERATIONTIMEOUT:
case REQUESTTIMEOUT:
retryOrThrow(retryCounter, e, "getData");
break;

Expand Down Expand Up @@ -370,9 +366,8 @@ public Stat setData(String path, byte[] data, int version)
} catch (KeeperException e) {
switch (e.code()) {
case CONNECTIONLOSS:
retryOrThrow(retryCounter, e, "setData");
break;
case OPERATIONTIMEOUT:
case REQUESTTIMEOUT:
retryOrThrow(retryCounter, e, "setData");
break;
case BADVERSION:
Expand Down Expand Up @@ -415,9 +410,8 @@ public List<ACL> getAcl(String path, Stat stat)
} catch (KeeperException e) {
switch (e.code()) {
case CONNECTIONLOSS:
retryOrThrow(retryCounter, e, "getAcl");
break;
case OPERATIONTIMEOUT:
case REQUESTTIMEOUT:
retryOrThrow(retryCounter, e, "getAcl");
break;

Expand All @@ -444,8 +438,6 @@ public Stat setAcl(String path, List<ACL> acls, int version)
} catch (KeeperException e) {
switch (e.code()) {
case CONNECTIONLOSS:
retryOrThrow(retryCounter, e, "setAcl");
break;
case OPERATIONTIMEOUT:
retryOrThrow(retryCounter, e, "setAcl");
break;
Expand Down Expand Up @@ -524,9 +516,8 @@ private String createNonSequential(String path, byte[] data, List<ACL> acl,
throw e;

case CONNECTIONLOSS:
retryOrThrow(retryCounter, e, "create");
break;
case OPERATIONTIMEOUT:
case REQUESTTIMEOUT:
retryOrThrow(retryCounter, e, "create");
break;

Expand Down Expand Up @@ -559,9 +550,8 @@ private String createSequential(String path, byte[] data,
} catch (KeeperException e) {
switch (e.code()) {
case CONNECTIONLOSS:
retryOrThrow(retryCounter, e, "create");
break;
case OPERATIONTIMEOUT:
case REQUESTTIMEOUT:
retryOrThrow(retryCounter, e, "create");
break;

Expand Down Expand Up @@ -615,9 +605,8 @@ public List<OpResult> multi(Iterable<Op> ops)
} catch (KeeperException e) {
switch (e.code()) {
case CONNECTIONLOSS:
retryOrThrow(retryCounter, e, "multi");
break;
case OPERATIONTIMEOUT:
case REQUESTTIMEOUT:
retryOrThrow(retryCounter, e, "multi");
break;

Expand Down

0 comments on commit a59ac48

Please sign in to comment.