sashapolo commented on code in PR #4200:
URL: https://github.com/apache/ignite-3/pull/4200#discussion_r1719434875
##########
modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/PartitionDataHelper.java:
##########
@@ -263,6 +294,59 @@ static BinaryRow deserializeRow(ByteBuffer buffer) {
return new BinaryRowImpl(schemaVersion, binaryTupleSlice);
}
+ byte[] createPayloadKey(ByteBuffer dataId) {
+ byte[] result = PAYLOAD_KEY_BUFFER.get()
+ .clear()
+ .putInt(tableId)
+ .putShort((short) partitionId)
+ .put(dataId)
+ .array();
+
+ dataId.rewind();
+
+ // Always use 0 for the last bit (tombstone flag), because it only
makes sense when data ID is stored as a value.
+ setLastBit(result, result.length - 1, false);
+
+ return result;
+ }
+
+ /**
+ * Changes the last bit of the byte identified by an index in an array.
+ *
+ * @param array Array containing the byte to change.
+ * @param index Index of the byte inside the array.
+ * @param value If {@code true} - sets the bit to 1, else to 0.
+ */
+ static void setLastBit(byte[] array, int index, boolean value) {
+ byte lastByte = array[index];
+
+ if (value) {
+ lastByte |= 0x01;
+ } else {
+ lastByte &= 0xFE;
+ }
+
+ array[index] = lastByte;
Review Comment:
yeah, this code was originally for ByteBuffers, forgot to rewrite it, thanks
for noticing
--
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]