diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/KeyDeletingService.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/KeyDeletingService.java index 98d3f7070d06..b0c6b7a13ade 100644 --- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/KeyDeletingService.java +++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/KeyDeletingService.java @@ -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 @@ -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; @@ -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; @@ -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); } } @@ -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 results) - throws RocksDBException, IOException { - Table deletedTable = manager.getMetadataManager().getDeletedTable(); - + throws IOException { + Table deletedTable = + manager.getMetadataManager().getDeletedTable(); DBStore store = manager.getMetadataManager().getStore(); // Put all keys to delete in a single transaction and call for delete. @@ -213,7 +214,9 @@ private int deleteAllKeys(List 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++; } } @@ -226,9 +229,7 @@ private int deleteAllKeys(List 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 results) { Map, List> purgeKeysMapPerBucket = @@ -242,7 +243,9 @@ public int submitPurgeKeysRequest(List 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++; } }