tkalkirill commented on code in PR #4465:
URL: https://github.com/apache/ignite-3/pull/4465#discussion_r1778473990


##########
modules/metastorage/src/main/java/org/apache/ignite/internal/metastorage/server/KeyValueStorage.java:
##########
@@ -233,13 +234,31 @@ boolean invoke(
     void removeWatch(WatchListener listener);
 
     /**
-     * Compacts storage (removes tombstones).
+     * Compacts outdated key versions and removes tombstones of metastorage 
locally.
      *
-     * @param lowWatermark A time threshold for the entry. Only entries that 
have revisions with timestamp higher or equal to the
-     *     watermark can be removed.
+     * <p>We do not compact the only and last version of the key unless it is 
a tombstone.</p>
+     *
+     * <p>Let's look at some examples, let's say we have the following keys 
with their versions:</p>
+     * <ul>
+     *     <li>Key "foo" with versions that have revisions (1, 3, 5) - "foo" 
[1, 3, 5].</li>
+     *     <li>Key "bar" with versions that have revisions (1, 2, 5) the last 
revision is a tombstone - "bar" [1, 2, 5 tomb].</li>
+     * </ul>
+     *
+     * <p>Let's look at examples of invoking the current method and what will 
be in the storage after:</p>
+     * <ul>
+     *     <li>Compaction revision is {@code 1}: "foo" [3, 5], "bar" [2, 5 
tomb].</li>
+     *     <li>Compaction revision is {@code 2}: "foo" [3, 5], "bar" [5 
tomb].</li>
+     *     <li>Compaction revision is {@code 3}: "foo" [5], "bar" [5 
tomb].</li>
+     *     <li>Compaction revision is {@code 4}: "foo" [5], "bar" [5 
tomb].</li>
+     *     <li>Compaction revision is {@code 5}: "foo" [5].</li>
+     *     <li>Compaction revision is {@code 6}: "foo" [5].</li>
+     * </ul>
+     *
+     * @param revision Revision up to which the metastorage keys will be 
compacted.

Review Comment:
   thanks



-- 
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-unsubscr...@ignite.apache.org

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

Reply via email to