tomscut commented on code in PR #5349:
URL: https://github.com/apache/hadoop/pull/5349#discussion_r1098077845


##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java:
##########
@@ -3825,14 +3829,37 @@ boolean isRestarting() {
    * @return true - if the data node is fully started
    */
   public boolean isDatanodeFullyStarted() {
+    return isDatanodeFullyStarted(false);
+  }
+
+  /**
+   * A datanode is considered to be fully started if all the BP threads are
+   * alive and all the block pools are initialized. If 
checkConnectionToActiveNamenode is true,
+   * the datanode is considered to be fully started if it is also heartbeating 
to
+   * active namenode in addition to the above-mentioned conditions.
+   *
+   * @param checkConnectionToActiveNamenode if true, performs additional check 
of whether datanode
+   * is heartbeating to active namenode.
+   * @return true if the datanode is fully started and also conditionally 
connected to active
+   * namenode, false otherwise.
+   */
+  public boolean isDatanodeFullyStarted(boolean 
checkConnectionToActiveNamenode) {
+    if (checkConnectionToActiveNamenode) {

Review Comment:
   nit: Can we put the judgment inside the loop, so that we only need to loop 
once?



-- 
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]

Reply via email to