You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2022/09/26 09:50:09 UTC

[GitHub] [ignite-3] sashapolo commented on a diff in pull request #1121: IGNITE-17673 Extended MV partition storage API with methods to help cleaning SQL indices

sashapolo commented on code in PR #1121:
URL: https://github.com/apache/ignite-3/pull/1121#discussion_r979801617


##########
modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvPartitionStorage.java:
##########
@@ -648,6 +649,37 @@ private static boolean matches(RowId rowId, ByteBuffer keyByf) {
         return rowId.mostSignificantBits() == keyByf.getLong() && rowId.leastSignificantBits() == keyByf.getLong();
     }
 
+    @Override
+    public Cursor<BinaryRow> scanVersions(RowId rowId) throws StorageException {
+        ByteBuffer keyBuf = prepareHeapKeyBuf(rowId);
+
+        byte[] lowerBound = copyOf(keyBuf.array(), ROW_PREFIX_SIZE);
+
+        incrementRowId(keyBuf);
+
+        Slice upperBound = new Slice(copyOf(keyBuf.array(), ROW_PREFIX_SIZE));
+
+        var options = new ReadOptions().setIterateUpperBound(upperBound).setTotalOrderSeek(true);
+
+        RocksIterator it = db.newIterator(cf, options);
+
+        it.seek(lowerBound);
+
+        return new RocksIteratorAdapter<>(it) {
+            @Override
+            protected BinaryRow decodeEntry(byte[] key, byte[] value) {
+                return wrapValueIntoBinaryRow(value, key.length == ROW_PREFIX_SIZE);
+            }
+
+            @Override
+            public void close() throws Exception {
+                super.close();
+
+                IgniteUtils.closeAll(it, options, upperBound);

Review Comment:
   `it` is also closed in the `super.close` call. I wonder why it doesn't fail...



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org