You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by ck...@apache.org on 2022/10/27 12:49:28 UTC
[ozone] 02/02: HDDS-7406. Remove unused the exception & improve debug log in KeyDeletingService (#3880)
This is an automated email from the ASF dual-hosted git repository.
ckj pushed a commit to branch ozone-1.3
in repository https://gitbox.apache.org/repos/asf/ozone.git
commit 895da49b301ce6a22d41174eb6dab5749a77a1ec
Author: Nibiru <ax...@qq.com>
AuthorDate: Thu Oct 27 20:43:51 2022 +0800
HDDS-7406. Remove unused the exception & improve debug log in KeyDeletingService (#3880)
---
.../ozone/om/service/KeyDeletingService.java | 27 ++++++++++++----------
1 file changed, 15 insertions(+), 12 deletions(-)
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 98d3f7070d..b0c6b7a13a 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.common.DeleteBlockGroupResult;
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.ClientId;
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 class KeyDeletingService extends BackgroundService {
// 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 class KeyDeletingService extends BackgroundService {
* 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.
@@ -213,7 +214,9 @@ public class KeyDeletingService extends BackgroundService {
// 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 @@ public class KeyDeletingService extends BackgroundService {
/**
* 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 =
@@ -242,7 +243,9 @@ public class KeyDeletingService extends BackgroundService {
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++;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ozone.apache.org
For additional commands, e-mail: commits-help@ozone.apache.org