hemantk-12 commented on code in PR #4376:
URL: https://github.com/apache/ozone/pull/4376#discussion_r1157833009
##########
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(
Review Comment:
Sorry to add this again but indentation is still not fixed. I believe your
IDE is not using [Ozone code
style](https://www.jetbrains.com/help/idea/configuring-code-style.html#import-code-style).
##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/util/ClosableIterator.java:
##########
@@ -17,12 +17,11 @@
*/
package org.apache.hadoop.util;
+import java.io.Closeable;
import java.util.Iterator;
/**
* An {@link Iterator} that may hold resources until it is closed.
*/
-public interface ClosableIterator<E> extends Iterator<E>, AutoCloseable {
- @Override
- void close();
+public interface ClosableIterator<E> extends Iterator<E>, Closeable {
Review Comment:
I think It was OK to override `close()` method and leave exception as
RunTimeException. Also any particular reason for changing it from
`AutoCloseable` to `Closeable`.
##########
hadoop-hdds/rocks-native/src/main/java/org/apache/hadoop/hdds/utils/db/managed/ManagedSSTDumpIterator.java:
##########
@@ -25,18 +26,17 @@
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
-import java.util.Iterator;
+import java.util.NoSuchElementException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Iterator to Parse output of RocksDBSSTDumpTool.
*/
-public class ManagedSSTDumpIterator implements
- Iterator<ManagedSSTDumpIterator.KeyValue>, AutoCloseable {
- private static final String SST_DUMP_TOOL_CLASS =
- "org.apache.hadoop.hdds.utils.db.managed.ManagedSSTDumpTool";
+public abstract class ManagedSSTDumpIterator<T> implements
Review Comment:
Suggestion: We can override `finalize` similar to other `ManagedClass` to
log warning if object doesn't get closed.
```
@Override
protected void finalize() throws Throwable {
ManagedRocksObjectUtils.assertClosed(this);
super.finalize();
}
```
##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/HddsUtils.java:
##########
@@ -800,4 +800,5 @@ public static Map<String, String>
processForLogging(OzoneConfiguration conf) {
}
return sortedOzoneProps;
}
+
Review Comment:
This is not needed.
--
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]