Optimization

This commit is contained in:
Andrea Cavalli 2023-05-23 00:20:07 +02:00
parent 7e7e1c410b
commit 3e90ba3704

View File

@ -279,8 +279,7 @@ public class LLLocalDictionary implements LLDictionary {
)) { )) {
readOpts.setVerifyChecksums(VERIFY_CHECKSUMS_WHEN_NOT_NEEDED); readOpts.setVerifyChecksums(VERIFY_CHECKSUMS_WHEN_NOT_NEEDED);
readOpts.setFillCache(fillCache); readOpts.setFillCache(fillCache);
var rocksIterator = db.newIterator(readOpts, range.getMin(), range.getMax()); try (var rocksIterator = db.newIterator(readOpts, range.getMin(), range.getMax())) {
try {
if (!LLLocalDictionary.PREFER_AUTO_SEEK_BOUND && range.hasMin()) { if (!LLLocalDictionary.PREFER_AUTO_SEEK_BOUND && range.hasMin()) {
var seekArray = LLUtils.asArray(range.getMin()); var seekArray = LLUtils.asArray(range.getMin());
rocksIterator.seek(seekArray); rocksIterator.seek(seekArray);
@ -288,8 +287,6 @@ public class LLLocalDictionary implements LLDictionary {
rocksIterator.seekToFirst(); rocksIterator.seekToFirst();
} }
return !rocksIterator.isValid(); return !rocksIterator.isValid();
} finally {
rocksIterator.close();
} }
} }
} }