Fix iterations
This commit is contained in:
parent
3d5f987ffd
commit
05e8c87015
@ -43,6 +43,7 @@ public abstract class LLLocalLuceneGroupedReactiveIterator<T> {
|
||||
public Flux<List<T>> flux() {
|
||||
return Flux
|
||||
.generate(() -> {
|
||||
synchronized (this) {
|
||||
var readOptions = new ReadOptions(this.readOptions);
|
||||
readOptions.setFillCache(range.hasMin() && range.hasMax());
|
||||
if (range.hasMin()) {
|
||||
@ -51,7 +52,6 @@ public abstract class LLLocalLuceneGroupedReactiveIterator<T> {
|
||||
if (range.hasMax()) {
|
||||
readOptions.setIterateUpperBound(new Slice(range.getMax()));
|
||||
}
|
||||
readOptions.setPrefixSameAsStart(true);
|
||||
var rocksIterator = db.newIterator(cfh, readOptions);
|
||||
if (range.hasMin()) {
|
||||
rocksIterator.seek(range.getMin());
|
||||
@ -59,7 +59,9 @@ public abstract class LLLocalLuceneGroupedReactiveIterator<T> {
|
||||
rocksIterator.seekToFirst();
|
||||
}
|
||||
return rocksIterator;
|
||||
}
|
||||
}, (rocksIterator, sink) -> {
|
||||
synchronized (this) {
|
||||
ObjectArrayList<T> values = new ObjectArrayList<>();
|
||||
byte[] firstGroupKey = null;
|
||||
|
||||
@ -80,7 +82,12 @@ public abstract class LLLocalLuceneGroupedReactiveIterator<T> {
|
||||
sink.complete();
|
||||
}
|
||||
return rocksIterator;
|
||||
}, rocksIterator1 -> rocksIterator1.close());
|
||||
}
|
||||
}, rocksIterator1 -> {
|
||||
synchronized (this) {
|
||||
rocksIterator1.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public abstract T getEntry(byte[] key, byte[] value);
|
||||
|
@ -38,6 +38,7 @@ public class LLLocalLuceneKeyPrefixesReactiveIterator {
|
||||
public Flux<byte[]> flux() {
|
||||
return Flux
|
||||
.generate(() -> {
|
||||
synchronized (this) {
|
||||
var readOptions = new ReadOptions(this.readOptions);
|
||||
readOptions.setFillCache(range.hasMin() && range.hasMax());
|
||||
if (range.hasMin()) {
|
||||
@ -46,7 +47,6 @@ public class LLLocalLuceneKeyPrefixesReactiveIterator {
|
||||
if (range.hasMax()) {
|
||||
readOptions.setIterateUpperBound(new Slice(range.getMax()));
|
||||
}
|
||||
readOptions.setPrefixSameAsStart(true);
|
||||
var rocksIterator = db.newIterator(cfh, readOptions);
|
||||
if (range.hasMin()) {
|
||||
rocksIterator.seek(range.getMin());
|
||||
@ -54,7 +54,9 @@ public class LLLocalLuceneKeyPrefixesReactiveIterator {
|
||||
rocksIterator.seekToFirst();
|
||||
}
|
||||
return rocksIterator;
|
||||
}
|
||||
}, (rocksIterator, sink) -> {
|
||||
synchronized (this) {
|
||||
byte[] firstGroupKey = null;
|
||||
|
||||
while (rocksIterator.isValid()) {
|
||||
@ -73,6 +75,11 @@ public class LLLocalLuceneKeyPrefixesReactiveIterator {
|
||||
sink.complete();
|
||||
}
|
||||
return rocksIterator;
|
||||
}, rocksIterator1 -> rocksIterator1.close());
|
||||
}
|
||||
}, rocksIterator1 -> {
|
||||
synchronized (this) {
|
||||
rocksIterator1.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ public abstract class LLLocalLuceneReactiveIterator<T> {
|
||||
public Flux<T> flux() {
|
||||
return Flux
|
||||
.generate(() -> {
|
||||
synchronized (this) {
|
||||
var readOptions = new ReadOptions(this.readOptions);
|
||||
readOptions.setFillCache(range.hasMin() && range.hasMax());
|
||||
if (range.hasMin()) {
|
||||
@ -48,7 +49,9 @@ public abstract class LLLocalLuceneReactiveIterator<T> {
|
||||
rocksIterator.seekToFirst();
|
||||
}
|
||||
return rocksIterator;
|
||||
}
|
||||
}, (rocksIterator, sink) -> {
|
||||
synchronized (this) {
|
||||
if (rocksIterator.isValid()) {
|
||||
byte[] key = rocksIterator.key();
|
||||
byte[] value = readValues ? rocksIterator.value() : EMPTY;
|
||||
@ -58,7 +61,12 @@ public abstract class LLLocalLuceneReactiveIterator<T> {
|
||||
sink.complete();
|
||||
}
|
||||
return rocksIterator;
|
||||
}, rocksIterator1 -> rocksIterator1.close());
|
||||
}
|
||||
}, rocksIterator1 -> {
|
||||
synchronized (this) {
|
||||
rocksIterator1.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public abstract T getEntry(byte[] key, byte[] value);
|
||||
|
Loading…
Reference in New Issue
Block a user