HBASE-25743: Retry REQUESTTIMEOUT based KeeperExceptions in ZK client. (#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 <rushabh.shah@salesforce.com>
Signed-off-by: Michael Stack <stack@apache.org>
This commit is contained in:
Bharath Vissapragada 2021-04-07 23:44:07 -07:00 committed by GitHub
parent d9f4f41f76
commit a59ac48bd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 20 deletions

View File

@ -182,9 +182,8 @@ public class RecoverableZooKeeper {
throw e; throw e;
case CONNECTIONLOSS: case CONNECTIONLOSS:
retryOrThrow(retryCounter, e, "delete");
break;
case OPERATIONTIMEOUT: case OPERATIONTIMEOUT:
case REQUESTTIMEOUT:
retryOrThrow(retryCounter, e, "delete"); retryOrThrow(retryCounter, e, "delete");
break; break;
@ -222,9 +221,8 @@ public class RecoverableZooKeeper {
} catch (KeeperException e) { } catch (KeeperException e) {
switch (e.code()) { switch (e.code()) {
case CONNECTIONLOSS: case CONNECTIONLOSS:
retryOrThrow(retryCounter, e, "exists");
break;
case OPERATIONTIMEOUT: case OPERATIONTIMEOUT:
case REQUESTTIMEOUT:
retryOrThrow(retryCounter, e, "exists"); retryOrThrow(retryCounter, e, "exists");
break; break;
@ -279,9 +277,8 @@ public class RecoverableZooKeeper {
} catch (KeeperException e) { } catch (KeeperException e) {
switch (e.code()) { switch (e.code()) {
case CONNECTIONLOSS: case CONNECTIONLOSS:
retryOrThrow(retryCounter, e, "getChildren");
break;
case OPERATIONTIMEOUT: case OPERATIONTIMEOUT:
case REQUESTTIMEOUT:
retryOrThrow(retryCounter, e, "getChildren"); retryOrThrow(retryCounter, e, "getChildren");
break; break;
@ -328,9 +325,8 @@ public class RecoverableZooKeeper {
} catch (KeeperException e) { } catch (KeeperException e) {
switch (e.code()) { switch (e.code()) {
case CONNECTIONLOSS: case CONNECTIONLOSS:
retryOrThrow(retryCounter, e, "getData");
break;
case OPERATIONTIMEOUT: case OPERATIONTIMEOUT:
case REQUESTTIMEOUT:
retryOrThrow(retryCounter, e, "getData"); retryOrThrow(retryCounter, e, "getData");
break; break;
@ -370,9 +366,8 @@ public class RecoverableZooKeeper {
} catch (KeeperException e) { } catch (KeeperException e) {
switch (e.code()) { switch (e.code()) {
case CONNECTIONLOSS: case CONNECTIONLOSS:
retryOrThrow(retryCounter, e, "setData");
break;
case OPERATIONTIMEOUT: case OPERATIONTIMEOUT:
case REQUESTTIMEOUT:
retryOrThrow(retryCounter, e, "setData"); retryOrThrow(retryCounter, e, "setData");
break; break;
case BADVERSION: case BADVERSION:
@ -415,9 +410,8 @@ public class RecoverableZooKeeper {
} catch (KeeperException e) { } catch (KeeperException e) {
switch (e.code()) { switch (e.code()) {
case CONNECTIONLOSS: case CONNECTIONLOSS:
retryOrThrow(retryCounter, e, "getAcl");
break;
case OPERATIONTIMEOUT: case OPERATIONTIMEOUT:
case REQUESTTIMEOUT:
retryOrThrow(retryCounter, e, "getAcl"); retryOrThrow(retryCounter, e, "getAcl");
break; break;
@ -444,8 +438,6 @@ public class RecoverableZooKeeper {
} catch (KeeperException e) { } catch (KeeperException e) {
switch (e.code()) { switch (e.code()) {
case CONNECTIONLOSS: case CONNECTIONLOSS:
retryOrThrow(retryCounter, e, "setAcl");
break;
case OPERATIONTIMEOUT: case OPERATIONTIMEOUT:
retryOrThrow(retryCounter, e, "setAcl"); retryOrThrow(retryCounter, e, "setAcl");
break; break;
@ -524,9 +516,8 @@ public class RecoverableZooKeeper {
throw e; throw e;
case CONNECTIONLOSS: case CONNECTIONLOSS:
retryOrThrow(retryCounter, e, "create");
break;
case OPERATIONTIMEOUT: case OPERATIONTIMEOUT:
case REQUESTTIMEOUT:
retryOrThrow(retryCounter, e, "create"); retryOrThrow(retryCounter, e, "create");
break; break;
@ -559,9 +550,8 @@ public class RecoverableZooKeeper {
} catch (KeeperException e) { } catch (KeeperException e) {
switch (e.code()) { switch (e.code()) {
case CONNECTIONLOSS: case CONNECTIONLOSS:
retryOrThrow(retryCounter, e, "create");
break;
case OPERATIONTIMEOUT: case OPERATIONTIMEOUT:
case REQUESTTIMEOUT:
retryOrThrow(retryCounter, e, "create"); retryOrThrow(retryCounter, e, "create");
break; break;
@ -615,9 +605,8 @@ public class RecoverableZooKeeper {
} catch (KeeperException e) { } catch (KeeperException e) {
switch (e.code()) { switch (e.code()) {
case CONNECTIONLOSS: case CONNECTIONLOSS:
retryOrThrow(retryCounter, e, "multi");
break;
case OPERATIONTIMEOUT: case OPERATIONTIMEOUT:
case REQUESTTIMEOUT:
retryOrThrow(retryCounter, e, "multi"); retryOrThrow(retryCounter, e, "multi");
break; break;