Phillippko commented on code in PR #4200:
URL: https://github.com/apache/ignite-3/pull/4200#discussion_r1721229554


##########
modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/GarbageCollector.java:
##########
@@ -325,28 +336,25 @@ private boolean checkHasNewerRowAndRemoveTombstone(
      * @param gcElementRowId Row id of the element from the GC queue/
      * @return Key of the row that needs to be garbage collected, or {@code 
null} if such row doesn't exist.
      */
-    private @Nullable ByteBuffer getRowForGcKey(RocksIterator it, RowId 
gcElementRowId) {
+    private @Nullable ByteBuffer getDataIdForGcKey(RocksIterator it, RowId 
gcElementRowId) {

Review Comment:
   Let's update the javadoc, it still says "return key of the row" instead of 
smt like "key of the row's data ID"
   
   And name is misleading, we get key, not data Id itself



##########
modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/GarbageCollector.java:
##########
@@ -167,12 +178,12 @@ AddResult tryAddToGcQueue(WriteBatchWithIndex writeBatch, 
RowId rowId, HybridTim
      * @param lowWatermark Low watermark.
      * @return Garbage collected element descriptor.
      */
-    @Nullable GcEntry peek(HybridTimestamp lowWatermark) {
+    @Nullable GcEntry peek(WriteBatchWithIndex writeBatch, HybridTimestamp 
lowWatermark) {

Review Comment:
   Forgot to add param to javadoc



##########
modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/PartitionDataHelper.java:
##########
@@ -263,6 +294,55 @@ 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.

Review Comment:
   We could use setRightMostBit, or setLsb / setLeastSignificantBit to avoid 
confusion
   
   Maybe even "setTombstoneBit"



##########
modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/PartitionDataHelper.java:
##########
@@ -44,45 +43,46 @@
 import org.jetbrains.annotations.Nullable;
 import org.rocksdb.ColumnFamilyHandle;
 import org.rocksdb.ReadOptions;
+import org.rocksdb.RocksDB;
+import org.rocksdb.RocksDBException;
 import org.rocksdb.RocksIterator;
 import org.rocksdb.Slice;
 import org.rocksdb.WriteBatchWithIndex;
 
 /** Helper for the partition data. */
 public final class PartitionDataHelper implements ManuallyCloseable {
+    /** Transaction id size (part of the transaction state). */
+    private static final int TX_ID_SIZE = 2 * Long.BYTES;
+
     /** Position of row id inside the key. */
-    static final int ROW_ID_OFFSET = TABLE_ID_SIZE + Short.BYTES;
+    static final int ROW_ID_OFFSET = TABLE_ID_SIZE + PARTITION_ID_SIZE;
 
-    /** Size of the key without timestamp. */

Review Comment:
   unintentional?



-- 
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]

Reply via email to