Skip wrong keys
This commit is contained in:
parent
4ed382197b
commit
0bc7b6d659
@ -26,14 +26,14 @@ public class LLLocalKeyPrefixReactiveRocksIterator extends
|
|||||||
@Override
|
@Override
|
||||||
public void drop(LLLocalKeyPrefixReactiveRocksIterator obj) {
|
public void drop(LLLocalKeyPrefixReactiveRocksIterator obj) {
|
||||||
try {
|
try {
|
||||||
if (obj.rangeShared != null) {
|
if (obj.rangeShared != null && obj.rangeShared.isAccessible()) {
|
||||||
obj.rangeShared.close();
|
obj.rangeShared.close();
|
||||||
}
|
}
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
logger.error("Failed to close range", ex);
|
logger.error("Failed to close range", ex);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (obj.readOptions != null) {
|
if (obj.readOptions != null && obj.readOptions.isAccessible()) {
|
||||||
obj.readOptions.close();
|
obj.readOptions.close();
|
||||||
}
|
}
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
@ -102,8 +102,11 @@ public class LLLocalKeyPrefixReactiveRocksIterator extends
|
|||||||
key = LLUtils.fromByteArray(db.getAllocator(), rocksIterator.key());
|
key = LLUtils.fromByteArray(db.getAllocator(), rocksIterator.key());
|
||||||
}
|
}
|
||||||
try (key) {
|
try (key) {
|
||||||
|
var keyLen = key.readableBytes();
|
||||||
|
if (keyLen >= prefixLength) {
|
||||||
if (firstGroupKey == null) {
|
if (firstGroupKey == null) {
|
||||||
firstGroupKey = key.copy();
|
firstGroupKey = key.copy();
|
||||||
|
assert firstGroupKey == null || firstGroupKey.readableBytes() >= prefixLength;
|
||||||
} else if (!LLUtils.equals(firstGroupKey,
|
} else if (!LLUtils.equals(firstGroupKey,
|
||||||
firstGroupKey.readerOffset(),
|
firstGroupKey.readerOffset(),
|
||||||
key,
|
key,
|
||||||
@ -112,6 +115,10 @@ public class LLLocalKeyPrefixReactiveRocksIterator extends
|
|||||||
)) {
|
)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
logger.error("Skipped a key with length {}, the expected minimum prefix key length is {}!"
|
||||||
|
+ " This key will be dropped", key.readableBytes(), prefixLength);
|
||||||
|
}
|
||||||
rocksIterator.next();
|
rocksIterator.next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user