ashishkumar50 commented on code in PR #5037:
URL: https://github.com/apache/ozone/pull/5037#discussion_r1258226978
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/OmTableInsightTask.java:
##########
@@ -179,6 +200,40 @@ private Triple<Long, Long, Long> getTableSizeAndCount(
return Triple.of(count, unReplicatedSize, replicatedSize);
}
+ /**
+ * Fetches the size of a deleted directory identified by the given path.
+ * The size is obtained from the NSSummary table using the directory
objectID.
+ * The path is expected to be in the format :-
+ * "volumeId/bucketId/parentId/dirName/dirObjectId".
+ *
+ * @param path The path of the deleted directory.
+ * @return The size of the deleted directory.
+ * @throws IOException If an I/O error occurs while retrieving the size.
+ */
+ public long fetchSizeForDeletedDirectory(String path)
+ throws IOException {
+ if (path == null || path.isEmpty()) {
Review Comment:
```suggestion
Strings.isNullOrEmpty(path) {
```
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/OmTableInsightTask.java:
##########
@@ -179,6 +200,40 @@ private Triple<Long, Long, Long> getTableSizeAndCount(
return Triple.of(count, unReplicatedSize, replicatedSize);
}
+ /**
+ * Fetches the size of a deleted directory identified by the given path.
+ * The size is obtained from the NSSummary table using the directory
objectID.
+ * The path is expected to be in the format :-
+ * "volumeId/bucketId/parentId/dirName/dirObjectId".
+ *
+ * @param path The path of the deleted directory.
+ * @return The size of the deleted directory.
+ * @throws IOException If an I/O error occurs while retrieving the size.
+ */
+ public long fetchSizeForDeletedDirectory(String path)
+ throws IOException {
+ if (path == null || path.isEmpty()) {
+ return 0L;
+ }
+ String[] parts = path.split("/");
+ String directoryObjectId = parts.length >= 6 ? parts[5] : "";
+ /* DB key in DeletedDirectoryTable =>
+ "volumeId/bucketId/parentId/dirName/dirObjectId" */
+ try {
+ long convertedValue = Long.parseLong(directoryObjectId);
Review Comment:
In case `parts.length < 6` we are assigning `directoryObjectId` with ""
which will throw `NumberFormatException`. Instead we should return error or 0
when this happens.
##########
hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/tasks/TestOmTableInsightTask.java:
##########
@@ -21,26 +21,36 @@
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.hadoop.hdds.client.StandaloneReplicationConfig;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
+import org.apache.hadoop.hdds.scm.server.OzoneStorageContainerManager;
+import org.apache.hadoop.hdds.utils.db.Table;
import org.apache.hadoop.hdds.utils.db.TypedTable;
import org.apache.hadoop.ozone.om.OMMetadataManager;
import org.apache.hadoop.ozone.om.OmMetadataManagerImpl;
-import org.apache.hadoop.ozone.om.helpers.OmKeyInfo;
-import org.apache.hadoop.ozone.om.helpers.RepeatedOmKeyInfo;
+import org.apache.hadoop.ozone.om.helpers.*;
Review Comment:
Avoid using .* in import.
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/OmTableInsightTask.java:
##########
@@ -139,28 +150,38 @@ public Pair<String, Boolean> reprocess(OMMetadataManager
omMetadataManager) {
* Returns a triple with the total count of records (left), total
unreplicated
* size (middle), and total replicated size (right) in the given iterator.
* Increments count for each record and adds the dataSize if a record's value
- * is an instance of OmKeyInfo. If the iterator is null, returns (0, 0, 0).
+ * is an instance of OmKeyInfo,RepeatedOmKeyInfo.
+ * If the iterator is null, returns (0, 0, 0).
*
* @param iterator The iterator over the table to be iterated.
Review Comment:
Add new param tableName in javadoc.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]