Skip to content

Commit

Permalink
HDDS-11779. Add DN metrics to show deletion progress (#7552)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tejaskriya authored Dec 17, 2024
1 parent 976e45f commit a27e4ec
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ public final class BlockDeletingServiceMetrics {
@Metric(about = "The total number of DeleteBlockTransaction received")
private MutableCounterLong receivedTransactionCount;

@Metric(about = "The total number of DeleteBlockTransaction" +
" that is a retry Transaction")
@Metric(about = "The total number of DeleteBlockTransaction that is a retry Transaction")
private MutableCounterLong receivedRetryTransactionCount;

@Metric(about = "The total number of Container received to be processed")
Expand All @@ -74,10 +73,15 @@ public final class BlockDeletingServiceMetrics {
@Metric(about = "The total number of Container chosen to be deleted.")
private MutableGaugeLong totalContainerChosenCount;

@Metric(about = "The total number of transactions which failed due" +
" to container lock wait timeout.")
@Metric(about = "The total number of transactions which failed due to container lock wait timeout.")
private MutableGaugeLong totalLockTimeoutTransactionCount;

@Metric(about = "The number of delete block transactions successful.")
private MutableCounterLong processedTransactionSuccessCount;

@Metric(about = "The number of delete block transactions failed.")
private MutableGaugeLong processedTransactionFailCount;

private BlockDeletingServiceMetrics() {
}

Expand Down Expand Up @@ -112,6 +116,14 @@ public void incrFailureCount() {
this.failureCount.incr();
}

public void incrProcessedTransactionSuccessCount(long count) {
processedTransactionSuccessCount.incr(count);
}

public void incrProcessedTransactionFailCount(long count) {
processedTransactionFailCount.incr(count);
}

public void incrReceivedTransactionCount(long count) {
receivedTransactionCount.incr(count);
}
Expand Down Expand Up @@ -184,6 +196,14 @@ public long getTotalLockTimeoutTransactionCount() {
return totalLockTimeoutTransactionCount.value();
}

public long getProcessedTransactionSuccessCount() {
return processedTransactionSuccessCount.value();
}

public long getProcessedTransactionFailCount() {
return processedTransactionFailCount.value();
}

@Override
public String toString() {
StringBuffer buffer = new StringBuffer();
Expand All @@ -202,6 +222,10 @@ public String toString() {
+ receivedTransactionCount.value()).append("\t")
.append("receivedRetryTransactionCount = "
+ receivedRetryTransactionCount.value()).append("\t")
.append("processedTransactionSuccessCount = "
+ processedTransactionSuccessCount.value()).append("\t")
.append("processedTransactionFailCount = "
+ processedTransactionFailCount.value()).append("\t")
.append("receivedContainerCount = "
+ receivedContainerCount.value()).append("\t")
.append("receivedBlockCount = "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,14 @@ private void processCmd(DeleteCmdInfo cmd) {
LOG.debug("Sending following block deletion ACK to SCM");
for (DeleteBlockTransactionResult result : blockDeletionACK
.getResultsList()) {
boolean success = result.getSuccess();
LOG.debug("TxId = {} : ContainerId = {} : {}",
result.getTxID(), result.getContainerID(), result.getSuccess());
result.getTxID(), result.getContainerID(), success);
if (success) {
blockDeleteMetrics.incrProcessedTransactionSuccessCount(1);
} else {
blockDeleteMetrics.incrProcessedTransactionFailCount(1);
}
}
}
}
Expand Down

0 comments on commit a27e4ec

Please sign in to comment.