Bugfixes
This commit is contained in:
parent
4aa18fcd60
commit
04df5f4a36
@ -1005,11 +1005,18 @@ public class LLLocalDictionary implements LLDictionary {
|
|||||||
.<Void>fromCallable(() -> {
|
.<Void>fromCallable(() -> {
|
||||||
if (!USE_WRITE_BATCHES_IN_SET_RANGE) {
|
if (!USE_WRITE_BATCHES_IN_SET_RANGE) {
|
||||||
var opts = new ReadOptions(EMPTY_READ_OPTIONS);
|
var opts = new ReadOptions(EMPTY_READ_OPTIONS);
|
||||||
|
ReleasableSlice minBound;
|
||||||
if (range.hasMin()) {
|
if (range.hasMin()) {
|
||||||
setIterateBound(opts, IterateBound.LOWER, range.getMin().retain());
|
minBound = setIterateBound(opts, IterateBound.LOWER, range.getMin().retain());
|
||||||
|
} else {
|
||||||
|
minBound = emptyReleasableSlice();
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
ReleasableSlice maxBound;
|
||||||
if (range.hasMax()) {
|
if (range.hasMax()) {
|
||||||
setIterateBound(opts, IterateBound.UPPER, range.getMax().retain());
|
maxBound = setIterateBound(opts, IterateBound.UPPER, range.getMax().retain());
|
||||||
|
} else {
|
||||||
|
maxBound = emptyReleasableSlice();
|
||||||
}
|
}
|
||||||
try (RocksIterator it = db.newIterator(cfh, opts)) {
|
try (RocksIterator it = db.newIterator(cfh, opts)) {
|
||||||
if (!PREFER_SEEK_TO_FIRST && range.hasMin()) {
|
if (!PREFER_SEEK_TO_FIRST && range.hasMin()) {
|
||||||
@ -1021,6 +1028,11 @@ public class LLLocalDictionary implements LLDictionary {
|
|||||||
db.delete(cfh, it.key());
|
db.delete(cfh, it.key());
|
||||||
it.next();
|
it.next();
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
maxBound.release();
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
minBound.release();
|
||||||
}
|
}
|
||||||
} else if (USE_CAPPED_WRITE_BATCH_IN_SET_RANGE) {
|
} else if (USE_CAPPED_WRITE_BATCH_IN_SET_RANGE) {
|
||||||
try (var batch = new CappedWriteBatch(db,
|
try (var batch = new CappedWriteBatch(db,
|
||||||
@ -1146,6 +1158,7 @@ public class LLLocalDictionary implements LLDictionary {
|
|||||||
|
|
||||||
private void deleteSmallRangeWriteBatch(CappedWriteBatch writeBatch, LLRange range)
|
private void deleteSmallRangeWriteBatch(CappedWriteBatch writeBatch, LLRange range)
|
||||||
throws RocksDBException {
|
throws RocksDBException {
|
||||||
|
try {
|
||||||
var readOpts = getReadOptions(null);
|
var readOpts = getReadOptions(null);
|
||||||
readOpts.setFillCache(false);
|
readOpts.setFillCache(false);
|
||||||
ReleasableSlice minBound;
|
ReleasableSlice minBound;
|
||||||
@ -1154,6 +1167,7 @@ public class LLLocalDictionary implements LLDictionary {
|
|||||||
} else {
|
} else {
|
||||||
minBound = emptyReleasableSlice();
|
minBound = emptyReleasableSlice();
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
ReleasableSlice maxBound;
|
ReleasableSlice maxBound;
|
||||||
if (range.hasMax()) {
|
if (range.hasMax()) {
|
||||||
maxBound = setIterateBound(readOpts, IterateBound.UPPER, range.getMax().retain());
|
maxBound = setIterateBound(readOpts, IterateBound.UPPER, range.getMax().retain());
|
||||||
@ -1171,14 +1185,19 @@ public class LLLocalDictionary implements LLDictionary {
|
|||||||
rocksIterator.next();
|
rocksIterator.next();
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
minBound.release();
|
|
||||||
maxBound.release();
|
maxBound.release();
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
minBound.release();
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
range.release();
|
range.release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteSmallRangeWriteBatch(WriteBatch writeBatch, LLRange range)
|
private void deleteSmallRangeWriteBatch(WriteBatch writeBatch, LLRange range)
|
||||||
throws RocksDBException {
|
throws RocksDBException {
|
||||||
|
try {
|
||||||
var readOpts = getReadOptions(null);
|
var readOpts = getReadOptions(null);
|
||||||
readOpts.setFillCache(false);
|
readOpts.setFillCache(false);
|
||||||
ReleasableSlice minBound;
|
ReleasableSlice minBound;
|
||||||
@ -1190,6 +1209,7 @@ public class LLLocalDictionary implements LLDictionary {
|
|||||||
} else {
|
} else {
|
||||||
minBound = emptyReleasableSlice();
|
minBound = emptyReleasableSlice();
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
ReleasableSlice maxBound;
|
ReleasableSlice maxBound;
|
||||||
if (range.hasMax()) {
|
if (range.hasMax()) {
|
||||||
var arr = LLUtils.toArray(range.getMax());
|
var arr = LLUtils.toArray(range.getMax());
|
||||||
@ -1210,8 +1230,12 @@ public class LLLocalDictionary implements LLDictionary {
|
|||||||
rocksIterator.next();
|
rocksIterator.next();
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
minBound.release();
|
|
||||||
maxBound.release();
|
maxBound.release();
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
minBound.release();
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
range.release();
|
range.release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1350,6 +1374,7 @@ public class LLLocalDictionary implements LLDictionary {
|
|||||||
} else {
|
} else {
|
||||||
minBound = emptyReleasableSlice();
|
minBound = emptyReleasableSlice();
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
ReleasableSlice maxBound;
|
ReleasableSlice maxBound;
|
||||||
if (range.hasMax()) {
|
if (range.hasMax()) {
|
||||||
maxBound = setIterateBound(readOpts, IterateBound.UPPER, range.getMax().retain());
|
maxBound = setIterateBound(readOpts, IterateBound.UPPER, range.getMax().retain());
|
||||||
@ -1375,9 +1400,11 @@ public class LLLocalDictionary implements LLDictionary {
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
minBound.release();
|
|
||||||
maxBound.release();
|
maxBound.release();
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
minBound.release();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.onErrorMap(cause -> new IOException("Failed to get size of range "
|
.onErrorMap(cause -> new IOException("Failed to get size of range "
|
||||||
+ range.toString(), cause))
|
+ range.toString(), cause))
|
||||||
@ -1397,6 +1424,7 @@ public class LLLocalDictionary implements LLDictionary {
|
|||||||
} else {
|
} else {
|
||||||
minBound = emptyReleasableSlice();
|
minBound = emptyReleasableSlice();
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
ReleasableSlice maxBound;
|
ReleasableSlice maxBound;
|
||||||
if (range.hasMax()) {
|
if (range.hasMax()) {
|
||||||
maxBound = setIterateBound(readOpts, IterateBound.UPPER, range.getMax().retain());
|
maxBound = setIterateBound(readOpts, IterateBound.UPPER, range.getMax().retain());
|
||||||
@ -1425,9 +1453,11 @@ public class LLLocalDictionary implements LLDictionary {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
minBound.release();
|
|
||||||
maxBound.release();
|
maxBound.release();
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
minBound.release();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.subscribeOn(dbScheduler)
|
.subscribeOn(dbScheduler)
|
||||||
.doFinally(s -> range.release());
|
.doFinally(s -> range.release());
|
||||||
@ -1444,6 +1474,7 @@ public class LLLocalDictionary implements LLDictionary {
|
|||||||
} else {
|
} else {
|
||||||
minBound = emptyReleasableSlice();
|
minBound = emptyReleasableSlice();
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
ReleasableSlice maxBound;
|
ReleasableSlice maxBound;
|
||||||
if (range.hasMax()) {
|
if (range.hasMax()) {
|
||||||
maxBound = setIterateBound(readOpts, IterateBound.UPPER, range.getMax().retain());
|
maxBound = setIterateBound(readOpts, IterateBound.UPPER, range.getMax().retain());
|
||||||
@ -1464,9 +1495,11 @@ public class LLLocalDictionary implements LLDictionary {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
minBound.release();
|
|
||||||
maxBound.release();
|
maxBound.release();
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
minBound.release();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.subscribeOn(dbScheduler)
|
.subscribeOn(dbScheduler)
|
||||||
.doFinally(s -> range.release());
|
.doFinally(s -> range.release());
|
||||||
@ -1584,6 +1617,7 @@ public class LLLocalDictionary implements LLDictionary {
|
|||||||
} else {
|
} else {
|
||||||
minBound = emptyReleasableSlice();
|
minBound = emptyReleasableSlice();
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
ReleasableSlice maxBound;
|
ReleasableSlice maxBound;
|
||||||
if (range.hasMax()) {
|
if (range.hasMax()) {
|
||||||
maxBound = setIterateBound(readOpts, IterateBound.UPPER, range.getMax().retain());
|
maxBound = setIterateBound(readOpts, IterateBound.UPPER, range.getMax().retain());
|
||||||
@ -1604,9 +1638,11 @@ public class LLLocalDictionary implements LLDictionary {
|
|||||||
dbDelete(cfh, null, key);
|
dbDelete(cfh, null, key);
|
||||||
return Map.entry(key, value);
|
return Map.entry(key, value);
|
||||||
} finally {
|
} finally {
|
||||||
minBound.release();
|
|
||||||
maxBound.release();
|
maxBound.release();
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
minBound.release();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.onErrorMap(cause -> new IOException("Failed to delete " + range.toString(), cause))
|
.onErrorMap(cause -> new IOException("Failed to delete " + range.toString(), cause))
|
||||||
.subscribeOn(dbScheduler)
|
.subscribeOn(dbScheduler)
|
||||||
|
Loading…
Reference in New Issue
Block a user