You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "Gargi-jais11 (via GitHub)" <gi...@apache.org> on 2025/04/15 05:39:42 UTC

[PR] HDDS-12796. [DiskBalancer] Exclude UNHEALTHY DNs from status subcommand output [ozone]

Gargi-jais11 opened a new pull request, #8286:
URL: https://github.com/apache/ozone/pull/8286

   ## What changes were proposed in this pull request?
   Currently when any DN goes down or is in Unhealthy State, DiskBalancer reportSubcommand is only showing reports of Healthy DNs which is correct.
   But DiskBalancer statusSubCommand is showing even Unhealthy DNs with status as RUNNING which is misleading.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-12796
   
   ## How was this patch tested?
   
   Added unit test.
   


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-12796. [DiskBalancer] Exclude UNHEALTHY DNs from status subcommand output [ozone]

Posted by "Gargi-jais11 (via GitHub)" <gi...@apache.org>.
Gargi-jais11 commented on code in PR #8286:
URL: https://github.com/apache/ozone/pull/8286#discussion_r2046332118


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/DiskBalancerManager.java:
##########
@@ -120,7 +120,8 @@ public List<HddsProtos.DatanodeDiskBalancerInfoProto> getDiskBalancerStatus(
           .map(dn -> getInfoProto(dn, clientVersion))
           .collect(Collectors.toList());
     } else {
-      return nodeManager.getAllNodes().stream()
+      return nodeManager.getNodes(IN_SERVICE,
+              HddsProtos.NodeState.HEALTHY).stream()

Review Comment:
   No 



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-12796. [DiskBalancer] Exclude UNHEALTHY DNs from status subcommand output [ozone]

Posted by "Gargi-jais11 (via GitHub)" <gi...@apache.org>.
Gargi-jais11 commented on code in PR #8286:
URL: https://github.com/apache/ozone/pull/8286#discussion_r2044273656


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/DiskBalancerManager.java:
##########
@@ -333,6 +334,22 @@ public void processDiskBalancerReport(DiskBalancerReportProto reportProto,
     }
   }
 
+  public void markStatusUnknown(DatanodeDetails dn) {
+    DiskBalancerStatus currentStatus = statusMap.get(dn);
+    if (currentStatus != null &&
+        currentStatus.getRunningStatus() != DiskBalancerRunningStatus.UNKNOWN) {
+      DiskBalancerStatus unknownStatus = new DiskBalancerStatus(
+          DiskBalancerRunningStatus.UNKNOWN,
+          currentStatus.getDiskBalancerConfiguration(),

Review Comment:
   Ok



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-12796. [DiskBalancer] Exclude UNHEALTHY DNs from status subcommand output [ozone]

Posted by "ChenSammi (via GitHub)" <gi...@apache.org>.
ChenSammi commented on code in PR #8286:
URL: https://github.com/apache/ozone/pull/8286#discussion_r2044240950


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/DiskBalancerDeadNodeHandler.java:
##########
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hdds.scm.node;
+
+import org.apache.hadoop.hdds.protocol.DatanodeDetails;
+import org.apache.hadoop.hdds.server.events.EventHandler;
+import org.apache.hadoop.hdds.server.events.EventPublisher;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Updates the DiskBalancer status of a datanode to UNKNOWN when the datanode is marked dead.
+ *
+ * This handler listens for DEAD_NODE events and ensures that DiskBalancer
+ * does not retain outdated state for unreachable datanodes.
+ */
+
+public class DiskBalancerDeadNodeHandler implements EventHandler<DatanodeDetails> {
+
+  private static final Logger LOG = LoggerFactory.getLogger(DiskBalancerDeadNodeHandler.class);
+  private final DiskBalancerManager diskBalancerManager;
+
+  public DiskBalancerDeadNodeHandler(DiskBalancerManager diskBalancerManager) {
+    this.diskBalancerManager = diskBalancerManager;
+  }
+
+  @Override
+  public void onMessage(DatanodeDetails datanodeDetails, EventPublisher publisher) {

Review Comment:
   Please reuse DeadNodeHandler, you can pass the diskBalancerManager into DeadNodeHandler. 



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-12796. [DiskBalancer] Exclude UNHEALTHY DNs from status subcommand output [ozone]

Posted by "ChenSammi (via GitHub)" <gi...@apache.org>.
ChenSammi merged PR #8286:
URL: https://github.com/apache/ozone/pull/8286


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-12796. [DiskBalancer] Exclude UNHEALTHY DNs from status subcommand output [ozone]

Posted by "ChenSammi (via GitHub)" <gi...@apache.org>.
ChenSammi commented on code in PR #8286:
URL: https://github.com/apache/ozone/pull/8286#discussion_r2044239247


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/DiskBalancerManager.java:
##########
@@ -333,6 +334,22 @@ public void processDiskBalancerReport(DiskBalancerReportProto reportProto,
     }
   }
 
+  public void markStatusUnknown(DatanodeDetails dn) {
+    DiskBalancerStatus currentStatus = statusMap.get(dn);
+    if (currentStatus != null &&
+        currentStatus.getRunningStatus() != DiskBalancerRunningStatus.UNKNOWN) {
+      DiskBalancerStatus unknownStatus = new DiskBalancerStatus(
+          DiskBalancerRunningStatus.UNKNOWN,
+          currentStatus.getDiskBalancerConfiguration(),

Review Comment:
   new DiskBalancerStatus(DiskBalancerRunningStatus.UNKNOWN, new DiskBalancerConfiguration(), 0, 0, 0, 0))



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-12796. [DiskBalancer] Exclude UNHEALTHY DNs from status subcommand output [ozone]

Posted by "Gargi-jais11 (via GitHub)" <gi...@apache.org>.
Gargi-jais11 commented on code in PR #8286:
URL: https://github.com/apache/ozone/pull/8286#discussion_r2046357623


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/DiskBalancerDeadNodeHandler.java:
##########
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hdds.scm.node;
+
+import org.apache.hadoop.hdds.protocol.DatanodeDetails;
+import org.apache.hadoop.hdds.server.events.EventHandler;
+import org.apache.hadoop.hdds.server.events.EventPublisher;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Updates the DiskBalancer status of a datanode to UNKNOWN when the datanode is marked dead.
+ *
+ * This handler listens for DEAD_NODE events and ensures that DiskBalancer
+ * does not retain outdated state for unreachable datanodes.
+ */
+
+public class DiskBalancerDeadNodeHandler implements EventHandler<DatanodeDetails> {
+
+  private static final Logger LOG = LoggerFactory.getLogger(DiskBalancerDeadNodeHandler.class);
+  private final DiskBalancerManager diskBalancerManager;
+
+  public DiskBalancerDeadNodeHandler(DiskBalancerManager diskBalancerManager) {
+    this.diskBalancerManager = diskBalancerManager;
+  }
+
+  @Override
+  public void onMessage(DatanodeDetails datanodeDetails, EventPublisher publisher) {

Review Comment:
   yes I have done that. Just fixing the unit test failure.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-12796. [DiskBalancer] Exclude UNHEALTHY DNs from status subcommand output [ozone]

Posted by "ChenSammi (via GitHub)" <gi...@apache.org>.
ChenSammi commented on code in PR #8286:
URL: https://github.com/apache/ozone/pull/8286#discussion_r2052124644


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/DeadNodeHandler.java:
##########
@@ -51,23 +51,33 @@ public class DeadNodeHandler implements EventHandler<DatanodeDetails> {
   private final ContainerManager containerManager;
   @Nullable
   private final DeletedBlockLog deletedBlockLog;
+  private final DiskBalancerManager diskBalancerManager;

Review Comment:
   Please add @Nullable for diskBalancerManager, and check whether diskBalancerManager is null in the below onMessag() logic. 



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-12796. [DiskBalancer] Exclude UNHEALTHY DNs from status subcommand output [ozone]

Posted by "Gargi-jais11 (via GitHub)" <gi...@apache.org>.
Gargi-jais11 commented on code in PR #8286:
URL: https://github.com/apache/ozone/pull/8286#discussion_r2044291322


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/DiskBalancerDeadNodeHandler.java:
##########
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hdds.scm.node;
+
+import org.apache.hadoop.hdds.protocol.DatanodeDetails;
+import org.apache.hadoop.hdds.server.events.EventHandler;
+import org.apache.hadoop.hdds.server.events.EventPublisher;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Updates the DiskBalancer status of a datanode to UNKNOWN when the datanode is marked dead.
+ *
+ * This handler listens for DEAD_NODE events and ensures that DiskBalancer
+ * does not retain outdated state for unreachable datanodes.
+ */
+
+public class DiskBalancerDeadNodeHandler implements EventHandler<DatanodeDetails> {
+
+  private static final Logger LOG = LoggerFactory.getLogger(DiskBalancerDeadNodeHandler.class);
+  private final DiskBalancerManager diskBalancerManager;
+
+  public DiskBalancerDeadNodeHandler(DiskBalancerManager diskBalancerManager) {
+    this.diskBalancerManager = diskBalancerManager;
+  }
+
+  @Override
+  public void onMessage(DatanodeDetails datanodeDetails, EventPublisher publisher) {

Review Comment:
   Actually ReconDeadNodeHandler is inheriting from DeadNodeHandler. So if I add DiskBalancerManager in DeadNodeHandler even in recon side I have to do changes. I doubt is it good to add this change there. That's the reason I created new handler. If you still suggest to reuse deadNodeHandler, will do this.
   



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-12796. [DiskBalancer] Exclude UNHEALTHY DNs from status subcommand output [ozone]

Posted by "ChenSammi (via GitHub)" <gi...@apache.org>.
ChenSammi commented on code in PR #8286:
URL: https://github.com/apache/ozone/pull/8286#discussion_r2046305621


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/DiskBalancerDeadNodeHandler.java:
##########
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hdds.scm.node;
+
+import org.apache.hadoop.hdds.protocol.DatanodeDetails;
+import org.apache.hadoop.hdds.server.events.EventHandler;
+import org.apache.hadoop.hdds.server.events.EventPublisher;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Updates the DiskBalancer status of a datanode to UNKNOWN when the datanode is marked dead.
+ *
+ * This handler listens for DEAD_NODE events and ensures that DiskBalancer
+ * does not retain outdated state for unreachable datanodes.
+ */
+
+public class DiskBalancerDeadNodeHandler implements EventHandler<DatanodeDetails> {
+
+  private static final Logger LOG = LoggerFactory.getLogger(DiskBalancerDeadNodeHandler.class);
+  private final DiskBalancerManager diskBalancerManager;
+
+  public DiskBalancerDeadNodeHandler(DiskBalancerManager diskBalancerManager) {
+    this.diskBalancerManager = diskBalancerManager;
+  }
+
+  @Override
+  public void onMessage(DatanodeDetails datanodeDetails, EventPublisher publisher) {

Review Comment:
   Yeah, please reuse DeadNodeHandler. 



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-12796. [DiskBalancer] Exclude UNHEALTHY DNs from status subcommand output [ozone]

Posted by "Gargi-jais11 (via GitHub)" <gi...@apache.org>.
Gargi-jais11 commented on code in PR #8286:
URL: https://github.com/apache/ozone/pull/8286#discussion_r2052156597


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/DeadNodeHandler.java:
##########
@@ -51,23 +51,33 @@ public class DeadNodeHandler implements EventHandler<DatanodeDetails> {
   private final ContainerManager containerManager;
   @Nullable
   private final DeletedBlockLog deletedBlockLog;
+  private final DiskBalancerManager diskBalancerManager;

Review Comment:
   Done



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-12796. [DiskBalancer] Exclude UNHEALTHY DNs from status subcommand output [ozone]

Posted by "Gargi-jais11 (via GitHub)" <gi...@apache.org>.
Gargi-jais11 commented on code in PR #8286:
URL: https://github.com/apache/ozone/pull/8286#discussion_r2044291322


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/DiskBalancerDeadNodeHandler.java:
##########
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hdds.scm.node;
+
+import org.apache.hadoop.hdds.protocol.DatanodeDetails;
+import org.apache.hadoop.hdds.server.events.EventHandler;
+import org.apache.hadoop.hdds.server.events.EventPublisher;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Updates the DiskBalancer status of a datanode to UNKNOWN when the datanode is marked dead.
+ *
+ * This handler listens for DEAD_NODE events and ensures that DiskBalancer
+ * does not retain outdated state for unreachable datanodes.
+ */
+
+public class DiskBalancerDeadNodeHandler implements EventHandler<DatanodeDetails> {
+
+  private static final Logger LOG = LoggerFactory.getLogger(DiskBalancerDeadNodeHandler.class);
+  private final DiskBalancerManager diskBalancerManager;
+
+  public DiskBalancerDeadNodeHandler(DiskBalancerManager diskBalancerManager) {
+    this.diskBalancerManager = diskBalancerManager;
+  }
+
+  @Override
+  public void onMessage(DatanodeDetails datanodeDetails, EventPublisher publisher) {

Review Comment:
   Actually ReconDeadNodeHandler is inheriting from DeadNodeHandler. So if I add DiskBalancerManager in DeadNodeHandler even in recon side I have to do changes. I doubt is it good to add this change there.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-12796. [DiskBalancer] Exclude UNHEALTHY DNs from status subcommand output [ozone]

Posted by "ChenSammi (via GitHub)" <gi...@apache.org>.
ChenSammi commented on code in PR #8286:
URL: https://github.com/apache/ozone/pull/8286#discussion_r2046305621


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/DiskBalancerDeadNodeHandler.java:
##########
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hdds.scm.node;
+
+import org.apache.hadoop.hdds.protocol.DatanodeDetails;
+import org.apache.hadoop.hdds.server.events.EventHandler;
+import org.apache.hadoop.hdds.server.events.EventPublisher;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Updates the DiskBalancer status of a datanode to UNKNOWN when the datanode is marked dead.
+ *
+ * This handler listens for DEAD_NODE events and ensures that DiskBalancer
+ * does not retain outdated state for unreachable datanodes.
+ */
+
+public class DiskBalancerDeadNodeHandler implements EventHandler<DatanodeDetails> {
+
+  private static final Logger LOG = LoggerFactory.getLogger(DiskBalancerDeadNodeHandler.class);
+  private final DiskBalancerManager diskBalancerManager;
+
+  public DiskBalancerDeadNodeHandler(DiskBalancerManager diskBalancerManager) {
+    this.diskBalancerManager = diskBalancerManager;
+  }
+
+  @Override
+  public void onMessage(DatanodeDetails datanodeDetails, EventPublisher publisher) {

Review Comment:
   Yeah, please reuse DeadNodeHandler.  Keep the DeadNodeHandler contructor called by ReconDeadNodeHandler then ReconDeadNodeHandler doesn't need any change.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-12796. [DiskBalancer] Exclude UNHEALTHY DNs from status subcommand output [ozone]

Posted by "ChenSammi (via GitHub)" <gi...@apache.org>.
ChenSammi commented on code in PR #8286:
URL: https://github.com/apache/ozone/pull/8286#discussion_r2046313574


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/DiskBalancerManager.java:
##########
@@ -120,7 +120,8 @@ public List<HddsProtos.DatanodeDiskBalancerInfoProto> getDiskBalancerStatus(
           .map(dn -> getInfoProto(dn, clientVersion))
           .collect(Collectors.toList());
     } else {
-      return nodeManager.getAllNodes().stream()
+      return nodeManager.getNodes(IN_SERVICE,
+              HddsProtos.NodeState.HEALTHY).stream()

Review Comment:
   Will report command show data for stale datanode? 



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-12796. [DiskBalancer] Exclude UNHEALTHY DNs from status subcommand output [ozone]

Posted by "ChenSammi (via GitHub)" <gi...@apache.org>.
ChenSammi commented on code in PR #8286:
URL: https://github.com/apache/ozone/pull/8286#discussion_r2044250929


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/DiskBalancerManager.java:
##########
@@ -120,7 +120,8 @@ public List<HddsProtos.DatanodeDiskBalancerInfoProto> getDiskBalancerStatus(
           .map(dn -> getInfoProto(dn, clientVersion))
           .collect(Collectors.toList());
     } else {
-      return nodeManager.getAllNodes().stream()
+      return nodeManager.getNodes(IN_SERVICE,
+              HddsProtos.NodeState.HEALTHY).stream()

Review Comment:
   Shall we consider show STALE state datanode too? 



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-12796. [DiskBalancer] Exclude UNHEALTHY DNs from status subcommand output [ozone]

Posted by "Gargi-jais11 (via GitHub)" <gi...@apache.org>.
Gargi-jais11 commented on code in PR #8286:
URL: https://github.com/apache/ozone/pull/8286#discussion_r2044298114


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/DiskBalancerManager.java:
##########
@@ -120,7 +120,8 @@ public List<HddsProtos.DatanodeDiskBalancerInfoProto> getDiskBalancerStatus(
           .map(dn -> getInfoProto(dn, clientVersion))
           .collect(Collectors.toList());
     } else {
-      return nodeManager.getAllNodes().stream()
+      return nodeManager.getNodes(IN_SERVICE,
+              HddsProtos.NodeState.HEALTHY).stream()

Review Comment:
   If we consider stale datanode then for that also we need to show diskbalancer status as UNKNOWN. But to be consistent with report command it is better to show only healthy nodes.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-12796. [DiskBalancer] Exclude UNHEALTHY DNs from status subcommand output [ozone]

Posted by "ChenSammi (via GitHub)" <gi...@apache.org>.
ChenSammi commented on code in PR #8286:
URL: https://github.com/apache/ozone/pull/8286#discussion_r2044238794


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/DiskBalancerManager.java:
##########
@@ -333,6 +334,22 @@ public void processDiskBalancerReport(DiskBalancerReportProto reportProto,
     }
   }
 
+  public void markStatusUnknown(DatanodeDetails dn) {
+    DiskBalancerStatus currentStatus = statusMap.get(dn);
+    if (currentStatus != null &&
+        currentStatus.getRunningStatus() != DiskBalancerRunningStatus.UNKNOWN) {
+      DiskBalancerStatus unknownStatus = new DiskBalancerStatus(
+          DiskBalancerRunningStatus.UNKNOWN,
+          currentStatus.getDiskBalancerConfiguration(),

Review Comment:
   If the status is unknown, let's show 0 for the rest fields. 



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org