This is an automated email from the ASF dual-hosted git repository.

apolovtsev pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


The following commit(s) were added to refs/heads/main by this push:
     new a456027af3 IGNITE-22507 Add `MvPartitionStorage#estimatedSize` method 
(#4025)
a456027af3 is described below

commit a456027af3206a12e188cef86bea7cd24e63d03f
Author: Alexander Polovtcev <[email protected]>
AuthorDate: Tue Jul 2 14:03:33 2024 +0300

    IGNITE-22507 Add `MvPartitionStorage#estimatedSize` method (#4025)
---
 .idea/inspectionProfiles/Project_Default.xml       |   5 +-
 .../internal/storage/MvPartitionStorage.java       |  18 +++-
 .../storage/ThreadAssertingMvPartitionStorage.java |   5 +
 .../AbstractMvPartitionStorageConcurrencyTest.java |  39 +++++++
 .../storage/AbstractMvPartitionStorageTest.java    | 113 ++++++++++++++++++++-
 .../storage/AbstractMvTableStorageTest.java        |  66 +++++++++++-
 .../storage/impl/TestMvPartitionStorage.java       |  36 +++++--
 .../mv/AbstractPageMemoryMvPartitionStorage.java   |  12 ++-
 .../PersistentPageMemoryMvTableStorageTest.java    |  13 +++
 .../VolatilePageMemoryMvTableStorageTest.java      |  13 +++
 .../AbstractPageMemoryMvPartitionStorageTest.java  |  37 +++++++
 ...ageMemoryMvPartitionStorageConcurrencyTest.java |   7 ++
 ...ageMemoryMvPartitionStorageConcurrencyTest.java |   7 ++
 .../internal/storage/rocksdb/GarbageCollector.java |   2 +-
 .../storage/rocksdb/RocksDbMvPartitionStorage.java |   6 ++
 .../RocksDbMvPartitionStorageConcurrencyTest.java  |   7 ++
 .../rocksdb/RocksDbMvPartitionStorageTest.java     |  37 +++++++
 .../storage/rocksdb/RocksDbMvTableStorageTest.java |  13 +++
 18 files changed, 415 insertions(+), 21 deletions(-)

diff --git a/.idea/inspectionProfiles/Project_Default.xml 
b/.idea/inspectionProfiles/Project_Default.xml
index 451a802506..de01890795 100644
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -13,7 +13,6 @@
       <option name="ignoredClasses">
         <set>
           <option value="org.apache.ignite.internal.logger.IgniteLogger" />
-          <option value="org.apache.ignite.lang.ByteArray" />
         </set>
       </option>
     </inspection_tool>
@@ -1053,9 +1052,7 @@
     <inspection_tool class="SystemGetenv" enabled="true" level="WARNING" 
enabled_by_default="true" />
     <inspection_tool class="TestCaseInProductCode" enabled="true" 
level="WARNING" enabled_by_default="true" />
     <inspection_tool class="TestCaseWithConstructor" enabled="true" 
level="WARNING" enabled_by_default="true" />
-    <inspection_tool class="TestCaseWithNoTestMethods" enabled="true" 
level="WARNING" enabled_by_default="true">
-      <option name="ignoreSupers" value="true" />
-    </inspection_tool>
+    <inspection_tool class="TestCaseWithNoTestMethods" enabled="true" 
level="WARNING" enabled_by_default="true" />
     <inspection_tool class="TestMethodInProductCode" enabled="true" 
level="WARNING" enabled_by_default="true" />
     <inspection_tool class="TestNGDataProvider" enabled="false" 
level="WARNING" enabled_by_default="false" />
     <inspection_tool class="TestOnlyProblems" enabled="true" level="WARNING" 
enabled_by_default="true" />
diff --git 
a/modules/storage-api/src/main/java/org/apache/ignite/internal/storage/MvPartitionStorage.java
 
b/modules/storage-api/src/main/java/org/apache/ignite/internal/storage/MvPartitionStorage.java
index 51a8dbddbb..1b33131d23 100644
--- 
a/modules/storage-api/src/main/java/org/apache/ignite/internal/storage/MvPartitionStorage.java
+++ 
b/modules/storage-api/src/main/java/org/apache/ignite/internal/storage/MvPartitionStorage.java
@@ -268,12 +268,28 @@ public interface MvPartitionStorage extends 
ManuallyCloseable {
     void updateLease(long leaseStartTime);
 
     /**
-     * Return the start time of the known lease for this replication group.
+     * Returns the start time of the known lease for this replication group.
      *
      * @return Lease start time.
      */
     long leaseStartTime();
 
+    /**
+     * Returns the <em>estimated size</em> of this partition.
+     *
+     * <p>It corresponds to the number of rows in this partition that 
satisfies the following restrictions:
+     *
+     * <ol>
+     *     <li>It is <b>eventually consistent</b> in relation to concurrent 
transactions, that is, it only shows the amount of committed
+     *     rows, regardless of the transaction context;</li>
+     *     <li>It only reflects the number of rows at the <b>most recent</b> 
point in time, that is, it does not reflect any historical
+     *     changes to the same rows.</li>
+     * </ol>
+     *
+     * @return Estimated size of this partition.
+     */
+    long estimatedSize();
+
     /**
      * Closes the storage.
      *
diff --git 
a/modules/storage-api/src/main/java/org/apache/ignite/internal/storage/ThreadAssertingMvPartitionStorage.java
 
b/modules/storage-api/src/main/java/org/apache/ignite/internal/storage/ThreadAssertingMvPartitionStorage.java
index 50308b7122..6630c63bbd 100644
--- 
a/modules/storage-api/src/main/java/org/apache/ignite/internal/storage/ThreadAssertingMvPartitionStorage.java
+++ 
b/modules/storage-api/src/main/java/org/apache/ignite/internal/storage/ThreadAssertingMvPartitionStorage.java
@@ -166,6 +166,11 @@ public class ThreadAssertingMvPartitionStorage implements 
MvPartitionStorage, Wr
         return partitionStorage.leaseStartTime();
     }
 
+    @Override
+    public long estimatedSize() {
+        return partitionStorage.estimatedSize();
+    }
+
     @Override
     public void close() {
         partitionStorage.close();
diff --git 
a/modules/storage-api/src/testFixtures/java/org/apache/ignite/internal/storage/AbstractMvPartitionStorageConcurrencyTest.java
 
b/modules/storage-api/src/testFixtures/java/org/apache/ignite/internal/storage/AbstractMvPartitionStorageConcurrencyTest.java
index e9b0736ef5..3059a08ffd 100644
--- 
a/modules/storage-api/src/testFixtures/java/org/apache/ignite/internal/storage/AbstractMvPartitionStorageConcurrencyTest.java
+++ 
b/modules/storage-api/src/testFixtures/java/org/apache/ignite/internal/storage/AbstractMvPartitionStorageConcurrencyTest.java
@@ -28,6 +28,7 @@ import static org.junit.jupiter.api.Assertions.assertNull;
 
 import java.util.Collection;
 import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.LinkedBlockingQueue;
 import org.apache.ignite.internal.hlc.HybridTimestamp;
 import org.apache.ignite.internal.schema.BinaryRow;
 import org.hamcrest.Matcher;
@@ -221,6 +222,44 @@ public abstract class 
AbstractMvPartitionStorageConcurrencyTest extends BaseMvPa
         }
     }
 
+    @Test
+    public void testConcurrentAddAndRemoveEstimatedSize() {
+        var queue = new LinkedBlockingQueue<RowId>();
+
+        int firstBatch = REPEATS / 2;
+        int secondBatch = REPEATS - firstBatch;
+
+        runRace(
+                () -> {
+                    for (int i = 0; i < firstBatch; i++) {
+                        var rowId = new RowId(PARTITION_ID);
+
+                        addWriteCommitted(rowId, TABLE_ROW, clock.now());
+
+                        queue.add(rowId);
+                    }
+                },
+                () -> {
+                    for (int i = 0; i < secondBatch; i++) {
+                        var rowId = new RowId(PARTITION_ID);
+
+                        addWriteCommitted(rowId, TABLE_ROW, clock.now());
+
+                        queue.add(rowId);
+                    }
+                },
+                () -> {
+                    for (int i = 0; i < REPEATS; i++) {
+                        RowId rowId = queue.take();
+
+                        addWriteCommitted(rowId, null, clock.now());
+                    }
+                }
+        );
+
+        assertThat(storage.estimatedSize(), is(0L));
+    }
+
     private static void assertRemoveRow(@Nullable BinaryRow rowBytes, 
Collection<BinaryRow> rows) {
         assertNotNull(rowBytes);
 
diff --git 
a/modules/storage-api/src/testFixtures/java/org/apache/ignite/internal/storage/AbstractMvPartitionStorageTest.java
 
b/modules/storage-api/src/testFixtures/java/org/apache/ignite/internal/storage/AbstractMvPartitionStorageTest.java
index dc554fac03..513df2c142 100644
--- 
a/modules/storage-api/src/testFixtures/java/org/apache/ignite/internal/storage/AbstractMvPartitionStorageTest.java
+++ 
b/modules/storage-api/src/testFixtures/java/org/apache/ignite/internal/storage/AbstractMvPartitionStorageTest.java
@@ -354,10 +354,10 @@ public abstract class AbstractMvPartitionStorageTest 
extends BaseMvPartitionStor
         }
     }
 
-    private List<TestValue> convert(PartitionTimestampCursor cursor) {
+    private static List<TestValue> convert(PartitionTimestampCursor cursor) {
         try (cursor) {
             return cursor.stream()
-                    .map((ReadResult rs) -> 
BaseMvStoragesTest.value(rs.binaryRow()))
+                    .map(rs -> value(rs.binaryRow()))
                     .sorted(Comparator.nullsFirst(Comparator.naturalOrder()))
                     .collect(toList());
         }
@@ -1376,13 +1376,120 @@ public abstract class AbstractMvPartitionStorageTest 
extends BaseMvPartitionStor
         });
     }
 
+    @Test
+    public void estimatedSizeUsingWriteIntents() {
+        assertThat(storage.estimatedSize(), is(0L));
+
+        // Adding a Write Intent should not increase the size.
+        addWrite(ROW_ID, binaryRow, newTransactionId());
+
+        assertThat(storage.estimatedSize(), is(0L));
+
+        // Committing a row increases the size.
+        commitWrite(ROW_ID, clock.now());
+
+        assertThat(storage.estimatedSize(), is(1L));
+
+        // Adding a Write Intent with a tombstone does not decrease the size.
+        addWrite(ROW_ID, null, newTransactionId());
+
+        assertThat(storage.estimatedSize(), is(1L));
+
+        // Committing a tombstone decreases the size.
+        commitWrite(ROW_ID, clock.now());
+
+        assertThat(storage.estimatedSize(), is(0L));
+    }
+
+    @Test
+    public void estimatedSizeUsingCommittedWrites() {
+        assertThat(storage.estimatedSize(), is(0L));
+
+        addWriteCommitted(ROW_ID, binaryRow, clock.now());
+
+        assertThat(storage.estimatedSize(), is(1L));
+
+        addWriteCommitted(ROW_ID, null, clock.now());
+
+        assertThat(storage.estimatedSize(), is(0L));
+    }
+
+    @Test
+    public void estimatedSizeNeverFallsBelowZero() {
+        assertThat(storage.estimatedSize(), is(0L));
+
+        addWriteCommitted(ROW_ID, null, clock.now());
+
+        assertThat(storage.estimatedSize(), is(0L));
+
+        addWriteCommitted(ROW_ID, binaryRow, clock.now());
+
+        assertThat(storage.estimatedSize(), is(1L));
+
+        addWriteCommitted(ROW_ID, null, clock.now());
+
+        assertThat(storage.estimatedSize(), is(0L));
+
+        addWriteCommitted(ROW_ID, null, clock.now());
+
+        assertThat(storage.estimatedSize(), is(0L));
+    }
+
+    @Test
+    public void estimatedSizeShowsLatestRowsNumber() {
+        assertThat(storage.estimatedSize(), is(0L));
+
+        var rowId1 = new RowId(PARTITION_ID);
+        var rowId2 = new RowId(PARTITION_ID);
+
+        addWriteCommitted(rowId1, binaryRow, clock.now());
+        addWriteCommitted(rowId2, binaryRow, clock.now());
+
+        assertThat(storage.estimatedSize(), is(2L));
+
+        // Overwrite an existing row.
+        addWriteCommitted(rowId1, binaryRow, clock.now());
+
+        assertThat(storage.estimatedSize(), is(2L));
+    }
+
+    @Test
+    public void estimatedSizeIsNotAffectedByGarbageTombstones() {
+        assertThat(storage.estimatedSize(), is(0L));
+
+        var rowId1 = new RowId(PARTITION_ID);
+        var rowId2 = new RowId(PARTITION_ID);
+
+        addWriteCommitted(rowId1, binaryRow, clock.now());
+
+        assertThat(storage.estimatedSize(), is(1L));
+
+        // Remove a non-existing row.
+        addWriteCommitted(rowId2, null, clock.now());
+
+        assertThat(storage.estimatedSize(), is(1L));
+    }
+
+    @Test
+    public void estimatedSizeHandlesTransactionAborts() {
+        UUID transactionId = newTransactionId();
+
+        addWriteCommitted(ROW_ID, binaryRow, clock.now());
+
+        addWrite(ROW_ID, binaryRow, transactionId);
+
+        abortWrite(ROW_ID);
+
+        assertThat(storage.estimatedSize(), is(1L));
+    }
+
     /**
      * Returns row id that is lexicographically smaller (by the value of one) 
than the argument.
      *
      * @param value Row id.
      * @return Row id value minus 1.
      */
-    private RowId decrement(RowId value) {
+    private static RowId decrement(RowId value) {
         long msb = value.mostSignificantBits();
         long lsb = value.leastSignificantBits();
 
diff --git 
a/modules/storage-api/src/testFixtures/java/org/apache/ignite/internal/storage/AbstractMvTableStorageTest.java
 
b/modules/storage-api/src/testFixtures/java/org/apache/ignite/internal/storage/AbstractMvTableStorageTest.java
index 05fc2a551a..11a6a05f93 100644
--- 
a/modules/storage-api/src/testFixtures/java/org/apache/ignite/internal/storage/AbstractMvTableStorageTest.java
+++ 
b/modules/storage-api/src/testFixtures/java/org/apache/ignite/internal/storage/AbstractMvTableStorageTest.java
@@ -62,6 +62,7 @@ import java.util.List;
 import java.util.Random;
 import java.util.UUID;
 import java.util.concurrent.CompletableFuture;
+import java.util.stream.IntStream;
 import org.apache.ignite.internal.binarytuple.BinaryTupleBuilder;
 import org.apache.ignite.internal.catalog.CatalogService;
 import org.apache.ignite.internal.catalog.commands.CatalogUtils;
@@ -1394,6 +1395,68 @@ public abstract class AbstractMvTableStorageTest extends 
BaseMvStoragesTest {
         checkForMissingRows(mvPartitionStorage, hashIndexStorage, 
sortedIndexStorage, rows);
     }
 
+    @Test
+    public void testEstimatedSizeAfterRebalance() {
+        MvPartitionStorage mvPartitionStorage = 
getOrCreateMvPartition(PARTITION_ID);
+
+        List<TestRow> rowsBeforeRebalance = IntStream.range(0, 2)
+                .mapToObj(i -> new TestRow(
+                        new RowId(PARTITION_ID),
+                        binaryRow(new TestKey(i, "0"), new TestValue(i, "0"))
+                ))
+                .collect(toList());
+
+        fillStorages(mvPartitionStorage, null, null, rowsBeforeRebalance);
+
+        assertThat(mvPartitionStorage.estimatedSize(), is(2L));
+
+        assertThat(tableStorage.startRebalancePartition(PARTITION_ID), 
willCompleteSuccessfully());
+
+        List<TestRow> rowsAfterRebalance = IntStream.range(2, 5)
+                .mapToObj(i -> new TestRow(
+                        new RowId(PARTITION_ID),
+                        binaryRow(new TestKey(i, "0"), new TestValue(i, "0"))
+                ))
+                .collect(toList());
+
+        fillStorages(mvPartitionStorage, null, null, rowsAfterRebalance);
+
+        assertThat(tableStorage.finishRebalancePartition(PARTITION_ID, 42, 42, 
BYTE_EMPTY_ARRAY), willCompleteSuccessfully());
+
+        assertThat(mvPartitionStorage.estimatedSize(), is(3L));
+    }
+
+    @Test
+    public void testEstimatedSizeAfterAbortRebalance() {
+        MvPartitionStorage mvPartitionStorage = 
getOrCreateMvPartition(PARTITION_ID);
+
+        List<TestRow> rowsBeforeRebalance = IntStream.range(0, 2)
+                .mapToObj(i -> new TestRow(
+                        new RowId(PARTITION_ID),
+                        binaryRow(new TestKey(i, "0"), new TestValue(i, "0"))
+                ))
+                .collect(toList());
+
+        fillStorages(mvPartitionStorage, null, null, rowsBeforeRebalance);
+
+        assertThat(mvPartitionStorage.estimatedSize(), is(2L));
+
+        assertThat(tableStorage.startRebalancePartition(PARTITION_ID), 
willCompleteSuccessfully());
+
+        List<TestRow> rowsAfterRebalance = IntStream.range(2, 5)
+                .mapToObj(i -> new TestRow(
+                        new RowId(PARTITION_ID),
+                        binaryRow(new TestKey(i, "0"), new TestValue(i, "0"))
+                ))
+                .collect(toList());
+
+        fillStorages(mvPartitionStorage, null, null, rowsAfterRebalance);
+
+        assertThat(tableStorage.abortRebalancePartition(PARTITION_ID), 
willCompleteSuccessfully());
+
+        assertThat(mvPartitionStorage.estimatedSize(), is(0L));
+    }
+
     private void startRebalanceWithChecks(
             int partitionId,
             MvPartitionStorage mvPartitionStorage,
@@ -1514,7 +1577,7 @@ public abstract class AbstractMvTableStorageTest extends 
BaseMvStoragesTest {
         return getOrCreateMvPartition(tableStorage, partitionId);
     }
 
-    void testNextRowIdToBuildAfterOperation(Operation operation) throws 
Exception {
+    private void testNextRowIdToBuildAfterOperation(Operation operation) 
throws Exception {
         MvPartitionStorage mvPartitionStorage = 
getOrCreateMvPartition(PARTITION_ID);
 
         IndexStorage hashIndexStorage = getOrCreateIndex(PARTITION_ID, 
hashIdx, false);
@@ -1562,6 +1625,7 @@ public abstract class AbstractMvTableStorageTest extends 
BaseMvStoragesTest {
         assertThat(recreatedPkIndexStorage.getNextRowIdToBuild(), 
is(equalTo(rowId2)));
     }
 
+    @FunctionalInterface
     private interface Operation {
         void doOperation() throws Exception;
     }
diff --git 
a/modules/storage-api/src/testFixtures/java/org/apache/ignite/internal/storage/impl/TestMvPartitionStorage.java
 
b/modules/storage-api/src/testFixtures/java/org/apache/ignite/internal/storage/impl/TestMvPartitionStorage.java
index 33aa0ab287..9393b857a7 100644
--- 
a/modules/storage-api/src/testFixtures/java/org/apache/ignite/internal/storage/impl/TestMvPartitionStorage.java
+++ 
b/modules/storage-api/src/testFixtures/java/org/apache/ignite/internal/storage/impl/TestMvPartitionStorage.java
@@ -30,6 +30,7 @@ import java.util.concurrent.ConcurrentNavigableMap;
 import java.util.concurrent.ConcurrentSkipListMap;
 import java.util.concurrent.ConcurrentSkipListSet;
 import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLongFieldUpdater;
 import org.apache.ignite.internal.hlc.HybridTimestamp;
 import org.apache.ignite.internal.schema.BinaryRow;
 import org.apache.ignite.internal.storage.MvPartitionStorage;
@@ -55,6 +56,9 @@ public class TestMvPartitionStorage implements 
MvPartitionStorage {
     /** Preserved {@link LocalLocker} instance to allow nested calls of {@link 
#runConsistently(WriteClosure)}. */
     private static final ThreadLocal<LocalLocker> THREAD_LOCAL_LOCKER = new 
ThreadLocal<>();
 
+    private static final AtomicLongFieldUpdater<TestMvPartitionStorage> 
ESTIMATED_SIZE_UPDATER =
+            AtomicLongFieldUpdater.newUpdater(TestMvPartitionStorage.class, 
"estimatedSize");
+
     private final ConcurrentNavigableMap<RowId, VersionChain> map = new 
ConcurrentSkipListMap<>();
 
     private final NavigableSet<VersionChain> gcQueue = new 
ConcurrentSkipListSet<>(
@@ -68,11 +72,14 @@ public class TestMvPartitionStorage implements 
MvPartitionStorage {
 
     private volatile long leaseStartTime = 
HybridTimestamp.MIN_VALUE.longValue();
 
+    private volatile long estimatedSize;
+
     private volatile byte @Nullable [] groupConfig;
 
     final int partitionId;
 
     private volatile boolean closed;
+
     private volatile boolean destroyed;
 
     private volatile boolean rebalance;
@@ -314,9 +321,13 @@ public class TestMvPartitionStorage implements 
MvPartitionStorage {
         VersionChain nextChain = committedVersionChain.next;
 
         if (nextChain != null) {
-            // Avoid creating tombstones for tombstones.
-            if (committedVersionChain.row == null && nextChain.row == null) {
-                return nextChain;
+            if (committedVersionChain.row == null) {
+                if (nextChain.row == null) {
+                    // Avoid creating tombstones for tombstones.
+                    return nextChain;
+                }
+
+                ESTIMATED_SIZE_UPDATER.decrementAndGet(this);
             }
 
             // Calling it from the compute is fine. Concurrent writes of the 
same row are impossible, and if we call the compute closure
@@ -327,6 +338,8 @@ public class TestMvPartitionStorage implements 
MvPartitionStorage {
                 // If there is only one version, and it is a tombstone, then 
remove the chain.
                 return null;
             }
+
+            ESTIMATED_SIZE_UPDATER.incrementAndGet(this);
         }
 
         return committedVersionChain;
@@ -621,7 +634,7 @@ public class TestMvPartitionStorage implements 
MvPartitionStorage {
     }
 
     @Override
-    public void updateLease(long leaseStartTime) {
+    public synchronized void updateLease(long leaseStartTime) {
         checkStorageClosed();
 
         if (leaseStartTime <= this.leaseStartTime) {
@@ -638,6 +651,13 @@ public class TestMvPartitionStorage implements 
MvPartitionStorage {
         return leaseStartTime;
     }
 
+    @Override
+    public long estimatedSize() {
+        checkStorageClosed();
+
+        return estimatedSize;
+    }
+
     @Override
     public void close() {
         closed = true;
@@ -668,6 +688,7 @@ public class TestMvPartitionStorage implements 
MvPartitionStorage {
 
         lastAppliedIndex = 0;
         lastAppliedTerm = 0;
+        estimatedSize = 0;
         groupConfig = null;
 
         leaseStartTime = HybridTimestamp.MIN_VALUE.longValue();
@@ -708,7 +729,7 @@ public class TestMvPartitionStorage implements 
MvPartitionStorage {
 
         lastAppliedIndex = REBALANCE_IN_PROGRESS;
         lastAppliedTerm = REBALANCE_IN_PROGRESS;
-
+        estimatedSize = 0;
         groupConfig = null;
     }
 
@@ -722,11 +743,6 @@ public class TestMvPartitionStorage implements 
MvPartitionStorage {
         rebalance = false;
 
         clear0();
-
-        lastAppliedIndex = 0;
-        lastAppliedTerm = 0;
-
-        groupConfig = null;
     }
 
     void finishRebalance(long lastAppliedIndex, long lastAppliedTerm, byte[] 
groupConfig) {
diff --git 
a/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/mv/AbstractPageMemoryMvPartitionStorage.java
 
b/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/mv/AbstractPageMemoryMvPartitionStorage.java
index fe393ffe04..3f66000c20 100644
--- 
a/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/mv/AbstractPageMemoryMvPartitionStorage.java
+++ 
b/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/mv/AbstractPageMemoryMvPartitionStorage.java
@@ -246,6 +246,12 @@ public abstract class AbstractPageMemoryMvPartitionStorage 
implements MvPartitio
         });
     }
 
+    // TODO: Implement, see https://issues.apache.org/jira/browse/IGNITE-22616
+    @Override
+    public long estimatedSize() {
+        throw new UnsupportedOperationException();
+    }
+
     private static boolean lookingForLatestVersion(HybridTimestamp timestamp) {
         return timestamp == HybridTimestamp.MAX_VALUE;
     }
@@ -386,7 +392,11 @@ public abstract class AbstractPageMemoryMvPartitionStorage 
implements MvPartitio
         return ReadResult.empty(chain.rowId());
     }
 
-    private ReadResult writeIntentToResult(VersionChain chain, RowVersion 
rowVersion, @Nullable HybridTimestamp lastCommittedTimestamp) {
+    private static ReadResult writeIntentToResult(
+            VersionChain chain,
+            RowVersion rowVersion,
+            @Nullable HybridTimestamp lastCommittedTimestamp
+    ) {
         assert rowVersion.isUncommitted();
 
         UUID transactionId = chain.transactionId();
diff --git 
a/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/PersistentPageMemoryMvTableStorageTest.java
 
b/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/PersistentPageMemoryMvTableStorageTest.java
index 698fa830fb..53009c3ba3 100644
--- 
a/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/PersistentPageMemoryMvTableStorageTest.java
+++ 
b/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/PersistentPageMemoryMvTableStorageTest.java
@@ -43,6 +43,7 @@ import 
org.apache.ignite.internal.testframework.WorkDirectoryExtension;
 import org.apache.ignite.internal.util.IgniteUtils;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.ExtendWith;
 import org.junit.jupiter.params.ParameterizedTest;
@@ -135,4 +136,16 @@ public class PersistentPageMemoryMvTableStorageTest 
extends AbstractMvTableStora
             );
         }
     }
+
+    @Disabled("https://issues.apache.org/jira/browse/IGNITE-22616";)
+    @Override
+    public void testEstimatedSizeAfterRebalance() {
+        super.testEstimatedSizeAfterRebalance();
+    }
+
+    @Disabled("https://issues.apache.org/jira/browse/IGNITE-22616";)
+    @Override
+    public void testEstimatedSizeAfterAbortRebalance() {
+        super.testEstimatedSizeAfterAbortRebalance();
+    }
 }
diff --git 
a/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/VolatilePageMemoryMvTableStorageTest.java
 
b/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/VolatilePageMemoryMvTableStorageTest.java
index 21478b0f53..df03145f05 100644
--- 
a/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/VolatilePageMemoryMvTableStorageTest.java
+++ 
b/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/VolatilePageMemoryMvTableStorageTest.java
@@ -48,6 +48,7 @@ import org.apache.ignite.internal.type.NativeTypes;
 import org.apache.ignite.internal.util.IgniteUtils;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 
 /**
@@ -235,6 +236,18 @@ public class VolatilePageMemoryMvTableStorageTest extends 
AbstractMvTableStorage
         }
     }
 
+    @Disabled("https://issues.apache.org/jira/browse/IGNITE-22616";)
+    @Override
+    public void testEstimatedSizeAfterRebalance() {
+        super.testEstimatedSizeAfterRebalance();
+    }
+
+    @Disabled("https://issues.apache.org/jira/browse/IGNITE-22616";)
+    @Override
+    public void testEstimatedSizeAfterAbortRebalance() {
+        super.testEstimatedSizeAfterAbortRebalance();
+    }
+
     private VolatilePageMemoryDataRegion dataRegion() {
         return ((VolatilePageMemoryTableStorage) tableStorage).dataRegion();
     }
diff --git 
a/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/mv/AbstractPageMemoryMvPartitionStorageTest.java
 
b/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/mv/AbstractPageMemoryMvPartitionStorageTest.java
index aab1181582..353fc2d350 100644
--- 
a/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/mv/AbstractPageMemoryMvPartitionStorageTest.java
+++ 
b/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/mv/AbstractPageMemoryMvPartitionStorageTest.java
@@ -29,6 +29,7 @@ import org.apache.ignite.internal.schema.BinaryRow;
 import org.apache.ignite.internal.storage.AbstractMvPartitionStorageTest;
 import org.apache.ignite.internal.storage.PartitionTimestampCursor;
 import org.apache.ignite.internal.storage.RowId;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 
 /**
@@ -110,4 +111,40 @@ abstract class AbstractPageMemoryMvPartitionStorageTest 
extends AbstractMvPartit
             assertThat(foundRow, is(equalToRow(longRow)));
         }
     }
+
+    @Disabled("https://issues.apache.org/jira/browse/IGNITE-22616";)
+    @Override
+    public void estimatedSizeUsingWriteIntents() {
+        super.estimatedSizeUsingWriteIntents();
+    }
+
+    @Disabled("https://issues.apache.org/jira/browse/IGNITE-22616";)
+    @Override
+    public void estimatedSizeUsingCommittedWrites() {
+        super.estimatedSizeUsingCommittedWrites();
+    }
+
+    @Disabled("https://issues.apache.org/jira/browse/IGNITE-22616";)
+    @Override
+    public void estimatedSizeNeverFallsBelowZero() {
+        super.estimatedSizeNeverFallsBelowZero();
+    }
+
+    @Disabled("https://issues.apache.org/jira/browse/IGNITE-22616";)
+    @Override
+    public void estimatedSizeShowsLatestRowsNumber() {
+        super.estimatedSizeShowsLatestRowsNumber();
+    }
+
+    @Disabled("https://issues.apache.org/jira/browse/IGNITE-22616";)
+    @Override
+    public void estimatedSizeIsNotAffectedByGarbageTombstones() {
+        super.estimatedSizeIsNotAffectedByGarbageTombstones();
+    }
+
+    @Disabled("https://issues.apache.org/jira/browse/IGNITE-22616";)
+    @Override
+    public void estimatedSizeHandlesTransactionAborts() {
+        super.estimatedSizeHandlesTransactionAborts();
+    }
 }
diff --git 
a/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/mv/PersistentPageMemoryMvPartitionStorageConcurrencyTest.java
 
b/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/mv/PersistentPageMemoryMvPartitionStorageConcurrencyTest.java
index f1b1abfe0f..f10fca967f 100644
--- 
a/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/mv/PersistentPageMemoryMvPartitionStorageConcurrencyTest.java
+++ 
b/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/mv/PersistentPageMemoryMvPartitionStorageConcurrencyTest.java
@@ -38,6 +38,7 @@ import 
org.apache.ignite.internal.testframework.WorkDirectoryExtension;
 import org.apache.ignite.internal.util.IgniteUtils;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.extension.ExtendWith;
 
 @ExtendWith(WorkDirectoryExtension.class)
@@ -89,4 +90,10 @@ class PersistentPageMemoryMvPartitionStorageConcurrencyTest 
extends AbstractMvPa
                 engine == null ? null : engine::stop
         );
     }
+
+    @Disabled("https://issues.apache.org/jira/browse/IGNITE-22616";)
+    @Override
+    public void testConcurrentAddAndRemoveEstimatedSize() {
+        super.testConcurrentAddAndRemoveEstimatedSize();
+    }
 }
diff --git 
a/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/mv/VolatilePageMemoryMvPartitionStorageConcurrencyTest.java
 
b/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/mv/VolatilePageMemoryMvPartitionStorageConcurrencyTest.java
index 84a29c720f..1836477c75 100644
--- 
a/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/mv/VolatilePageMemoryMvPartitionStorageConcurrencyTest.java
+++ 
b/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/mv/VolatilePageMemoryMvPartitionStorageConcurrencyTest.java
@@ -33,6 +33,7 @@ import 
org.apache.ignite.internal.storage.pagememory.configuration.schema.Volati
 import org.apache.ignite.internal.util.IgniteUtils;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
 
 class VolatilePageMemoryMvPartitionStorageConcurrencyTest extends 
AbstractMvPartitionStorageConcurrencyTest {
     private VolatilePageMemoryStorageEngine engine;
@@ -70,4 +71,10 @@ class VolatilePageMemoryMvPartitionStorageConcurrencyTest 
extends AbstractMvPart
                 engine == null ? null : engine::stop
         );
     }
+
+    @Disabled("https://issues.apache.org/jira/browse/IGNITE-22616";)
+    @Override
+    public void testConcurrentAddAndRemoveEstimatedSize() {
+        super.testConcurrentAddAndRemoveEstimatedSize();
+    }
 }
diff --git 
a/modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/GarbageCollector.java
 
b/modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/GarbageCollector.java
index b6fe2fbf3c..2a57d215de 100644
--- 
a/modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/GarbageCollector.java
+++ 
b/modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/GarbageCollector.java
@@ -187,7 +187,7 @@ class GarbageCollector {
 
 
     /**
-     * Polls an element for vacuum. See {@link 
org.apache.ignite.internal.storage.MvPartitionStorage#vacuum(GcEntry)} 
(HybridTimestamp)}.
+     * Polls an element for vacuum. See {@link 
org.apache.ignite.internal.storage.MvPartitionStorage#vacuum(GcEntry)}.
      *
      * @param batch Write batch.
      * @param entry Entry, previously returned by {@link 
#peek(HybridTimestamp)}.
diff --git 
a/modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvPartitionStorage.java
 
b/modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvPartitionStorage.java
index e3253aa205..d35d48cd96 100644
--- 
a/modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvPartitionStorage.java
+++ 
b/modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvPartitionStorage.java
@@ -1044,6 +1044,12 @@ public class RocksDbMvPartitionStorage implements 
MvPartitionStorage {
         }
     }
 
+    // TODO: Implement, see https://issues.apache.org/jira/browse/IGNITE-22617
+    @Override
+    public long estimatedSize() {
+        throw new UnsupportedOperationException();
+    }
+
     @Override
     public void close() {
         transitionToDestroyedOrClosedState(StorageState.CLOSED);
diff --git 
a/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvPartitionStorageConcurrencyTest.java
 
b/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvPartitionStorageConcurrencyTest.java
index fd4bb95a14..1ce8965f37 100644
--- 
a/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvPartitionStorageConcurrencyTest.java
+++ 
b/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvPartitionStorageConcurrencyTest.java
@@ -33,6 +33,7 @@ import 
org.apache.ignite.internal.testframework.WorkDirectoryExtension;
 import org.apache.ignite.internal.util.IgniteUtils;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.extension.ExtendWith;
 
 /**
@@ -74,4 +75,10 @@ public class RocksDbMvPartitionStorageConcurrencyTest 
extends AbstractMvPartitio
                 engine == null ? null : engine::stop
         );
     }
+
+    @Disabled("https://issues.apache.org/jira/browse/IGNITE-22617";)
+    @Override
+    public void testConcurrentAddAndRemoveEstimatedSize() {
+        super.testConcurrentAddAndRemoveEstimatedSize();
+    }
 }
diff --git 
a/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvPartitionStorageTest.java
 
b/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvPartitionStorageTest.java
index 1562fda94a..59ecda3de5 100644
--- 
a/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvPartitionStorageTest.java
+++ 
b/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvPartitionStorageTest.java
@@ -33,6 +33,7 @@ import 
org.apache.ignite.internal.testframework.WorkDirectoryExtension;
 import org.apache.ignite.internal.util.IgniteUtils;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.extension.ExtendWith;
 
 /**
@@ -82,4 +83,40 @@ public class RocksDbMvPartitionStorageTest extends 
AbstractMvPartitionStorageTes
         // before calling addWriteCommitted(). For RocksDbMvPartitionStorage, 
it is not that cheap to check whether
         // there is a write intent in the storage, so we do not require it to 
throw this optional exception.
     }
+
+    @Disabled("https://issues.apache.org/jira/browse/IGNITE-22617";)
+    @Override
+    public void estimatedSizeUsingWriteIntents() {
+        super.estimatedSizeUsingWriteIntents();
+    }
+
+    @Disabled("https://issues.apache.org/jira/browse/IGNITE-22617";)
+    @Override
+    public void estimatedSizeUsingCommittedWrites() {
+        super.estimatedSizeUsingCommittedWrites();
+    }
+
+    @Disabled("https://issues.apache.org/jira/browse/IGNITE-22617";)
+    @Override
+    public void estimatedSizeNeverFallsBelowZero() {
+        super.estimatedSizeNeverFallsBelowZero();
+    }
+
+    @Disabled("https://issues.apache.org/jira/browse/IGNITE-22617";)
+    @Override
+    public void estimatedSizeShowsLatestRowsNumber() {
+        super.estimatedSizeShowsLatestRowsNumber();
+    }
+
+    @Disabled("https://issues.apache.org/jira/browse/IGNITE-22617";)
+    @Override
+    public void estimatedSizeIsNotAffectedByGarbageTombstones() {
+        super.estimatedSizeIsNotAffectedByGarbageTombstones();
+    }
+
+    @Disabled("https://issues.apache.org/jira/browse/IGNITE-22617";)
+    @Override
+    public void estimatedSizeHandlesTransactionAborts() {
+        super.estimatedSizeHandlesTransactionAborts();
+    }
 }
diff --git 
a/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvTableStorageTest.java
 
b/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvTableStorageTest.java
index 52f90af41d..8e5751a5a6 100644
--- 
a/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvTableStorageTest.java
+++ 
b/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvTableStorageTest.java
@@ -43,6 +43,7 @@ import 
org.apache.ignite.internal.testframework.WorkDirectoryExtension;
 import org.apache.ignite.internal.util.IgniteUtils;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.ExtendWith;
 
@@ -162,4 +163,16 @@ public class RocksDbMvTableStorageTest extends 
AbstractMvTableStorageTest {
     void storageAdvertisesItIsPersistent() {
         assertThat(tableStorage.isVolatile(), is(false));
     }
+
+    @Disabled("https://issues.apache.org/jira/browse/IGNITE-22617";)
+    @Override
+    public void testEstimatedSizeAfterRebalance() {
+        super.testEstimatedSizeAfterRebalance();
+    }
+
+    @Disabled("https://issues.apache.org/jira/browse/IGNITE-22617";)
+    @Override
+    public void testEstimatedSizeAfterAbortRebalance() {
+        super.testEstimatedSizeAfterAbortRebalance();
+    }
 }


Reply via email to