hemantk-12 commented on code in PR #4376:
URL: https://github.com/apache/ozone/pull/4376#discussion_r1152537956


##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/CloseableIterator.java:
##########
@@ -0,0 +1,13 @@
+package org.apache.hadoop.hdds.utils;
+
+import java.io.Closeable;
+import java.util.Iterator;
+
+/**
+ * Interface for Implementing CloseableIterators.
+ *
+ * @param <T> Generic Parameter for Iterating values of type 'T'
+ */
+public interface CloseableIterator<T> extends Iterator<T>, Closeable {

Review Comment:
   Please use 
[ClosableIterator](https://github.com/apache/ozone/blob/master/hadoop-hdds/common/src/main/java/org/apache/hadoop/util/ClosableIterator.java#L25).



##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/SnapshotDiffManager.java:
##########
@@ -170,6 +183,37 @@ public SnapshotDiffManager(ManagedRocksDB db,
     // TODO: [SNAPSHOT] Load jobs only if it is leader node.
     //  It could a event-triggered form OM when node is leader and up.
     this.loadJobsOnStartUp();
+    isNativeRocksToolsLoaded = NativeLibraryLoader.getInstance()
+            .loadLibrary(NativeConstants.ROCKS_TOOLS_NATIVE_LIBRARY_NAME);
+    if (isNativeRocksToolsLoaded) {
+      try {
+        initSSTDumpTool(configuration);
+        isNativeRocksToolsLoaded = true;

Review Comment:
   This is not needed.



##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/SnapshotDiffManager.java:
##########
@@ -170,6 +183,37 @@ public SnapshotDiffManager(ManagedRocksDB db,
     // TODO: [SNAPSHOT] Load jobs only if it is leader node.
     //  It could a event-triggered form OM when node is leader and up.
     this.loadJobsOnStartUp();
+    isNativeRocksToolsLoaded = NativeLibraryLoader.getInstance()
+            .loadLibrary(NativeConstants.ROCKS_TOOLS_NATIVE_LIBRARY_NAME);
+    if (isNativeRocksToolsLoaded) {
+      try {

Review Comment:
   I think it would be better to move this try-catch to `initSSTDumpTool`.



##########
hadoop-hdds/rocksdb-checkpoint-differ/src/main/java/org/apache/ozone/rocksdb/util/ManagedSstFileReader.java:
##########
@@ -46,80 +52,176 @@ public class ManagedSstFileReader {
   public ManagedSstFileReader(final Collection<String> sstFiles) {
     this.sstFiles = sstFiles;
   }
-  public Stream<String> getKeyStream() throws RocksDBException {
-    final ManagedSstFileIterator itr = new ManagedSstFileIterator(sstFiles);
-    final Spliterator<String> spliterator = Spliterators
-        .spliteratorUnknownSize(itr, 0);
-    return StreamSupport.stream(spliterator, false).onClose(itr::close);
+
+  public static <T> Stream<T> getStreamFromIterator(
+          CloseableIterator<T> itr) {
+    final Spliterator<T> spliterator = Spliterators
+            .spliteratorUnknownSize(itr, 0);
+    return StreamSupport.stream(spliterator, false).onClose(() -> {
+      try {
+        itr.close();
+      } catch (IOException e) {
+        throw new UncheckedIOException(e);
+      }
+    });
+  }
+
+  public Stream<String> getKeyStream() throws RocksDBException,

Review Comment:
   It is still not fixed. New code is not indented properly.



-- 
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]

Reply via email to