sashapolo commented on a change in pull request #562:
URL: https://github.com/apache/ignite-3/pull/562#discussion_r789475842



##########
File path: 
modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/RocksDbPartitionStorage.java
##########
@@ -436,21 +476,47 @@ public boolean hasNext() {
 
         @Override
         protected DataRow decodeEntry(byte[] key, byte[] value) {
-            return new SimpleDataRow(key, value);
+            byte[] rowKey = new byte[key.length - PARTITION_KEY_PREFIX_SIZE];
+
+            System.arraycopy(key, PARTITION_KEY_PREFIX_SIZE, rowKey, 0, 
rowKey.length);
+
+            return new SimpleDataRow(rowKey, value);
         }
     }
 
+    /**
+     * Creates a key used in this partition storage by prepending a partition 
ID (to distinguish between different partition data)
+     * and the key's hash (an optimisation).
+     */
+    private byte[] partitionKey(byte[] key) {
+        byte[] partitionKey = new byte[PARTITION_KEY_PREFIX_SIZE + key.length];
+
+        int pos = 0;
+
+        intToBytes(partId, partitionKey, pos, Integer.BYTES);

Review comment:
       I had a thought about that and I think that the current code is still 
pretty readable. I think using a `ByteBuffer` will not improve the code in this 
case. Though I will give it a try and will post the results.




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