smengcl commented on code in PR #4376:
URL: https://github.com/apache/ozone/pull/4376#discussion_r1139358133
##########
hadoop-hdds/rocksdb-checkpoint-differ/src/main/java/org/apache/ozone/rocksdb/util/ManagedSstFileReader.java:
##########
@@ -46,41 +47,130 @@ 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 Stream<String> getKeyStream() throws RocksDBException,
+ NativeLibraryNotLoadedException, IOException {
+ //TODO: [SNAPSHOT] Check if default Options and ReadOptions is enough.
+ ManagedOptions options = new ManagedOptions();
+ ReadOptions readOptions = new ReadOptions();
+ final MultipleSstFileIterator<String> itr =
+ new MultipleSstFileIterator<String>(sstFiles) {
+ @Override
+ protected HddsUtils.CloseableIterator<String>
+ initNewKeyIteratorForFile(String file) throws RocksDBException {
+ return new ManagedSstFileIterator<String>(file, options,
+ readOptions) {
+ @Override
+ protected String getIteratorValue(
+ SstFileReaderIterator iterator) {
+ return new String(iterator.key(), UTF_8);
+ }
+ };
+ }
+
+ @Override
+ public void close() throws IOException {
+ super.close();
+ options.close();
+ readOptions.close();
+ }
+ };
+ return RdbUtil.getStreamFromIterator(itr);
+ }
+ public Stream<String> getKeyStreamWithTombstone(
+ ManagedSSTDumpTool sstDumpTool) throws IOException, RocksDBException,
+ NativeLibraryNotLoadedException {
+ //TODO: [SNAPSHOT] Check if default Options is enough.
Review Comment:
nit
```suggestion
// TODO: [SNAPSHOT] Check if default Options is enough.
```
--
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]