Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.apache.hadoop.metrics2.annotation.Metric;
import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
import org.apache.hadoop.metrics2.lib.MutableGaugeFloat;
import org.apache.hadoop.metrics2.lib.MutableGaugeLong;
import org.apache.hadoop.metrics2.lib.MutableRate;

/**
Expand Down Expand Up @@ -151,6 +152,15 @@ public static void unregister() {
@Metric(about = "ACLs check in getObjectTagging")
private MutableRate getObjectTaggingAclCheckLatencyNs;

@Metric("Latency of DirectoryDeletingService")
private MutableGaugeLong latencyDirectoryDeletingService;

@Metric("Latency of KeyDeletingService")
private MutableGaugeLong latencyKeyDeletingService;

@Metric("Latency of OpenKeyCleanupService")
private MutableGaugeLong latencyOpenKeyCleanupService;

public void addLookupLatency(long latencyInNs) {
lookupLatencyNs.add(latencyInNs);
}
Expand Down Expand Up @@ -299,4 +309,16 @@ public MutableRate getGetObjectTaggingAclCheckLatencyNs() {
public void addGetObjectTaggingLatencyNs(long latencyInNs) {
getObjectTaggingAclCheckLatencyNs.add(latencyInNs);
}

public void setLatencyDirectoryDeletingService(long latencyInNs) {
latencyDirectoryDeletingService.set(latencyInNs);
}

public void setLatencyKeyDeletingService(long latencyInNs) {
latencyKeyDeletingService.set(latencyInNs);
}

public void setLatencyOpenKeyCleanupService(long latencyInNs) {
latencyOpenKeyCleanupService.set(latencyInNs);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import org.apache.hadoop.ozone.om.KeyManager;
import org.apache.hadoop.ozone.om.OMConfigKeys;
import org.apache.hadoop.ozone.om.OMMetadataManager;
import org.apache.hadoop.ozone.om.OMPerformanceMetrics;
import org.apache.hadoop.ozone.om.OzoneManager;
import org.apache.hadoop.ozone.om.helpers.OmBucketInfo;
import org.apache.hadoop.ozone.om.helpers.OmKeyInfo;
Expand All @@ -73,6 +74,7 @@ public abstract class AbstractKeyDeletingService extends BackgroundService

private final OzoneManager ozoneManager;
private final DeletingServiceMetrics metrics;
private final OMPerformanceMetrics perfMetrics;
private final ScmBlockLocationProtocol scmClient;
private final ClientId clientId = ClientId.randomId();
private final AtomicLong deletedDirsCount;
Expand All @@ -94,6 +96,7 @@ public AbstractKeyDeletingService(String serviceName, long interval,
this.movedFilesCount = new AtomicLong(0);
this.runCount = new AtomicLong(0);
this.metrics = ozoneManager.getDeletionMetrics();
this.perfMetrics = ozoneManager.getPerfMetrics();
}

protected int processKeyDeletes(List<BlockGroup> keyBlocksList,
Expand All @@ -119,14 +122,15 @@ protected int processKeyDeletes(List<BlockGroup> keyBlocksList,
LOG.info("{} BlockGroup deletion are acked by SCM in {} ms",
keyBlocksList.size(), Time.monotonicNow() - startTime);
if (blockDeletionResults != null) {
startTime = Time.monotonicNow();
long purgeStartTime = Time.monotonicNow();
delCount = submitPurgeKeysRequest(blockDeletionResults,
keysToModify, snapTableKey, expectedPreviousSnapshotId);
int limit = ozoneManager.getConfiguration().getInt(OMConfigKeys.OZONE_KEY_DELETING_LIMIT_PER_TASK,
OMConfigKeys.OZONE_KEY_DELETING_LIMIT_PER_TASK_DEFAULT);
LOG.info("Blocks for {} (out of {}) keys are deleted from DB in {} ms. Limit per task is {}.",
delCount, blockDeletionResults.size(), Time.monotonicNow() - startTime, limit);
delCount, blockDeletionResults.size(), Time.monotonicNow() - purgeStartTime, limit);
}
perfMetrics.setLatencyKeyDeletingService(Time.monotonicNowNanos() - startTime);
return delCount;
}

Expand Down Expand Up @@ -416,6 +420,7 @@ public void optimizeDirDeletesAndSubmitRequest(
dirNum, subdirDelNum, subFileNum, (subDirNum - subdirDelNum),
timeTakenInIteration, rnCnt);
metrics.incrementDirectoryDeletionTotalMetrics(dirNum + subdirDelNum, subDirNum, subFileNum);
perfMetrics.setLatencyDirectoryDeletingService(timeTakenInIteration);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,11 @@ public BackgroundTaskResult call() throws Exception {
});
}

long timeTaken = Time.monotonicNow() - startTime;
LOG.info("Number of expired open keys submitted for deletion: {},"
+ " for commit: {}, cleanupLimit: {}, elapsed time: {}ms",
numOpenKeys, numHsyncKeys, cleanupLimitPerTask, Time.monotonicNow() - startTime);
numOpenKeys, numHsyncKeys, cleanupLimitPerTask, timeTaken);
ozoneManager.getPerfMetrics().setLatencyOpenKeyCleanupService(timeTaken);
final int numKeys = numOpenKeys + numHsyncKeys;
submittedOpenKeyCount.addAndGet(numKeys);
return () -> numKeys;
Expand Down