Skip to content
Merged
Changes from all commits
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
@@ -1,4 +1,4 @@
/**
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with this
* work for additional information regarding copyright ownership. The ASF
Expand Down Expand Up @@ -33,6 +33,7 @@
import org.apache.hadoop.ozone.om.KeyManager;
import org.apache.hadoop.ozone.om.OzoneManager;
import org.apache.hadoop.ozone.om.helpers.OMRatisHelper;
import org.apache.hadoop.ozone.om.helpers.RepeatedOmKeyInfo;
import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.DeletedKeys;
import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest;
import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.PurgeKeysRequest;
Expand All @@ -57,7 +58,6 @@
import org.apache.ratis.protocol.Message;
import org.apache.ratis.protocol.RaftClientRequest;
import org.apache.ratis.util.Preconditions;
import org.rocksdb.RocksDBException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -178,8 +178,10 @@ public BackgroundTaskResult call() throws Exception {
// OMRequest model.
delCount = deleteAllKeys(results);
}
LOG.debug("Number of keys deleted: {}, elapsed time: {}ms",
delCount, Time.monotonicNow() - startTime);
if (LOG.isDebugEnabled()) {
LOG.debug("Number of keys deleted: {}, elapsed time: {}ms",
delCount, Time.monotonicNow() - startTime);
}
deletedKeyCount.addAndGet(delCount);
}
}
Expand All @@ -196,13 +198,12 @@ public BackgroundTaskResult call() throws Exception {
* Deletes all the keys that SCM has acknowledged and queued for delete.
*
* @param results DeleteBlockGroups returned by SCM.
* @throws RocksDBException on Error.
* @throws IOException on Error
*/
private int deleteAllKeys(List<DeleteBlockGroupResult> results)
throws RocksDBException, IOException {
Table deletedTable = manager.getMetadataManager().getDeletedTable();

throws IOException {
Table<String, RepeatedOmKeyInfo> deletedTable =
manager.getMetadataManager().getDeletedTable();
DBStore store = manager.getMetadataManager().getStore();

// Put all keys to delete in a single transaction and call for delete.
Expand All @@ -213,7 +214,9 @@ private int deleteAllKeys(List<DeleteBlockGroupResult> results)
// Purge key from OM DB.
deletedTable.deleteWithBatch(writeBatch,
result.getObjectKey());
LOG.debug("Key {} deleted from OM DB", result.getObjectKey());
if (LOG.isDebugEnabled()) {
LOG.debug("Key {} deleted from OM DB", result.getObjectKey());
}
deletedCount++;
}
}
Expand All @@ -226,9 +229,7 @@ private int deleteAllKeys(List<DeleteBlockGroupResult> results)
/**
* Submits PurgeKeys request for the keys whose blocks have been deleted
* by SCM.
*
* @param results DeleteBlockGroups returned by SCM.
* @throws IOException on Error
*/
public int submitPurgeKeysRequest(List<DeleteBlockGroupResult> results) {
Map<Pair<String, String>, List<String>> purgeKeysMapPerBucket =
Expand All @@ -242,7 +243,9 @@ public int submitPurgeKeysRequest(List<DeleteBlockGroupResult> results) {
String deletedKey = result.getObjectKey();
// Parse Volume and BucketName
addToMap(purgeKeysMapPerBucket, deletedKey);
LOG.debug("Key {} set to be purged from OM DB", deletedKey);
if (LOG.isDebugEnabled()) {
LOG.debug("Key {} set to be purged from OM DB", deletedKey);
}
deletedCount++;
}
}
Expand Down