You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by sh...@apache.org on 2021/10/13 08:36:12 UTC

[ozone] branch master updated: HDDS-5831. Remove empty TaskQueue in ContainerStateMachine. (#2716)

This is an automated email from the ASF dual-hosted git repository.

shashikant pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new ae812c06 HDDS-5831. Remove empty TaskQueue in ContainerStateMachine. (#2716)
ae812c06 is described below

commit ae812c06ec2fbbb61956bea45c4e70e785b0eac4
Author: Tsz-Wo Nicholas Sze <sz...@apache.org>
AuthorDate: Wed Oct 13 16:35:57 2021 +0800

    HDDS-5831. Remove empty TaskQueue in ContainerStateMachine. (#2716)
---
 .../common/transport/server/ratis/ContainerStateMachine.java       | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/ContainerStateMachine.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/ContainerStateMachine.java
index c1c0c4e..3b35c97 100644
--- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/ContainerStateMachine.java
+++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/ContainerStateMachine.java
@@ -728,7 +728,12 @@ public class ContainerStateMachine extends BaseStateMachine {
             throw e;
           }
         };
-    return queue.submit(task, executor);
+    final CompletableFuture<ContainerCommandResponseProto> f
+        = queue.submit(task, executor);
+    // after the task is completed, remove the queue if the queue is empty.
+    f.thenAccept(dummy -> containerTaskQueues.computeIfPresent(containerId,
+        (id, q) -> q.isEmpty()? null: q));
+    return f;
   }
 
   /*

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