virajjasani commented on code in PR #5349:
URL: https://github.com/apache/hadoop/pull/5349#discussion_r1096495331
##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java:
##########
@@ -3832,7 +3837,38 @@ public boolean isDatanodeFullyStarted() {
}
return true;
}
-
+
+ /**
+ * Wait for the datanode to be fully started and also connected to active
namenode. This means
+ * wait until the given time duration for all the BP threads to come alive
and all the block
+ * pools to be initialized. Wait until any one of the BP service actor is
connected to active
+ * namenode.
+ *
+ * @param waitTimeMs Wait time in millis for this method to return the
datanode probes. If
+ * datanode stays unhealthy or not connected to any active namenode even
after the given wait
+ * time elapses, it returns false.
+ * @return true - if the data node is fully started and connected to active
namenode within
+ * the given time internal, false otherwise.
+ */
+ public boolean isDatanodeHealthy(long waitTimeMs) {
+ long startTime = monotonicNow();
+ while (monotonicNow() - startTime <= waitTimeMs) {
+ if (isDatanodeFullyStartedAndConnectedToActiveNN()) {
+ return true;
+ }
+ }
+ return false;
+ }
Review Comment:
I think it's fine, the client trying to probe could also have it's own time
based looping. Scripting can usually do that so we are good. Let me make this
change. Thanks
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]