From 2eb7246ea754af456350723e5ea8ec397c1eb1f5 Mon Sep 17 00:00:00 2001 From: hfutatzhanghb Date: Thu, 21 Mar 2024 11:41:35 +0800 Subject: [PATCH] HDFS-17433. metrics sumOfActorCommandQueueLength should only record valid commands. (#6644) --- .../apache/hadoop/hdfs/server/datanode/BPServiceActor.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java index 462b9df3c9..da30d05796 100755 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java @@ -1487,8 +1487,10 @@ void enqueue(List cmds) throws InterruptedException { } void enqueue(DatanodeCommand[] cmds) throws InterruptedException { - queue.put(() -> processCommand(cmds)); - dn.getMetrics().incrActorCmdQueueLength(1); + if (cmds.length != 0) { + queue.put(() -> processCommand(cmds)); + dn.getMetrics().incrActorCmdQueueLength(1); + } } }