ChenSammi commented on code in PR #12109:
URL: https://github.com/apache/ozone/pull/12109#discussion_r4677434062
##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBTable.java:
##########
@@ -245,14 +245,37 @@ public void deleteWithBatch(BatchOperation batch, byte[]
key) {
@Override
public KeyValueIterator<byte[], byte[]> iterator(byte[] prefix, IteratorType
type)
throws RocksDatabaseException {
- return new RDBStoreByteArrayIterator(db.newIterator(family, false), this,
- prefix, type);
+ return new RDBStoreByteArrayIterator(db.newIterator(family, false,
prefixUpperBound(prefix)), this, prefix, type);
}
KeyValueIterator<CodecBuffer, CodecBuffer> iterator(
CodecBuffer prefix, IteratorType type) throws RocksDatabaseException {
- return new RDBStoreCodecBufferIterator(db.newIterator(family, false),
- this, prefix, type);
+ final byte[] upperBound = prefix == null ? null :
prefixUpperBound(toArray(prefix.asReadOnlyByteBuffer()));
+ return new RDBStoreCodecBufferIterator(db.newIterator(family, false,
upperBound), this, prefix, type);
+ }
+
+ /**
+ * @return the smallest key greater than every key starting with the given
prefix,
+ * or null if there is no such key (null, empty or all 0xFF prefix).
+ */
+ static byte[] prefixUpperBound(byte[] prefix) {
Review Comment:
Yeah, I remember we have pagination support. The interesting thing is the
CI in my repo is green. So it seems either we don't have any test cases for
pagination support, or this might also work for pagination case. Let me check
it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]