tanvipenumudy commented on code in PR #6439:
URL: https://github.com/apache/ozone/pull/6439#discussion_r1603085910
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMBlockProtocolServer.java:
##########
@@ -261,26 +264,33 @@ public List<DeleteBlockGroupResult> deleteKeyBlocks(
List<DeleteBlockGroupResult> results = new ArrayList<>();
Map<String, String> auditMap = Maps.newHashMap();
ScmBlockLocationProtocolProtos.DeleteScmBlockResult.Result resultCode;
+ perfMetrics = scm.getPerfMetrics();
Exception e = null;
+ long startNanos = Time.monotonicNowNanos();
try {
scm.getScmBlockManager().deleteBlocks(keyBlocksInfoList);
+ perfMetrics.updateDeleteKeySuccessStats(startNanos);
resultCode = ScmBlockLocationProtocolProtos.
DeleteScmBlockResult.Result.success;
} catch (IOException ioe) {
e = ioe;
+ perfMetrics.updateDeleteKeyFailureStats(startNanos);
LOG.warn("Fail to delete {} keys", keyBlocksInfoList.size(), ioe);
switch (ioe instanceof SCMException ? ((SCMException) ioe).getResult() :
IO_EXCEPTION) {
case SAFE_MODE_EXCEPTION:
+ perfMetrics.updateDeleteKeyFailureStats(startNanos);
resultCode =
ScmBlockLocationProtocolProtos.DeleteScmBlockResult.Result.safeMode;
break;
case FAILED_TO_FIND_BLOCK:
+ perfMetrics.updateDeleteKeyFailureStats(startNanos);
Review Comment:
Same as previous comment.
```suggestion
```
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMBlockProtocolServer.java:
##########
@@ -261,26 +264,33 @@ public List<DeleteBlockGroupResult> deleteKeyBlocks(
List<DeleteBlockGroupResult> results = new ArrayList<>();
Map<String, String> auditMap = Maps.newHashMap();
ScmBlockLocationProtocolProtos.DeleteScmBlockResult.Result resultCode;
+ perfMetrics = scm.getPerfMetrics();
Exception e = null;
+ long startNanos = Time.monotonicNowNanos();
try {
scm.getScmBlockManager().deleteBlocks(keyBlocksInfoList);
+ perfMetrics.updateDeleteKeySuccessStats(startNanos);
resultCode = ScmBlockLocationProtocolProtos.
DeleteScmBlockResult.Result.success;
} catch (IOException ioe) {
e = ioe;
+ perfMetrics.updateDeleteKeyFailureStats(startNanos);
LOG.warn("Fail to delete {} keys", keyBlocksInfoList.size(), ioe);
switch (ioe instanceof SCMException ? ((SCMException) ioe).getResult() :
IO_EXCEPTION) {
case SAFE_MODE_EXCEPTION:
+ perfMetrics.updateDeleteKeyFailureStats(startNanos);
resultCode =
ScmBlockLocationProtocolProtos.DeleteScmBlockResult.Result.safeMode;
break;
case FAILED_TO_FIND_BLOCK:
+ perfMetrics.updateDeleteKeyFailureStats(startNanos);
resultCode =
ScmBlockLocationProtocolProtos.DeleteScmBlockResult.Result.
errorNotFound;
break;
default:
+ perfMetrics.updateDeleteKeyFailureStats(startNanos);
Review Comment:
Same as previous comment.
```suggestion
```
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMBlockProtocolServer.java:
##########
@@ -261,26 +264,33 @@ public List<DeleteBlockGroupResult> deleteKeyBlocks(
List<DeleteBlockGroupResult> results = new ArrayList<>();
Map<String, String> auditMap = Maps.newHashMap();
ScmBlockLocationProtocolProtos.DeleteScmBlockResult.Result resultCode;
+ perfMetrics = scm.getPerfMetrics();
Exception e = null;
+ long startNanos = Time.monotonicNowNanos();
try {
scm.getScmBlockManager().deleteBlocks(keyBlocksInfoList);
+ perfMetrics.updateDeleteKeySuccessStats(startNanos);
resultCode = ScmBlockLocationProtocolProtos.
DeleteScmBlockResult.Result.success;
} catch (IOException ioe) {
e = ioe;
+ perfMetrics.updateDeleteKeyFailureStats(startNanos);
LOG.warn("Fail to delete {} keys", keyBlocksInfoList.size(), ioe);
switch (ioe instanceof SCMException ? ((SCMException) ioe).getResult() :
IO_EXCEPTION) {
case SAFE_MODE_EXCEPTION:
+ perfMetrics.updateDeleteKeyFailureStats(startNanos);
Review Comment:
Updating the `deleteKeyFailureStats` once at the beginning of the catch
block (`L277`) should suffice.
```suggestion
```
--
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]