Fix unmodifiable read options

This commit is contained in:
Andrea Cavalli 2021-06-27 16:52:45 +02:00
parent cb8dbf2fa2
commit 2df2c00e36
2 changed files with 44 additions and 43 deletions

View File

@ -1251,8 +1251,7 @@ public class LLLocalDictionary implements LLDictionary {
public Flux<BadBlock> badBlocks(LLRange range) {
return Flux
.<BadBlock>create(sink -> {
try {
var ro = new ReadOptions(getReadOptions(null));
try (var ro = new ReadOptions(getReadOptions(null))) {
ro.setFillCache(false);
if (!range.isSingle()) {
ro.setReadaheadSize(32 * 1024);
@ -1666,7 +1665,7 @@ public class LLLocalDictionary implements LLDictionary {
public Mono<Void> clear() {
return Mono
.<Void>fromCallable(() -> {
var readOpts = getReadOptions(null);
try (var readOpts = new ReadOptions(getReadOptions(null))) {
readOpts.setVerifyChecksums(VERIFY_CHECKSUMS_WHEN_NOT_NEEDED);
// readOpts.setIgnoreRangeDeletions(true);
@ -1713,6 +1712,7 @@ public class LLLocalDictionary implements LLDictionary {
db.flushWal(true);
}
return null;
}
})
.onErrorMap(cause -> new IOException("Failed to clear", cause))
.subscribeOn(dbScheduler);

View File

@ -481,6 +481,7 @@ public class LLLocalKeyValueDatabase implements LLKeyValueDatabase {
private ColumnFamilyHandle getCfh(byte[] columnName) throws RocksDBException {
ColumnFamilyHandle cfh = handles.get(Column.special(Column.toString(columnName)));
//noinspection RedundantIfStatement
if (!enableColumnsBug) {
assert Arrays.equals(cfh.getName(), columnName);
}