You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2021/07/20 06:45:35 UTC

[GitHub] [ozone] ChenSammi commented on a change in pull request #2420: HDDS-5360. DN failed to process all delete block commands in one heartbeat interval

ChenSammi commented on a change in pull request #2420:
URL: https://github.com/apache/ozone/pull/2420#discussion_r672849623



##########
File path: hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/DeleteBlocksCommandHandler.java
##########
@@ -115,56 +201,71 @@ public void handle(SCMCommand command, OzoneContainer container,
 
       ContainerBlocksDeletionACKProto.Builder resultBuilder =
           ContainerBlocksDeletionACKProto.newBuilder();
-      containerBlocks.forEach(entry -> {
-        DeleteBlockTransactionResult.Builder txResultBuilder =
-            DeleteBlockTransactionResult.newBuilder();
-        txResultBuilder.setTxID(entry.getTxID());
-        long containerId = entry.getContainerID();
-        int newDeletionBlocks = 0;
-        try {
-          Container cont = containerSet.getContainer(containerId);
-          if (cont == null) {
-            throw new StorageContainerException("Unable to find the container "
-                + containerId, CONTAINER_NOT_FOUND);
-          }
-          ContainerProtos.ContainerType containerType = cont.getContainerType();
-          switch (containerType) {
-          case KeyValueContainer:
-            KeyValueContainerData containerData = (KeyValueContainerData)
-                cont.getContainerData();
-            cont.writeLock();
-            try {
-              if (containerData.getSchemaVersion().equals(SCHEMA_V1)) {
-                markBlocksForDeletionSchemaV1(containerData, entry);
-              } else if (containerData.getSchemaVersion().equals(SCHEMA_V2)) {
-                markBlocksForDeletionSchemaV2(containerData, entry,
-                    newDeletionBlocks, entry.getTxID());
-              } else {
-                throw new UnsupportedOperationException(
-                    "Only schema version 1 and schema version 2 are "
-                        + "supported.");
+      List<Future> futures = new ArrayList<>();
+      for (int i = 0; i < containerBlocks.size(); i++) {
+        DeletedBlocksTransaction tx = containerBlocks.get(i);
+        Future future = executor.submit(() -> {

Review comment:
       Sure.  I refactored the code. 




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