taklwu commented on code in PR #4889:
URL: https://github.com/apache/hbase/pull/4889#discussion_r1028561464
##########
hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java:
##########
@@ -382,6 +390,24 @@ public void newDead(ServerName sn) {
default:
// Doing nothing
}
+
+ this.cachedMasterStateSupplier = Suppliers.memoizeWithExpiration(() -> {
+ if (this.masterServiceState.getStub() == null) {
+ return false;
+ }
+ try {
+ LOG.info("Getting master state using rpc call");
+ return this.masterServiceState.isMasterRunning();
+ } catch (UndeclaredThrowableException e) {
+ // It's somehow messy, but we can receive exceptions such as
+ // java.net.ConnectException but they're not declared. So we catch
it...
+ LOG.info("Master connection is not running anymore",
e.getUndeclaredThrowable());
+ return false;
+ } catch (IOException se) {
+ LOG.warn("Checking master connection", se);
+ return false;
+ }
+ }, conf.getLong(MASTER_STATE_CACHE_TIMEOUT_SEC, 30), TimeUnit.SECONDS);
Review Comment:
IMO we should default opt-out this feature without default to 0, then also
add a unit test to a connection related test to have the the timeout set to 30
and see if anything breaks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]