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 2020/11/09 10:50:20 UTC

[GitHub] [ozone] aryangupta1998 opened a new pull request #1561: HDDS-4426. SCM should create transactions using all blocks received f…

aryangupta1998 opened a new pull request #1561:
URL: https://github.com/apache/ozone/pull/1561


   …rom OM.
   
   ## What changes were proposed in this pull request?
   
   Currently, SCM creates a transaction per key deleted by OM. If OM is deleting 1000 keys then SCM should create transaction using all these keys i.e. segregate the blocks by containerID and then create transactions per containerID.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-4426
   
   ## How was this patch tested?
   
   Tested Manually 


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

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


[GitHub] [ozone] lokeshj1703 commented on a change in pull request #1561: HDDS-4426. SCM should create transactions using all blocks received from OM

Posted by GitBox <gi...@apache.org>.
lokeshj1703 commented on a change in pull request #1561:
URL: https://github.com/apache/ozone/pull/1561#discussion_r522674905



##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/BlockManagerImpl.java
##########
@@ -285,28 +286,30 @@ private AllocatedBlock newBlock(ContainerInfo containerInfo) {
    * successful, given blocks are
    * entering pending deletion state and becomes invisible from SCM namespace.
    *
-   * @param blockIDs block IDs. This is often the list of blocks of a
-   * particular object key.
+   * @param keyBlocksInfoList . This is the list of BlockGroup which contains
+   * groupID of keys and list of BlockIDs associated with them.
    * @throws IOException if exception happens, non of the blocks is deleted.
    */
   @Override
-  public void deleteBlocks(List<BlockID> blockIDs) throws IOException {
+  public void deleteBlocks(List<BlockGroup> keyBlocksInfoList)
+          throws IOException {
     ScmUtils.preCheck(ScmOps.deleteBlock, safeModePrecheck);
 
-    LOG.info("Deleting blocks {}", StringUtils.join(",", blockIDs));
     Map<Long, List<Long>> containerBlocks = new HashMap<>();
     // TODO: track the block size info so that we can reclaim the container
     // TODO: used space when the block is deleted.
-    for (BlockID block : blockIDs) {
-      // Merge blocks to a container to blocks mapping,
-      // prepare to persist this info to the deletedBlocksLog.
-      long containerID = block.getContainerID();
-      if (containerBlocks.containsKey(containerID)) {
-        containerBlocks.get(containerID).add(block.getLocalID());
-      } else {
-        List<Long> item = new ArrayList<>();
-        item.add(block.getLocalID());
-        containerBlocks.put(containerID, item);
+    for(BlockGroup bg : keyBlocksInfoList){

Review comment:
       NIT: There should be a space between brackets. I think there are similar adjustments in the entire patch.
   ```suggestion
       for (BlockGroup bg : keyBlocksInfoList) { 
   ```




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

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


[GitHub] [ozone] lokeshj1703 commented on a change in pull request #1561: HDDS-4426. SCM should create transactions using all blocks received from OM

Posted by GitBox <gi...@apache.org>.
lokeshj1703 commented on a change in pull request #1561:
URL: https://github.com/apache/ozone/pull/1561#discussion_r521140093



##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMBlockProtocolServer.java
##########
@@ -224,54 +224,49 @@ public void join() throws InterruptedException {
     }
     List<DeleteBlockGroupResult> results = new ArrayList<>();
     Map<String, String> auditMap = Maps.newHashMap();
-    for (BlockGroup keyBlocks : keyBlocksInfoList) {
-      ScmBlockLocationProtocolProtos.DeleteScmBlockResult.Result resultCode;
-      try {
-        // We delete blocks in an atomic operation to prevent getting
-        // into state like only a partial of blocks are deleted,
-        // which will leave key in an inconsistent state.
-        auditMap.put("keyBlockToDelete", keyBlocks.toString());
-        scm.getScmBlockManager().deleteBlocks(keyBlocks.getBlockIDList());
-        resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
-            .Result.success;
-        AUDIT.logWriteSuccess(
-            buildAuditMessageForSuccess(SCMAction.DELETE_KEY_BLOCK, auditMap)
-        );
-      } catch (SCMException scmEx) {
-        LOG.warn("Fail to delete block: {}", keyBlocks.getGroupID(), scmEx);
-        AUDIT.logWriteFailure(
-            buildAuditMessageForFailure(SCMAction.DELETE_KEY_BLOCK, auditMap,
-                scmEx)
-        );
-        switch (scmEx.getResult()) {
-        case SAFE_MODE_EXCEPTION:
-          resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
-              .Result.safeMode;
-          break;
-        case FAILED_TO_FIND_BLOCK:
-          resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
-              .Result.errorNotFound;
-          break;
-        default:
-          resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
-              .Result.unknownFailure;
-        }
-      } catch (IOException ex) {
-        LOG.warn("Fail to delete blocks for object key: {}", keyBlocks
-            .getGroupID(), ex);
-        AUDIT.logWriteFailure(
-            buildAuditMessageForFailure(SCMAction.DELETE_KEY_BLOCK, auditMap,
-                ex)
-        );
-        resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
-            .Result.unknownFailure;
+    ScmBlockLocationProtocolProtos.DeleteScmBlockResult.Result codeResult;
+    try{
+      scm.getScmBlockManager().deleteBlocks(keyBlocksInfoList);
+      codeResult = ScmBlockLocationProtocolProtos.
+              DeleteScmBlockResult.Result.success;
+      AUDIT.logReadSuccess(buildAuditMessageForSuccess(

Review comment:
       This should be logWriteSuccess.

##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/BlockManagerImpl.java
##########
@@ -315,8 +318,8 @@ public void deleteBlocks(List<BlockID> blockIDs) throws IOException {
     } catch (IOException e) {
       throw new IOException(
           "Skip writing the deleted blocks info to"
-              + " the delLog because addTransaction fails. Batch skipped: "
-              + StringUtils.join(",", blockIDs), e);
+              + " the delLog because addTransaction fails. Keys skipped: "
+              + keyBlocksInfoList.size(), e);

Review comment:
       ```suggestion
                 + " the delLog because addTransaction fails. " + keyBlocksInfoList.size() + " Keys skipped", e);
   ```

##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMBlockProtocolServer.java
##########
@@ -224,54 +224,49 @@ public void join() throws InterruptedException {
     }
     List<DeleteBlockGroupResult> results = new ArrayList<>();
     Map<String, String> auditMap = Maps.newHashMap();
-    for (BlockGroup keyBlocks : keyBlocksInfoList) {
-      ScmBlockLocationProtocolProtos.DeleteScmBlockResult.Result resultCode;
-      try {
-        // We delete blocks in an atomic operation to prevent getting
-        // into state like only a partial of blocks are deleted,
-        // which will leave key in an inconsistent state.
-        auditMap.put("keyBlockToDelete", keyBlocks.toString());
-        scm.getScmBlockManager().deleteBlocks(keyBlocks.getBlockIDList());
-        resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
-            .Result.success;
-        AUDIT.logWriteSuccess(
-            buildAuditMessageForSuccess(SCMAction.DELETE_KEY_BLOCK, auditMap)
-        );
-      } catch (SCMException scmEx) {
-        LOG.warn("Fail to delete block: {}", keyBlocks.getGroupID(), scmEx);
-        AUDIT.logWriteFailure(
-            buildAuditMessageForFailure(SCMAction.DELETE_KEY_BLOCK, auditMap,
-                scmEx)
-        );
-        switch (scmEx.getResult()) {
-        case SAFE_MODE_EXCEPTION:
-          resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
-              .Result.safeMode;
-          break;
-        case FAILED_TO_FIND_BLOCK:
-          resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
-              .Result.errorNotFound;
-          break;
-        default:
-          resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
-              .Result.unknownFailure;
-        }
-      } catch (IOException ex) {
-        LOG.warn("Fail to delete blocks for object key: {}", keyBlocks
-            .getGroupID(), ex);
-        AUDIT.logWriteFailure(
-            buildAuditMessageForFailure(SCMAction.DELETE_KEY_BLOCK, auditMap,
-                ex)
-        );
-        resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
-            .Result.unknownFailure;
+    ScmBlockLocationProtocolProtos.DeleteScmBlockResult.Result codeResult;

Review comment:
       Can we rename codeResult to just result?

##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMBlockProtocolServer.java
##########
@@ -224,54 +224,49 @@ public void join() throws InterruptedException {
     }
     List<DeleteBlockGroupResult> results = new ArrayList<>();
     Map<String, String> auditMap = Maps.newHashMap();
-    for (BlockGroup keyBlocks : keyBlocksInfoList) {
-      ScmBlockLocationProtocolProtos.DeleteScmBlockResult.Result resultCode;
-      try {
-        // We delete blocks in an atomic operation to prevent getting
-        // into state like only a partial of blocks are deleted,
-        // which will leave key in an inconsistent state.
-        auditMap.put("keyBlockToDelete", keyBlocks.toString());
-        scm.getScmBlockManager().deleteBlocks(keyBlocks.getBlockIDList());
-        resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
-            .Result.success;
-        AUDIT.logWriteSuccess(
-            buildAuditMessageForSuccess(SCMAction.DELETE_KEY_BLOCK, auditMap)
-        );
-      } catch (SCMException scmEx) {
-        LOG.warn("Fail to delete block: {}", keyBlocks.getGroupID(), scmEx);
-        AUDIT.logWriteFailure(
-            buildAuditMessageForFailure(SCMAction.DELETE_KEY_BLOCK, auditMap,
-                scmEx)
-        );
-        switch (scmEx.getResult()) {
-        case SAFE_MODE_EXCEPTION:
-          resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
-              .Result.safeMode;
-          break;
-        case FAILED_TO_FIND_BLOCK:
-          resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
-              .Result.errorNotFound;
-          break;
-        default:
-          resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
-              .Result.unknownFailure;
-        }
-      } catch (IOException ex) {
-        LOG.warn("Fail to delete blocks for object key: {}", keyBlocks
-            .getGroupID(), ex);
-        AUDIT.logWriteFailure(
-            buildAuditMessageForFailure(SCMAction.DELETE_KEY_BLOCK, auditMap,
-                ex)
-        );
-        resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
-            .Result.unknownFailure;
+    ScmBlockLocationProtocolProtos.DeleteScmBlockResult.Result codeResult;
+    try{
+      scm.getScmBlockManager().deleteBlocks(keyBlocksInfoList);
+      codeResult = ScmBlockLocationProtocolProtos.
+              DeleteScmBlockResult.Result.success;
+      AUDIT.logReadSuccess(buildAuditMessageForSuccess(
+              SCMAction.DELETE_KEY_BLOCK, auditMap));
+    } catch (SCMException scmEx){
+      LOG.warn("Fail to delete {} keys", keyBlocksInfoList.size(), scmEx);
+      AUDIT.logWriteFailure(
+              buildAuditMessageForFailure(SCMAction.DELETE_KEY_BLOCK, auditMap,
+                      scmEx)
+      );
+      switch (scmEx.getResult()) {
+      case SAFE_MODE_EXCEPTION:
+        codeResult = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
+                .Result.safeMode;
+        break;
+      case FAILED_TO_FIND_BLOCK:
+        codeResult = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
+                .Result.errorNotFound;
+        break;
+      default:
+        codeResult = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
+                .Result.unknownFailure;
       }
-      List<DeleteBlockResult> blockResultList = new ArrayList<>();
-      for (BlockID blockKey : keyBlocks.getBlockIDList()) {
-        blockResultList.add(new DeleteBlockResult(blockKey, resultCode));
+    } catch (IOException ex){
+      LOG.warn("Fail to delete {} keys", keyBlocksInfoList.size(), ex);
+      AUDIT.logWriteFailure(
+              buildAuditMessageForFailure(SCMAction.DELETE_KEY_BLOCK, auditMap,
+                      ex)
+      );
+      codeResult = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
+              .Result.unknownFailure;
+    }
+    for(BlockGroup bg : keyBlocksInfoList){
+      auditMap.put("KeyBlockToDelete", bg.toString());

Review comment:
       auditMap is used in the audit log messages. So we will have to populate it before the audit log calls.




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

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


[GitHub] [ozone] aryangupta1998 commented on a change in pull request #1561: HDDS-4426. SCM should create transactions using all blocks received from OM

Posted by GitBox <gi...@apache.org>.
aryangupta1998 commented on a change in pull request #1561:
URL: https://github.com/apache/ozone/pull/1561#discussion_r521188665



##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/BlockManagerImpl.java
##########
@@ -315,8 +318,8 @@ public void deleteBlocks(List<BlockID> blockIDs) throws IOException {
     } catch (IOException e) {
       throw new IOException(
           "Skip writing the deleted blocks info to"
-              + " the delLog because addTransaction fails. Batch skipped: "
-              + StringUtils.join(",", blockIDs), e);
+              + " the delLog because addTransaction fails. Keys skipped: "
+              + keyBlocksInfoList.size(), e);

Review comment:
       Made suggested changes.




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

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


[GitHub] [ozone] aryangupta1998 commented on a change in pull request #1561: HDDS-4426. SCM should create transactions using all blocks received from OM

Posted by GitBox <gi...@apache.org>.
aryangupta1998 commented on a change in pull request #1561:
URL: https://github.com/apache/ozone/pull/1561#discussion_r521349466



##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMBlockProtocolServer.java
##########
@@ -224,54 +224,49 @@ public void join() throws InterruptedException {
     }
     List<DeleteBlockGroupResult> results = new ArrayList<>();
     Map<String, String> auditMap = Maps.newHashMap();
-    for (BlockGroup keyBlocks : keyBlocksInfoList) {
-      ScmBlockLocationProtocolProtos.DeleteScmBlockResult.Result resultCode;
-      try {
-        // We delete blocks in an atomic operation to prevent getting
-        // into state like only a partial of blocks are deleted,
-        // which will leave key in an inconsistent state.
-        auditMap.put("keyBlockToDelete", keyBlocks.toString());
-        scm.getScmBlockManager().deleteBlocks(keyBlocks.getBlockIDList());
-        resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
-            .Result.success;
-        AUDIT.logWriteSuccess(
-            buildAuditMessageForSuccess(SCMAction.DELETE_KEY_BLOCK, auditMap)
-        );
-      } catch (SCMException scmEx) {
-        LOG.warn("Fail to delete block: {}", keyBlocks.getGroupID(), scmEx);
-        AUDIT.logWriteFailure(
-            buildAuditMessageForFailure(SCMAction.DELETE_KEY_BLOCK, auditMap,
-                scmEx)
-        );
-        switch (scmEx.getResult()) {
-        case SAFE_MODE_EXCEPTION:
-          resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
-              .Result.safeMode;
-          break;
-        case FAILED_TO_FIND_BLOCK:
-          resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
-              .Result.errorNotFound;
-          break;
-        default:
-          resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
-              .Result.unknownFailure;
-        }
-      } catch (IOException ex) {
-        LOG.warn("Fail to delete blocks for object key: {}", keyBlocks
-            .getGroupID(), ex);
-        AUDIT.logWriteFailure(
-            buildAuditMessageForFailure(SCMAction.DELETE_KEY_BLOCK, auditMap,
-                ex)
-        );
-        resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
-            .Result.unknownFailure;
+    ScmBlockLocationProtocolProtos.DeleteScmBlockResult.Result codeResult;
+    try{
+      scm.getScmBlockManager().deleteBlocks(keyBlocksInfoList);
+      codeResult = ScmBlockLocationProtocolProtos.
+              DeleteScmBlockResult.Result.success;
+      AUDIT.logReadSuccess(buildAuditMessageForSuccess(
+              SCMAction.DELETE_KEY_BLOCK, auditMap));
+    } catch (SCMException scmEx){
+      LOG.warn("Fail to delete {} keys", keyBlocksInfoList.size(), scmEx);
+      AUDIT.logWriteFailure(
+              buildAuditMessageForFailure(SCMAction.DELETE_KEY_BLOCK, auditMap,
+                      scmEx)
+      );
+      switch (scmEx.getResult()) {
+      case SAFE_MODE_EXCEPTION:
+        codeResult = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
+                .Result.safeMode;
+        break;
+      case FAILED_TO_FIND_BLOCK:
+        codeResult = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
+                .Result.errorNotFound;
+        break;
+      default:
+        codeResult = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
+                .Result.unknownFailure;
       }
-      List<DeleteBlockResult> blockResultList = new ArrayList<>();
-      for (BlockID blockKey : keyBlocks.getBlockIDList()) {
-        blockResultList.add(new DeleteBlockResult(blockKey, resultCode));
+    } catch (IOException ex){
+      LOG.warn("Fail to delete {} keys", keyBlocksInfoList.size(), ex);
+      AUDIT.logWriteFailure(
+              buildAuditMessageForFailure(SCMAction.DELETE_KEY_BLOCK, auditMap,
+                      ex)
+      );
+      codeResult = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
+              .Result.unknownFailure;
+    }
+    for(BlockGroup bg : keyBlocksInfoList){
+      auditMap.put("KeyBlockToDelete", bg.toString());

Review comment:
       Please refer to the new changes.




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

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


[GitHub] [ozone] aryangupta1998 commented on a change in pull request #1561: HDDS-4426. SCM should create transactions using all blocks received from OM

Posted by GitBox <gi...@apache.org>.
aryangupta1998 commented on a change in pull request #1561:
URL: https://github.com/apache/ozone/pull/1561#discussion_r521188948



##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMBlockProtocolServer.java
##########
@@ -224,54 +224,49 @@ public void join() throws InterruptedException {
     }
     List<DeleteBlockGroupResult> results = new ArrayList<>();
     Map<String, String> auditMap = Maps.newHashMap();
-    for (BlockGroup keyBlocks : keyBlocksInfoList) {
-      ScmBlockLocationProtocolProtos.DeleteScmBlockResult.Result resultCode;
-      try {
-        // We delete blocks in an atomic operation to prevent getting
-        // into state like only a partial of blocks are deleted,
-        // which will leave key in an inconsistent state.
-        auditMap.put("keyBlockToDelete", keyBlocks.toString());
-        scm.getScmBlockManager().deleteBlocks(keyBlocks.getBlockIDList());
-        resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
-            .Result.success;
-        AUDIT.logWriteSuccess(
-            buildAuditMessageForSuccess(SCMAction.DELETE_KEY_BLOCK, auditMap)
-        );
-      } catch (SCMException scmEx) {
-        LOG.warn("Fail to delete block: {}", keyBlocks.getGroupID(), scmEx);
-        AUDIT.logWriteFailure(
-            buildAuditMessageForFailure(SCMAction.DELETE_KEY_BLOCK, auditMap,
-                scmEx)
-        );
-        switch (scmEx.getResult()) {
-        case SAFE_MODE_EXCEPTION:
-          resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
-              .Result.safeMode;
-          break;
-        case FAILED_TO_FIND_BLOCK:
-          resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
-              .Result.errorNotFound;
-          break;
-        default:
-          resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
-              .Result.unknownFailure;
-        }
-      } catch (IOException ex) {
-        LOG.warn("Fail to delete blocks for object key: {}", keyBlocks
-            .getGroupID(), ex);
-        AUDIT.logWriteFailure(
-            buildAuditMessageForFailure(SCMAction.DELETE_KEY_BLOCK, auditMap,
-                ex)
-        );
-        resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
-            .Result.unknownFailure;
+    ScmBlockLocationProtocolProtos.DeleteScmBlockResult.Result codeResult;
+    try{
+      scm.getScmBlockManager().deleteBlocks(keyBlocksInfoList);
+      codeResult = ScmBlockLocationProtocolProtos.
+              DeleteScmBlockResult.Result.success;
+      AUDIT.logReadSuccess(buildAuditMessageForSuccess(

Review comment:
       Changed.




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

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


[GitHub] [ozone] aryangupta1998 commented on a change in pull request #1561: HDDS-4426. SCM should create transactions using all blocks received from OM

Posted by GitBox <gi...@apache.org>.
aryangupta1998 commented on a change in pull request #1561:
URL: https://github.com/apache/ozone/pull/1561#discussion_r521188838



##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMBlockProtocolServer.java
##########
@@ -224,54 +224,49 @@ public void join() throws InterruptedException {
     }
     List<DeleteBlockGroupResult> results = new ArrayList<>();
     Map<String, String> auditMap = Maps.newHashMap();
-    for (BlockGroup keyBlocks : keyBlocksInfoList) {
-      ScmBlockLocationProtocolProtos.DeleteScmBlockResult.Result resultCode;
-      try {
-        // We delete blocks in an atomic operation to prevent getting
-        // into state like only a partial of blocks are deleted,
-        // which will leave key in an inconsistent state.
-        auditMap.put("keyBlockToDelete", keyBlocks.toString());
-        scm.getScmBlockManager().deleteBlocks(keyBlocks.getBlockIDList());
-        resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
-            .Result.success;
-        AUDIT.logWriteSuccess(
-            buildAuditMessageForSuccess(SCMAction.DELETE_KEY_BLOCK, auditMap)
-        );
-      } catch (SCMException scmEx) {
-        LOG.warn("Fail to delete block: {}", keyBlocks.getGroupID(), scmEx);
-        AUDIT.logWriteFailure(
-            buildAuditMessageForFailure(SCMAction.DELETE_KEY_BLOCK, auditMap,
-                scmEx)
-        );
-        switch (scmEx.getResult()) {
-        case SAFE_MODE_EXCEPTION:
-          resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
-              .Result.safeMode;
-          break;
-        case FAILED_TO_FIND_BLOCK:
-          resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
-              .Result.errorNotFound;
-          break;
-        default:
-          resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
-              .Result.unknownFailure;
-        }
-      } catch (IOException ex) {
-        LOG.warn("Fail to delete blocks for object key: {}", keyBlocks
-            .getGroupID(), ex);
-        AUDIT.logWriteFailure(
-            buildAuditMessageForFailure(SCMAction.DELETE_KEY_BLOCK, auditMap,
-                ex)
-        );
-        resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult
-            .Result.unknownFailure;
+    ScmBlockLocationProtocolProtos.DeleteScmBlockResult.Result codeResult;

Review comment:
       Renamed to resultCode.




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

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


[GitHub] [ozone] aryangupta1998 commented on pull request #1561: HDDS-4426. SCM should create transactions using all blocks received from OM

Posted by GitBox <gi...@apache.org>.
aryangupta1998 commented on pull request #1561:
URL: https://github.com/apache/ozone/pull/1561#issuecomment-725279758


   > @aryangupta1998 Thanks for working on this! The changes look good to me. Please find my comments below.
   
   @lokeshj1703 Thanks for reviewing the PR.


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

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


[GitHub] [ozone] lokeshj1703 commented on pull request #1561: HDDS-4426. SCM should create transactions using all blocks received from OM

Posted by GitBox <gi...@apache.org>.
lokeshj1703 commented on pull request #1561:
URL: https://github.com/apache/ozone/pull/1561#issuecomment-729512591


   @aryangupta1998 Thanks for the contribution! I have committed the PR to master branch.


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

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


[GitHub] [ozone] lokeshj1703 closed pull request #1561: HDDS-4426. SCM should create transactions using all blocks received from OM

Posted by GitBox <gi...@apache.org>.
lokeshj1703 closed pull request #1561:
URL: https://github.com/apache/ozone/pull/1561


   


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

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


[GitHub] [ozone] aryangupta1998 commented on a change in pull request #1561: HDDS-4426. SCM should create transactions using all blocks received from OM

Posted by GitBox <gi...@apache.org>.
aryangupta1998 commented on a change in pull request #1561:
URL: https://github.com/apache/ozone/pull/1561#discussion_r522887629



##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/BlockManagerImpl.java
##########
@@ -285,28 +286,30 @@ private AllocatedBlock newBlock(ContainerInfo containerInfo) {
    * successful, given blocks are
    * entering pending deletion state and becomes invisible from SCM namespace.
    *
-   * @param blockIDs block IDs. This is often the list of blocks of a
-   * particular object key.
+   * @param keyBlocksInfoList . This is the list of BlockGroup which contains
+   * groupID of keys and list of BlockIDs associated with them.
    * @throws IOException if exception happens, non of the blocks is deleted.
    */
   @Override
-  public void deleteBlocks(List<BlockID> blockIDs) throws IOException {
+  public void deleteBlocks(List<BlockGroup> keyBlocksInfoList)
+          throws IOException {
     ScmUtils.preCheck(ScmOps.deleteBlock, safeModePrecheck);
 
-    LOG.info("Deleting blocks {}", StringUtils.join(",", blockIDs));
     Map<Long, List<Long>> containerBlocks = new HashMap<>();
     // TODO: track the block size info so that we can reclaim the container
     // TODO: used space when the block is deleted.
-    for (BlockID block : blockIDs) {
-      // Merge blocks to a container to blocks mapping,
-      // prepare to persist this info to the deletedBlocksLog.
-      long containerID = block.getContainerID();
-      if (containerBlocks.containsKey(containerID)) {
-        containerBlocks.get(containerID).add(block.getLocalID());
-      } else {
-        List<Long> item = new ArrayList<>();
-        item.add(block.getLocalID());
-        containerBlocks.put(containerID, item);
+    for(BlockGroup bg : keyBlocksInfoList){

Review comment:
       Resolved 




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

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