SammyVimes commented on code in PR #1102:
URL: https://github.com/apache/ignite-3/pull/1102#discussion_r977553946


##########
modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvPartitionStorage.java:
##########
@@ -443,56 +487,166 @@ public void commitWrite(RowId rowId, HybridTimestamp 
timestamp) throws StorageEx
                         : baseIterator
         ) {
             if (timestamp == null) {
+                ByteBuffer keyBuf = prepareHeapKeyBuf(rowId);
+
                 // Seek to the first appearance of row id if timestamp isn't 
set.
-                // Since timestamps are sorted from newest to oldest, first 
occurance will always be the latest version.
+                // Since timestamps are sorted from newest to oldest, first 
occurrence will always be the latest version.
                 // Unfortunately, copy here is unavoidable with current API.
-                seekIterator.seek(copyOf(keyBuf.array(), keyBuf.position()));
-            } else {
-                // Put timestamp restriction according to N2O timestamps order.
-                putTimestamp(keyBuf, timestamp);
+                assert keyBuf.position() == ROW_PREFIX_SIZE;
+                seekIterator.seek(copyOf(keyBuf.array(), ROW_PREFIX_SIZE));
+
+                if (invalid(seekIterator)) {
+                    // No data at all.
+                    return ReadResult.empty();
+                }
+
+                ByteBuffer readKeyBuf = 
MV_KEY_BUFFER.get().position(0).limit(MAX_KEY_SIZE);
+
+                int keyLength = seekIterator.key(readKeyBuf);
+
+                if (!matches(rowId, readKeyBuf)) {
+                    // Wrong row id.
+                    return ReadResult.empty();
+                }
+
+                boolean isWriteIntent = keyLength == ROW_PREFIX_SIZE;
 
-                // This seek will either find a key with timestamp that's less 
or equal than required value, or a different key whatsoever.
-                // It is guaranteed by descending order of timestamps.
-                seekIterator.seek(keyBuf.array());
+                byte[] valueBytes = seekIterator.value();

Review Comment:
   I feel like doing another seek is going to be less efficient, yes



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