sanpwc commented on code in PR #4049:
URL: https://github.com/apache/ignite-3/pull/4049#discussion_r1728795495
##########
modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvPartitionStorage.java:
##########
@@ -1032,14 +1053,29 @@ public void updateLease(long leaseStartTime) {
AbstractWriteBatch writeBatch =
PartitionDataHelper.requireWriteBatch();
try {
- byte[] leaseBytes = new byte[Long.BYTES];
+ ByteArrayOutputStream outputStream = new
ByteArrayOutputStream();
+ outputStream.write(longToBytes(leaseStartTime));
+
+ byte[] primaryReplicaNodeIdBytes =
stringToBytes(primaryReplicaNodeId);
+ assert primaryReplicaNodeIdBytes.length < Byte.MAX_VALUE :
+ format("Primary replica node id bytes length exceeds
the limit [length={}].",
+ primaryReplicaNodeIdBytes.length);
+ outputStream.write((byte) primaryReplicaNodeIdBytes.length);
+ outputStream.write(primaryReplicaNodeIdBytes);
- putLongToBytes(leaseStartTime, leaseBytes, 0);
+ byte[] primaryReplicaNodeNameBytes =
stringToBytes(primaryReplicaNodeName);
+ assert primaryReplicaNodeNameBytes.length < Byte.MAX_VALUE;
Review Comment:
Well, seems that 127 is too small. Reworked to use int instead.
--
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]