swamirishi commented on code in PR #8690:
URL: https://github.com/apache/ozone/pull/8690#discussion_r2194069508
##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBBatchOperation.java:
##########
@@ -237,17 +247,24 @@ void put(CodecBuffer key, CodecBuffer value) {
// always release the key with the value
value.getReleaseFuture().thenAccept(v -> key.release());
putOrDelete(new Bytes(key), key.readableBytes(),
- value, value.readableBytes());
+ value, value.readableBytes(), Op.PUT);
}
void put(byte[] key, byte[] value) {
putCount++;
- putOrDelete(new Bytes(key), key.length, value, value.length);
+ putOrDelete(new Bytes(key), key.length, value, value.length, Op.PUT);
}
void delete(byte[] key) {
delCount++;
- putOrDelete(new Bytes(key), key.length, Op.DELETE, 0);
+ putOrDelete(new Bytes(key), key.length, ArrayUtils.EMPTY_BYTE_ARRAY,
0, Op.DELETE);
+ }
+
+ void deleteRange(byte[] startKey, byte[] endKey) {
+ delRangeCount++;
+ byte[] sequenceKey = ArrayUtils.addAll(startKey,
Review Comment:
This is wrong, since previous entry would be removed as part of the
putOrDelete(), So in case if there is putKey() or a deleteKey that is equal to
sequenceKey then it would be effectively removed and overwritten.
https://github.com/apache/ozone/blob/7ecad9797ecf329ea5146e004e35b1408e043762/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBBatchOperation.java#L213
The right way here would be to maintain a Queue<Pair<Bytes, Ops>> instead of
ops being a HashMap
--
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]