From 48b8991e80435ff671979dda7ea3eb9908c59dc5 Mon Sep 17 00:00:00 2001 From: aryangupta1998 Date: Mon, 9 Nov 2020 16:15:20 +0530 Subject: [PATCH 1/4] HDDS-4426. SCM should create transactions using all blocks received from OM. --- .../hadoop/hdds/scm/block/BlockManager.java | 4 +- .../hdds/scm/block/BlockManagerImpl.java | 35 ++++---- .../scm/server/SCMBlockProtocolServer.java | 87 +++++++++---------- 3 files changed, 62 insertions(+), 64 deletions(-) diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/BlockManager.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/BlockManager.java index b63ee6c54fad..77fe841bf9fa 100644 --- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/BlockManager.java +++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/BlockManager.java @@ -21,12 +21,12 @@ import java.io.IOException; import java.util.List; -import org.apache.hadoop.hdds.client.BlockID; import org.apache.hadoop.hdds.protocol.proto.HddsProtos; import org.apache.hadoop.hdds.scm.container.common.helpers.AllocatedBlock; import org.apache.hadoop.hdds.scm.container.common.helpers.ExcludeList; import org.apache.hadoop.hdds.scm.safemode.SCMSafeModeManager.SafeModeStatus; import org.apache.hadoop.hdds.server.events.EventHandler; +import org.apache.hadoop.ozone.common.BlockGroup; /** * @@ -59,7 +59,7 @@ AllocatedBlock allocateBlock(long size, HddsProtos.ReplicationType type, * a particular object key. * @throws IOException if exception happens, non of the blocks is deleted. */ - void deleteBlocks(List blockIDs) throws IOException; + void deleteBlocks(List blockIDs) throws IOException; /** * @return the block deletion transaction log maintained by SCM. diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/BlockManagerImpl.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/BlockManagerImpl.java index b5b2aafa9ed4..b44e93a23eb8 100644 --- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/BlockManagerImpl.java +++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/BlockManagerImpl.java @@ -50,6 +50,7 @@ import org.apache.hadoop.hdds.server.events.EventPublisher; import org.apache.hadoop.hdds.utils.UniqueId; import org.apache.hadoop.metrics2.util.MBeans; +import org.apache.hadoop.ozone.common.BlockGroup; import org.apache.hadoop.util.StringUtils; import static org.apache.hadoop.hdds.scm.exceptions.SCMException.ResultCodes.INVALID_BLOCK_SIZE; @@ -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 blockIDs) throws IOException { + public void deleteBlocks(List keyBlocksInfoList) + throws IOException { ScmUtils.preCheck(ScmOps.deleteBlock, safeModePrecheck); - LOG.info("Deleting blocks {}", StringUtils.join(",", blockIDs)); Map> 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 item = new ArrayList<>(); - item.add(block.getLocalID()); - containerBlocks.put(containerID, item); + for(BlockGroup bg : keyBlocksInfoList){ + LOG.info("Deleting blocks {}", StringUtils.join( + ",", bg.getBlockIDList())); + for(BlockID block : bg.getBlockIDList()){ + long containerID = block.getContainerID(); + if (containerBlocks.containsKey(containerID)) { + containerBlocks.get(containerID).add(block.getLocalID()); + } else { + List item = new ArrayList<>(); + item.add(block.getLocalID()); + containerBlocks.put(containerID, item); + } } } @@ -315,8 +318,8 @@ public void deleteBlocks(List 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); } // TODO: Container report handling of the deleted blocks: // Remove tombstone and update open container usage. diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMBlockProtocolServer.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMBlockProtocolServer.java index a5d341919675..17c1ad7723aa 100644 --- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMBlockProtocolServer.java +++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMBlockProtocolServer.java @@ -224,54 +224,49 @@ public List deleteKeyBlocks( } List results = new ArrayList<>(); Map 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 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()); + List blockResult = new ArrayList<>(); + for(BlockID b : bg.getBlockIDList()){ + blockResult.add(new DeleteBlockResult(b, codeResult)); } - results.add(new DeleteBlockGroupResult(keyBlocks.getGroupID(), - blockResultList)); + results.add(new DeleteBlockGroupResult(bg.getGroupID(), + blockResult)); } return results; } From 105e3c3a4fefe6632b8f053e2c014c269ef850a6 Mon Sep 17 00:00:00 2001 From: aryangupta1998 Date: Wed, 11 Nov 2020 13:47:19 +0530 Subject: [PATCH 2/4] HDDS-4426. SCM should create transactions using all blocks received from OM - Addressed comments. --- .../hadoop/hdds/scm/block/BlockManagerImpl.java | 4 ++-- .../hdds/scm/server/SCMBlockProtocolServer.java | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/BlockManagerImpl.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/BlockManagerImpl.java index b44e93a23eb8..847110166cd5 100644 --- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/BlockManagerImpl.java +++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/BlockManagerImpl.java @@ -318,8 +318,8 @@ public void deleteBlocks(List keyBlocksInfoList) } catch (IOException e) { throw new IOException( "Skip writing the deleted blocks info to" - + " the delLog because addTransaction fails. Keys skipped: " - + keyBlocksInfoList.size(), e); + + " the delLog because addTransaction fails. " + + keyBlocksInfoList.size() + "Keys skipped", e); } // TODO: Container report handling of the deleted blocks: // Remove tombstone and update open container usage. diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMBlockProtocolServer.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMBlockProtocolServer.java index 17c1ad7723aa..c2d1eeb23acb 100644 --- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMBlockProtocolServer.java +++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMBlockProtocolServer.java @@ -224,12 +224,12 @@ public List deleteKeyBlocks( } List results = new ArrayList<>(); Map auditMap = Maps.newHashMap(); - ScmBlockLocationProtocolProtos.DeleteScmBlockResult.Result codeResult; + ScmBlockLocationProtocolProtos.DeleteScmBlockResult.Result resultCode; try{ scm.getScmBlockManager().deleteBlocks(keyBlocksInfoList); - codeResult = ScmBlockLocationProtocolProtos. + resultCode = ScmBlockLocationProtocolProtos. DeleteScmBlockResult.Result.success; - AUDIT.logReadSuccess(buildAuditMessageForSuccess( + AUDIT.logWriteSuccess(buildAuditMessageForSuccess( SCMAction.DELETE_KEY_BLOCK, auditMap)); } catch (SCMException scmEx){ LOG.warn("Fail to delete {} keys", keyBlocksInfoList.size(), scmEx); @@ -239,15 +239,15 @@ public List deleteKeyBlocks( ); switch (scmEx.getResult()) { case SAFE_MODE_EXCEPTION: - codeResult = ScmBlockLocationProtocolProtos.DeleteScmBlockResult + resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult .Result.safeMode; break; case FAILED_TO_FIND_BLOCK: - codeResult = ScmBlockLocationProtocolProtos.DeleteScmBlockResult + resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult .Result.errorNotFound; break; default: - codeResult = ScmBlockLocationProtocolProtos.DeleteScmBlockResult + resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult .Result.unknownFailure; } } catch (IOException ex){ @@ -256,14 +256,14 @@ public List deleteKeyBlocks( buildAuditMessageForFailure(SCMAction.DELETE_KEY_BLOCK, auditMap, ex) ); - codeResult = ScmBlockLocationProtocolProtos.DeleteScmBlockResult + resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult .Result.unknownFailure; } for(BlockGroup bg : keyBlocksInfoList){ auditMap.put("KeyBlockToDelete", bg.toString()); List blockResult = new ArrayList<>(); for(BlockID b : bg.getBlockIDList()){ - blockResult.add(new DeleteBlockResult(b, codeResult)); + blockResult.add(new DeleteBlockResult(b, resultCode)); } results.add(new DeleteBlockGroupResult(bg.getGroupID(), blockResult)); From 531b65a623a3bbbbb97f0ff2e388ca97c10c94bd Mon Sep 17 00:00:00 2001 From: aryangupta1998 Date: Wed, 11 Nov 2020 18:44:13 +0530 Subject: [PATCH 3/4] HDDS-4426. SCM should create transactions using all blocks received from OM - Addressed comments. --- .../scm/server/SCMBlockProtocolServer.java | 33 +++++++++---------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMBlockProtocolServer.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMBlockProtocolServer.java index c2d1eeb23acb..6171e39ad7bb 100644 --- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMBlockProtocolServer.java +++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMBlockProtocolServer.java @@ -65,6 +65,7 @@ import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_BLOCK_CLIENT_ADDRESS_KEY; import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_HANDLER_COUNT_DEFAULT; import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_HANDLER_COUNT_KEY; +import static org.apache.hadoop.hdds.scm.exceptions.SCMException.ResultCodes.IO_EXCEPTION; import static org.apache.hadoop.hdds.scm.server.StorageContainerManager.startRpcServer; import static org.apache.hadoop.hdds.server.ServerUtils.getRemoteUserName; import static org.apache.hadoop.hdds.server.ServerUtils.updateRPCListenAddress; @@ -225,19 +226,16 @@ public List deleteKeyBlocks( List results = new ArrayList<>(); Map auditMap = Maps.newHashMap(); ScmBlockLocationProtocolProtos.DeleteScmBlockResult.Result resultCode; + Exception e = null; try{ scm.getScmBlockManager().deleteBlocks(keyBlocksInfoList); resultCode = ScmBlockLocationProtocolProtos. DeleteScmBlockResult.Result.success; - AUDIT.logWriteSuccess(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()) { + } catch (IOException ioe){ + e = ioe; + LOG.warn("Fail to delete {} keys", keyBlocksInfoList.size(), ioe); + switch (ioe instanceof SCMException ? ((SCMException) ioe).getResult() : + IO_EXCEPTION) { case SAFE_MODE_EXCEPTION: resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult .Result.safeMode; @@ -250,14 +248,6 @@ public List deleteKeyBlocks( resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult .Result.unknownFailure; } - } catch (IOException ex){ - LOG.warn("Fail to delete {} keys", keyBlocksInfoList.size(), ex); - AUDIT.logWriteFailure( - buildAuditMessageForFailure(SCMAction.DELETE_KEY_BLOCK, auditMap, - ex) - ); - resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult - .Result.unknownFailure; } for(BlockGroup bg : keyBlocksInfoList){ auditMap.put("KeyBlockToDelete", bg.toString()); @@ -268,6 +258,15 @@ public List deleteKeyBlocks( results.add(new DeleteBlockGroupResult(bg.getGroupID(), blockResult)); } + if(e == null){ + AUDIT.logWriteSuccess(buildAuditMessageForSuccess( + SCMAction.DELETE_KEY_BLOCK, auditMap)); + } else{ + AUDIT.logWriteFailure( + buildAuditMessageForFailure(SCMAction.DELETE_KEY_BLOCK, auditMap, + e) + ); + } return results; } From 990badd632798ad4d3ce18bd59be32b0cb882259 Mon Sep 17 00:00:00 2001 From: aryangupta1998 Date: Tue, 17 Nov 2020 16:56:07 +0530 Subject: [PATCH 4/4] HDDS-4426. SCM should create transactions using all blocks received from OM - Checkstyle fixed. --- .../hdds/scm/block/BlockManagerImpl.java | 17 ++++---- .../scm/server/SCMBlockProtocolServer.java | 41 +++++++++---------- 2 files changed, 28 insertions(+), 30 deletions(-) diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/BlockManagerImpl.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/BlockManagerImpl.java index 847110166cd5..6b52cc54c91a 100644 --- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/BlockManagerImpl.java +++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/BlockManagerImpl.java @@ -292,16 +292,16 @@ private AllocatedBlock newBlock(ContainerInfo containerInfo) { */ @Override public void deleteBlocks(List keyBlocksInfoList) - throws IOException { + throws IOException { ScmUtils.preCheck(ScmOps.deleteBlock, safeModePrecheck); Map> 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(BlockGroup bg : keyBlocksInfoList){ - LOG.info("Deleting blocks {}", StringUtils.join( - ",", bg.getBlockIDList())); - for(BlockID block : bg.getBlockIDList()){ + for (BlockGroup bg : keyBlocksInfoList) { + LOG.info("Deleting blocks {}", + StringUtils.join(",", bg.getBlockIDList())); + for (BlockID block : bg.getBlockIDList()) { long containerID = block.getContainerID(); if (containerBlocks.containsKey(containerID)) { containerBlocks.get(containerID).add(block.getLocalID()); @@ -316,10 +316,9 @@ public void deleteBlocks(List keyBlocksInfoList) try { deletedBlockLog.addTransactions(containerBlocks); } catch (IOException e) { - throw new IOException( - "Skip writing the deleted blocks info to" - + " the delLog because addTransaction fails. " - + keyBlocksInfoList.size() + "Keys skipped", e); + throw new IOException("Skip writing the deleted blocks info to" + + " the delLog because addTransaction fails. " + keyBlocksInfoList + .size() + "Keys skipped", e); } // TODO: Container report handling of the deleted blocks: // Remove tombstone and update open container usage. diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMBlockProtocolServer.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMBlockProtocolServer.java index 6171e39ad7bb..f91dac7c5909 100644 --- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMBlockProtocolServer.java +++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMBlockProtocolServer.java @@ -227,45 +227,44 @@ public List deleteKeyBlocks( Map auditMap = Maps.newHashMap(); ScmBlockLocationProtocolProtos.DeleteScmBlockResult.Result resultCode; Exception e = null; - try{ + try { scm.getScmBlockManager().deleteBlocks(keyBlocksInfoList); resultCode = ScmBlockLocationProtocolProtos. - DeleteScmBlockResult.Result.success; - } catch (IOException ioe){ + DeleteScmBlockResult.Result.success; + } catch (IOException ioe) { e = ioe; LOG.warn("Fail to delete {} keys", keyBlocksInfoList.size(), ioe); switch (ioe instanceof SCMException ? ((SCMException) ioe).getResult() : - IO_EXCEPTION) { + IO_EXCEPTION) { case SAFE_MODE_EXCEPTION: - resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult - .Result.safeMode; + resultCode = + ScmBlockLocationProtocolProtos.DeleteScmBlockResult.Result.safeMode; break; case FAILED_TO_FIND_BLOCK: - resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult - .Result.errorNotFound; + resultCode = + ScmBlockLocationProtocolProtos.DeleteScmBlockResult.Result. + errorNotFound; break; default: - resultCode = ScmBlockLocationProtocolProtos.DeleteScmBlockResult - .Result.unknownFailure; + resultCode = + ScmBlockLocationProtocolProtos.DeleteScmBlockResult.Result. + unknownFailure; } } - for(BlockGroup bg : keyBlocksInfoList){ + for (BlockGroup bg : keyBlocksInfoList) { auditMap.put("KeyBlockToDelete", bg.toString()); List blockResult = new ArrayList<>(); - for(BlockID b : bg.getBlockIDList()){ + for (BlockID b : bg.getBlockIDList()) { blockResult.add(new DeleteBlockResult(b, resultCode)); } - results.add(new DeleteBlockGroupResult(bg.getGroupID(), - blockResult)); + results.add(new DeleteBlockGroupResult(bg.getGroupID(), blockResult)); } - if(e == null){ - AUDIT.logWriteSuccess(buildAuditMessageForSuccess( - SCMAction.DELETE_KEY_BLOCK, auditMap)); - } else{ + if (e == null) { + AUDIT.logWriteSuccess( + buildAuditMessageForSuccess(SCMAction.DELETE_KEY_BLOCK, auditMap)); + } else { AUDIT.logWriteFailure( - buildAuditMessageForFailure(SCMAction.DELETE_KEY_BLOCK, auditMap, - e) - ); + buildAuditMessageForFailure(SCMAction.DELETE_KEY_BLOCK, auditMap, e)); } return results; }