You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "sergeyuttsel (via GitHub)" <gi...@apache.org> on 2023/06/21 10:20:03 UTC

[GitHub] [ignite-3] sergeyuttsel commented on a diff in pull request #2227: IGNITE-19745 Added a method for local obtaining entries in MetaStorage from lower bound revision to upper bound revision.

sergeyuttsel commented on code in PR #2227:
URL: https://github.com/apache/ignite-3/pull/2227#discussion_r1236757037


##########
modules/metastorage/src/main/java/org/apache/ignite/internal/metastorage/server/KeyValueStorage.java:
##########
@@ -70,6 +70,16 @@ public interface KeyValueStorage extends ManuallyCloseable {
      */
     Entry get(byte[] key, long revUpperBound);
 
+    /**
+     * Returns an entries by the given key and bounded by given revisions.

Review Comment:
   Fixed



##########
modules/metastorage/src/main/java/org/apache/ignite/internal/metastorage/server/persistence/RocksDbKeyValueStorage.java:
##########
@@ -1215,6 +1227,54 @@ private Entry doGet(byte[] key, long revUpperBound) {
         return doGetValue(key, lastRev);
     }
 
+    /**
+     * Gets the value by key and revisions.
+     *
+     * @param key            Target key.
+     * @param revLowerBound  Target lower bound of revision.
+     * @param revUpperBound  Target upper bound of revision.
+     * @return Value.
+     */
+    private List<Entry> doGetEntries(byte[] key, long revLowerBound, long revUpperBound) {
+        assert revLowerBound >= 0 : "Invalid arguments: [revLowerBound=" + revLowerBound + ']';
+        assert revUpperBound >= 0 : "Invalid arguments: [revUpperBound=" + revUpperBound + ']';
+        assert revUpperBound >= revLowerBound
+                : "Invalid arguments: [revLowerBound=" + revLowerBound + ", revUpperBound=" + revUpperBound + ']';
+        // TODO: IGNITE-19782 assert that revLowerBound is not compacted.
+
+        long[] revs;
+
+        try {
+            revs = getRevisions(key);
+        } catch (RocksDBException e) {
+            throw new MetaStorageException(OP_EXECUTION_ERR, e);
+        }
+
+        if (revs.length == 0) {
+            return Collections.emptyList();
+        }
+
+        long firstRev = minRevision(revs, revLowerBound);

Review Comment:
   Fixed



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