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



##########
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:
       this is hard to read. Can you move out this Callable?




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