You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by tk...@apache.org on 2023/01/23 12:35:49 UTC
[ignite-3] branch main updated: IGNITE-18593 Get rid of MvPartitionStorage and TxStateStorage in PartitionAccess (#1556)
This is an automated email from the ASF dual-hosted git repository.
tkalkirill 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 d3294f0ac1 IGNITE-18593 Get rid of MvPartitionStorage and TxStateStorage in PartitionAccess (#1556)
d3294f0ac1 is described below
commit d3294f0ac19c9e0021d93d5d5f105e591b24a322
Author: Kirill Tkalenko <tk...@yandex.ru>
AuthorDate: Mon Jan 23 15:35:44 2023 +0300
IGNITE-18593 Get rid of MvPartitionStorage and TxStateStorage in PartitionAccess (#1556)
---
.../distributed/raft/snapshot/PartitionAccess.java | 119 ++++++++++++++--
.../raft/snapshot/PartitionAccessImpl.java | 158 ++++++++++++++++++---
.../snapshot/PartitionSnapshotStorageFactory.java | 12 +-
.../snapshot/incoming/IncomingSnapshotCopier.java | 107 +++++---------
.../raft/snapshot/outgoing/OutgoingSnapshot.java | 20 +--
.../raft/snapshot/PartitionAccessImplTest.java | 122 ++++++++++++++++
.../PartitionSnapshotStorageFactoryTest.java | 36 +----
.../outgoing/OutgoingSnapshotCommonTest.java | 52 +------
.../OutgoingSnapshotMvDataStreamingTest.java | 96 ++++++-------
.../outgoing/OutgoingSnapshotReaderTest.java | 30 ++--
.../OutgoingSnapshotTxDataStreamingTest.java | 33 ++---
.../outgoing/OutgoingSnapshotsManagerTest.java | 12 +-
12 files changed, 481 insertions(+), 316 deletions(-)
diff --git a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/snapshot/PartitionAccess.java b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/snapshot/PartitionAccess.java
index 7216d7e385..825185af39 100644
--- a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/snapshot/PartitionAccess.java
+++ b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/snapshot/PartitionAccess.java
@@ -17,10 +17,19 @@
package org.apache.ignite.internal.table.distributed.raft.snapshot;
+import java.util.UUID;
import java.util.concurrent.CompletableFuture;
-import org.apache.ignite.internal.storage.MvPartitionStorage;
+import org.apache.ignite.internal.hlc.HybridTimestamp;
+import org.apache.ignite.internal.schema.TableRow;
+import org.apache.ignite.internal.storage.RaftGroupConfiguration;
+import org.apache.ignite.internal.storage.ReadResult;
+import org.apache.ignite.internal.storage.RowId;
import org.apache.ignite.internal.storage.StorageException;
-import org.apache.ignite.internal.tx.storage.state.TxStateStorage;
+import org.apache.ignite.internal.storage.TxIdMismatchException;
+import org.apache.ignite.internal.tx.TxMeta;
+import org.apache.ignite.internal.util.Cursor;
+import org.apache.ignite.lang.IgniteBiTuple;
+import org.jetbrains.annotations.Nullable;
/**
* Small abstractions for partition storages that includes only methods, mandatory for the snapshot storage.
@@ -32,27 +41,111 @@ public interface PartitionAccess {
PartitionKey partitionKey();
/**
- * Returns the multi-versioned partition storage.
+ * Destroys and recreates the multi-versioned partition storage.
+ *
+ * @return Future that will complete when the partition is recreated.
+ * @throws StorageException If an error has occurred during the partition destruction.
*/
- MvPartitionStorage mvPartitionStorage();
+ CompletableFuture<Void> reCreateMvPartitionStorage() throws StorageException;
/**
- * Returns transaction state storage for the partition.
+ * Destroys and recreates the TX state partition storage.
+ *
+ * @throws StorageException If an error has occurred during destruction of the transaction state storage for the partition.
*/
- TxStateStorage txStatePartitionStorage();
+ void reCreateTxStatePartitionStorage() throws StorageException;
/**
- * Destroys and recreates the multi-versioned partition storage.
+ * Creates a cursor to scan all meta of transactions.
*
- * @return Future that will complete when the partition is recreated.
- * @throws StorageException If an error has occurred during the partition destruction.
+ * <p>All metas that exist at the time the method is called will be returned, in transaction ID order as an unsigned 128 bit integer.
*/
- CompletableFuture<MvPartitionStorage> reCreateMvPartitionStorage() throws StorageException;
+ Cursor<IgniteBiTuple<UUID, TxMeta>> getAllTxMeta();
/**
- * Destroys and recreates the multi-versioned partition storage.
+ * Adds transaction meta.
+ *
+ * @param txId Transaction ID.
+ * @param txMeta Transaction meta.
+ */
+ void addTxMeta(UUID txId, TxMeta txMeta);
+
+ /**
+ * Returns an existing row ID that is greater than or equal to the lower bound, {@code null} if not found.
+ *
+ * @param lowerBound Lower bound.
+ * @throws StorageException If failed to read data.
+ */
+ @Nullable RowId closestRowId(RowId lowerBound);
+
+ /**
+ * Scans all versions of a single row.
+ *
+ * <p>{@link ReadResult#newestCommitTimestamp()} is NOT filled by this method for intents having preceding committed
+ * versions.
+ *
+ * @param rowId Row id.
+ * @return Cursor of results including both rows data and transaction-related context. The versions are ordered from newest to oldest.
+ * @throws StorageException If failed to read data.
+ */
+ Cursor<ReadResult> getAllRowVersions(RowId rowId) throws StorageException;
+
+ /**
+ * Returns committed RAFT group configuration corresponding to the write command with the highest applied index, {@code null} if it was
+ * never saved.
+ */
+ @Nullable RaftGroupConfiguration committedGroupConfiguration();
+
+ /**
+ * Creates (or replaces) an uncommitted (aka pending) version, assigned to the given transaction id. In details: - if there is no
+ * uncommitted version, a new uncommitted version is added - if there is an uncommitted version belonging to the same transaction, it
+ * gets replaced by the given version - if there is an uncommitted version belonging to a different transaction,
+ * {@link TxIdMismatchException} is thrown
*
- * @throws StorageException If an error has occurred during transaction state storage for the partition destruction.
+ * @param rowId Row id.
+ * @param row Table row to update. Key only row means value removal.
+ * @param txId Transaction id.
+ * @param commitTableId Commit table id.
+ * @param commitPartitionId Commit partitionId.
+ * @throws TxIdMismatchException If there's another pending update associated with different transaction id.
+ * @throws StorageException If failed to write data.
+ */
+ void addWrite(RowId rowId, TableRow row, UUID txId, UUID commitTableId, int commitPartitionId);
+
+ /**
+ * Creates a committed version. In details: - if there is no uncommitted version, a new committed version is added - if there is an
+ * uncommitted version, this method may fail with a system exception (this method should not be called if there is already something
+ * uncommitted for the given row).
+ *
+ * @param rowId Row id.
+ * @param row Table row to update. Key only row means value removal.
+ * @param commitTimestamp Timestamp to associate with committed value.
+ * @throws StorageException If failed to write data.
+ */
+ void addWriteCommitted(RowId rowId, TableRow row, HybridTimestamp commitTimestamp);
+
+ /**
+ * Updates the last applied index, term, and RAFT configuration.
+ */
+ void updateLastApplied(long lastAppliedIndex, long lastAppliedTerm, RaftGroupConfiguration raftGroupConfig);
+
+ /**
+ * Returns the minimum applied index of the partition storages.
+ */
+ long minLastAppliedIndex();
+
+ /**
+ * Returns the minimum applied term of the partition storages.
+ */
+ long minLastAppliedTerm();
+
+ /**
+ * Returns the maximum applied index of the partition storages.
+ */
+ long maxLastAppliedIndex();
+
+ /**
+ * Returns the maximum applied term of the partition storages.
*/
- TxStateStorage reCreateTxStatePartitionStorage() throws StorageException;
+ long maxLastAppliedTerm();
}
diff --git a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/snapshot/PartitionAccessImpl.java b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/snapshot/PartitionAccessImpl.java
index e999e522b7..0d0dc0315b 100644
--- a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/snapshot/PartitionAccessImpl.java
+++ b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/snapshot/PartitionAccessImpl.java
@@ -17,12 +17,25 @@
package org.apache.ignite.internal.table.distributed.raft.snapshot;
+import static org.apache.ignite.internal.table.distributed.TableManager.FULL_RABALANCING_STARTED;
+
+import java.util.UUID;
import java.util.concurrent.CompletableFuture;
+import org.apache.ignite.internal.hlc.HybridTimestamp;
+import org.apache.ignite.internal.schema.TableRow;
import org.apache.ignite.internal.storage.MvPartitionStorage;
+import org.apache.ignite.internal.storage.RaftGroupConfiguration;
+import org.apache.ignite.internal.storage.ReadResult;
+import org.apache.ignite.internal.storage.RowId;
import org.apache.ignite.internal.storage.StorageException;
import org.apache.ignite.internal.storage.engine.MvTableStorage;
+import org.apache.ignite.internal.tx.TxMeta;
import org.apache.ignite.internal.tx.storage.state.TxStateStorage;
import org.apache.ignite.internal.tx.storage.state.TxStateTableStorage;
+import org.apache.ignite.internal.util.Cursor;
+import org.apache.ignite.lang.IgniteBiTuple;
+import org.apache.ignite.lang.IgniteStringFormatter;
+import org.jetbrains.annotations.Nullable;
/**
* {@link PartitionAccess} implementation.
@@ -57,48 +70,147 @@ public class PartitionAccessImpl implements PartitionAccess {
}
@Override
- public MvPartitionStorage mvPartitionStorage() {
- MvPartitionStorage mvPartition = mvTableStorage.getMvPartition(partId());
+ public CompletableFuture<Void> reCreateMvPartitionStorage() throws StorageException {
+ assert mvTableStorage.getMvPartition(partitionId()) != null : "table=" + tableName() + ", part=" + partitionId();
+
+ // TODO: IGNITE-18030 - actually recreate or do in a different way
+ //return mvTableStorage.destroyPartition(partId())
+ return CompletableFuture.completedFuture(null)
+ .thenApply(unused -> {
+ MvPartitionStorage mvPartitionStorage = mvTableStorage.getOrCreateMvPartition(partitionId());
+
+ mvPartitionStorage.runConsistently(() -> {
+ mvPartitionStorage.lastApplied(FULL_RABALANCING_STARTED, 0);
- assert mvPartition != null : "table=" + tableName() + ", part=" + partId();
+ return null;
+ });
- return mvPartition;
+ return null;
+ });
}
@Override
- public TxStateStorage txStatePartitionStorage() {
- TxStateStorage txStatePartitionStorage = txStateTableStorage.getTxStateStorage(partId());
+ public void reCreateTxStatePartitionStorage() throws StorageException {
+ assert txStateTableStorage.getTxStateStorage(partitionId()) != null : "table=" + tableName() + ", part=" + partitionId();
+
+ // TODO: IGNITE-18030 - actually recreate or do in a different way
+ //txStateTableStorage.destroyTxStateStorage(partId());
+
+ txStateTableStorage.getOrCreateTxStateStorage(partitionId()).lastApplied(FULL_RABALANCING_STARTED, 0);
+ }
- assert txStatePartitionStorage != null : "table=" + tableName() + ", part=" + partId();
+ private int partitionId() {
+ return partitionKey.partitionId();
+ }
- return txStatePartitionStorage;
+ private String tableName() {
+ return mvTableStorage.configuration().name().value();
}
@Override
- public CompletableFuture<MvPartitionStorage> reCreateMvPartitionStorage() throws StorageException {
- assert mvTableStorage.getMvPartition(partId()) != null : "table=" + tableName() + ", part=" + partId();
+ public Cursor<IgniteBiTuple<UUID, TxMeta>> getAllTxMeta() {
+ return getTxStateStorage(partitionId()).scan();
+ }
- // TODO: IGNITE-18030 - actually recreate or do in a different way
- //return mvTableStorage.destroyPartition(partId())
- return CompletableFuture.completedFuture(null)
- .thenApply(unused -> mvTableStorage.getOrCreateMvPartition(partId()));
+ @Override
+ public void addTxMeta(UUID txId, TxMeta txMeta) {
+ getTxStateStorage(partitionId()).put(txId, txMeta);
}
@Override
- public TxStateStorage reCreateTxStatePartitionStorage() throws StorageException {
- assert txStateTableStorage.getTxStateStorage(partId()) != null : "table=" + tableName() + ", part=" + partId();
+ public @Nullable RowId closestRowId(RowId lowerBound) {
+ return getMvPartitionStorage(partitionId()).closestRowId(lowerBound);
+ }
- // TODO: IGNITE-18030 - actually recreate or do in a different way
- //txStateTableStorage.destroyTxStateStorage(partId());
+ @Override
+ public Cursor<ReadResult> getAllRowVersions(RowId rowId) {
+ return getMvPartitionStorage(partitionId()).scanVersions(rowId);
+ }
- return txStateTableStorage.getOrCreateTxStateStorage(partId());
+ @Override
+ public @Nullable RaftGroupConfiguration committedGroupConfiguration() {
+ return getMvPartitionStorage(partitionId()).committedGroupConfiguration();
}
- private int partId() {
- return partitionKey.partitionId();
+ @Override
+ public void addWrite(RowId rowId, TableRow row, UUID txId, UUID commitTableId, int commitPartitionId) {
+ MvPartitionStorage mvPartitionStorage = getMvPartitionStorage(partitionId());
+
+ mvPartitionStorage.runConsistently(() -> mvPartitionStorage.addWrite(rowId, row, txId, commitTableId, commitPartitionId));
}
- private String tableName() {
- return mvTableStorage.configuration().name().value();
+ @Override
+ public void addWriteCommitted(RowId rowId, TableRow row, HybridTimestamp commitTimestamp) {
+ MvPartitionStorage mvPartitionStorage = getMvPartitionStorage(partitionId());
+
+ mvPartitionStorage.runConsistently(() -> {
+ mvPartitionStorage.addWriteCommitted(rowId, row, commitTimestamp);
+
+ return null;
+ });
+ }
+
+ @Override
+ public void updateLastApplied(long lastAppliedIndex, long lastAppliedTerm, RaftGroupConfiguration raftGroupConfig) {
+ MvPartitionStorage mvPartitionStorage = getMvPartitionStorage(partitionId());
+ TxStateStorage txStateStorage = getTxStateStorage(partitionId());
+
+ mvPartitionStorage.runConsistently(() -> {
+ mvPartitionStorage.lastApplied(lastAppliedIndex, lastAppliedTerm);
+
+ txStateStorage.lastApplied(lastAppliedIndex, lastAppliedTerm);
+
+ mvPartitionStorage.committedGroupConfiguration(raftGroupConfig);
+
+ return null;
+ });
+ }
+
+ @Override
+ public long minLastAppliedIndex() {
+ return Math.min(
+ getMvPartitionStorage(partitionId()).lastAppliedIndex(),
+ getTxStateStorage(partitionId()).lastAppliedIndex()
+ );
+ }
+
+ @Override
+ public long minLastAppliedTerm() {
+ return Math.min(
+ getMvPartitionStorage(partitionId()).lastAppliedTerm(),
+ getTxStateStorage(partitionId()).lastAppliedTerm()
+ );
+ }
+
+ @Override
+ public long maxLastAppliedIndex() {
+ return Math.max(
+ getMvPartitionStorage(partitionId()).lastAppliedIndex(),
+ getTxStateStorage(partitionId()).lastAppliedIndex()
+ );
+ }
+
+ @Override
+ public long maxLastAppliedTerm() {
+ return Math.max(
+ getMvPartitionStorage(partitionId()).lastAppliedTerm(),
+ getTxStateStorage(partitionId()).lastAppliedTerm()
+ );
+ }
+
+ private MvPartitionStorage getMvPartitionStorage(int partitionId) {
+ MvPartitionStorage mvPartitionStorage = mvTableStorage.getMvPartition(partitionId);
+
+ assert mvPartitionStorage != null : IgniteStringFormatter.format("table={}, partitionId={}", tableName(), partitionId);
+
+ return mvPartitionStorage;
+ }
+
+ private TxStateStorage getTxStateStorage(int partitionId) {
+ TxStateStorage txStateStorage = txStateTableStorage.getTxStateStorage(partitionId);
+
+ assert txStateStorage != null : IgniteStringFormatter.format("table={}, partitionId={}", tableName(), partitionId);
+
+ return txStateStorage;
}
}
diff --git a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/snapshot/PartitionSnapshotStorageFactory.java b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/snapshot/PartitionSnapshotStorageFactory.java
index 0c639da709..d8debe41d9 100644
--- a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/snapshot/PartitionSnapshotStorageFactory.java
+++ b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/snapshot/PartitionSnapshotStorageFactory.java
@@ -88,16 +88,10 @@ public class PartitionSnapshotStorageFactory implements SnapshotStorageFactory {
// We must choose the minimum applied index for local recovery so that we don't skip the raft commands for the storage with the
// lowest applied index and thus no data loss occurs.
- lastIncludedRaftIndex = Math.min(
- partition.mvPartitionStorage().lastAppliedIndex(),
- partition.txStatePartitionStorage().lastAppliedIndex()
- );
- lastIncludedRaftTerm = Math.min(
- partition.mvPartitionStorage().lastAppliedTerm(),
- partition.txStatePartitionStorage().lastAppliedTerm()
- );
+ lastIncludedRaftIndex = partition.minLastAppliedIndex();
+ lastIncludedRaftTerm = partition.minLastAppliedTerm();
- lastIncludedConfiguration = partition.mvPartitionStorage().committedGroupConfiguration();
+ lastIncludedConfiguration = partition.committedGroupConfiguration();
}
@Override
diff --git a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/snapshot/incoming/IncomingSnapshotCopier.java b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/snapshot/incoming/IncomingSnapshotCopier.java
index ca61306499..da5f4a9c13 100644
--- a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/snapshot/incoming/IncomingSnapshotCopier.java
+++ b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/snapshot/incoming/IncomingSnapshotCopier.java
@@ -18,7 +18,6 @@
package org.apache.ignite.internal.table.distributed.raft.snapshot.incoming;
import static java.util.concurrent.CompletableFuture.completedFuture;
-import static org.apache.ignite.internal.table.distributed.TableManager.FULL_RABALANCING_STARTED;
import java.util.UUID;
import java.util.concurrent.CancellationException;
@@ -35,6 +34,7 @@ import org.apache.ignite.internal.storage.ReadResult;
import org.apache.ignite.internal.storage.RowId;
import org.apache.ignite.internal.table.distributed.TableManager;
import org.apache.ignite.internal.table.distributed.TableMessagesFactory;
+import org.apache.ignite.internal.table.distributed.raft.snapshot.PartitionAccess;
import org.apache.ignite.internal.table.distributed.raft.snapshot.PartitionSnapshotStorage;
import org.apache.ignite.internal.table.distributed.raft.snapshot.SnapshotUri;
import org.apache.ignite.internal.table.distributed.raft.snapshot.message.SnapshotMetaRequest;
@@ -98,7 +98,7 @@ public class IncomingSnapshotCopier extends SnapshotCopier {
LOG.info("Copier is started for the partition [partId={}, tableId={}]", partId(), tableId());
- future = prepareMvPartitionStorageForRebalance(executor)
+ future = prepareMvPartitionStorageForRebalance()
.thenCompose(unused -> prepareTxStatePartitionStorageForRebalance(executor))
.thenCompose(unused -> {
ClusterNode snapshotSender = getSnapshotSender(snapshotUri.nodeName);
@@ -186,32 +186,14 @@ public class IncomingSnapshotCopier extends SnapshotCopier {
/**
* Prepares the {@link MvPartitionStorage} for a full rebalance.
- *
- * <p>Recreates {@link MvPartitionStorage} and sets the last applied index to {@link TableManager#FULL_RABALANCING_STARTED} so that
- * when the node is restarted, we can understand that the full rebalance has not completed, and we need to clean up the storage from
- * garbage.
*/
- private CompletableFuture<?> prepareMvPartitionStorageForRebalance(Executor executor) {
+ private CompletableFuture<?> prepareMvPartitionStorageForRebalance() {
if (canceled) {
return completedFuture(null);
}
- return partitionSnapshotStorage.partition().reCreateMvPartitionStorage()
- .thenComposeAsync(mvPartitionStorage -> {
- if (canceled) {
- return completedFuture(null);
- }
-
- mvPartitionStorage.runConsistently(() -> {
- mvPartitionStorage.lastApplied(FULL_RABALANCING_STARTED, 0);
-
- return null;
- });
-
- LOG.info("Copier prepared multi-versioned storage for the partition [partId={}, tableId={}]", partId(), tableId());
-
- return completedFuture(null);
- }, executor);
+ // TODO: IGNITE-18030 Delete it
+ return partitionSnapshotStorage.partition().reCreateMvPartitionStorage();
}
/**
@@ -226,18 +208,8 @@ public class IncomingSnapshotCopier extends SnapshotCopier {
return completedFuture(null);
}
- return CompletableFuture.supplyAsync(() -> partitionSnapshotStorage.partition().reCreateTxStatePartitionStorage(), executor)
- .thenCompose(txStatePartitionStorage -> {
- if (canceled) {
- return completedFuture(null);
- }
-
- txStatePartitionStorage.lastApplied(FULL_RABALANCING_STARTED, 0);
-
- LOG.info("Copier prepared transaction state storage for the partition [partId={}, tableId={}]", partId(), tableId());
-
- return completedFuture(null);
- });
+ // TODO: IGNITE-18030 Delete it
+ return CompletableFuture.runAsync(() -> partitionSnapshotStorage.partition().reCreateTxStatePartitionStorage(), executor);
}
private @Nullable ClusterNode getSnapshotSender(String nodeName) {
@@ -282,37 +254,33 @@ public class IncomingSnapshotCopier extends SnapshotCopier {
).thenComposeAsync(response -> {
SnapshotMvDataResponse snapshotMvDataResponse = ((SnapshotMvDataResponse) response);
- MvPartitionStorage mvPartition = partitionSnapshotStorage.partition().mvPartitionStorage();
-
for (ResponseEntry entry : snapshotMvDataResponse.rows()) {
if (canceled) {
return completedFuture(null);
}
// Let's write all versions for the row ID.
- mvPartition.runConsistently(() -> {
- RowId rowId = new RowId(partId(), entry.rowId());
+ RowId rowId = new RowId(partId(), entry.rowId());
- for (int i = 0; i < entry.rowVersions().size(); i++) {
- HybridTimestamp timestamp = i < entry.timestamps().size() ? entry.timestamps().get(i) : null;
+ for (int i = 0; i < entry.rowVersions().size(); i++) {
+ HybridTimestamp timestamp = i < entry.timestamps().size() ? entry.timestamps().get(i) : null;
- TableRow tableRow = new TableRow(entry.rowVersions().get(i).rewind());
+ TableRow tableRow = new TableRow(entry.rowVersions().get(i).rewind());
- if (timestamp == null) {
- // Writes an intent to write (uncommitted version).
- assert entry.txId() != null;
- assert entry.commitTableId() != null;
- assert entry.commitPartitionId() != ReadResult.UNDEFINED_COMMIT_PARTITION_ID;
+ PartitionAccess partition = partitionSnapshotStorage.partition();
- mvPartition.addWrite(rowId, tableRow, entry.txId(), entry.commitTableId(), entry.commitPartitionId());
- } else {
- // Writes committed version.
- mvPartition.addWriteCommitted(rowId, tableRow, timestamp);
- }
- }
+ if (timestamp == null) {
+ // Writes an intent to write (uncommitted version).
+ assert entry.txId() != null;
+ assert entry.commitTableId() != null;
+ assert entry.commitPartitionId() != ReadResult.UNDEFINED_COMMIT_PARTITION_ID;
- return null;
- });
+ partition.addWrite(rowId, tableRow, entry.txId(), entry.commitTableId(), entry.commitPartitionId());
+ } else {
+ // Writes committed version.
+ partition.addWriteCommitted(rowId, tableRow, timestamp);
+ }
+ }
}
if (snapshotMvDataResponse.finish()) {
@@ -354,8 +322,6 @@ public class IncomingSnapshotCopier extends SnapshotCopier {
).thenComposeAsync(response -> {
SnapshotTxDataResponse snapshotTxDataResponse = (SnapshotTxDataResponse) response;
- TxStateStorage txStatePartitionStorage = partitionSnapshotStorage.partition().txStatePartitionStorage();
-
assert snapshotTxDataResponse.txMeta().size() == snapshotTxDataResponse.txIds().size();
for (int i = 0; i < snapshotTxDataResponse.txMeta().size(); i++) {
@@ -363,7 +329,10 @@ public class IncomingSnapshotCopier extends SnapshotCopier {
return completedFuture(null);
}
- txStatePartitionStorage.put(snapshotTxDataResponse.txIds().get(i), snapshotTxDataResponse.txMeta().get(i));
+ partitionSnapshotStorage.partition().addTxMeta(
+ snapshotTxDataResponse.txIds().get(i),
+ snapshotTxDataResponse.txMeta().get(i)
+ );
}
if (snapshotTxDataResponse.finish()) {
@@ -395,26 +364,18 @@ public class IncomingSnapshotCopier extends SnapshotCopier {
return;
}
- TxStateStorage txStatePartitionStorage = partitionSnapshotStorage.partition().txStatePartitionStorage();
- MvPartitionStorage mvPartitionStorage = partitionSnapshotStorage.partition().mvPartitionStorage();
-
SnapshotMeta meta = snapshotMeta;
assert meta != null;
- mvPartitionStorage.runConsistently(() -> {
- txStatePartitionStorage.lastApplied(meta.lastIncludedIndex(), meta.lastIncludedTerm());
- mvPartitionStorage.lastApplied(meta.lastIncludedIndex(), meta.lastIncludedTerm());
-
- mvPartitionStorage.committedGroupConfiguration(new RaftGroupConfiguration(
- meta.peersList(),
- meta.learnersList(),
- meta.oldPeersList(),
- meta.oldLearnersList()
- ));
+ RaftGroupConfiguration raftGroupConfig = new RaftGroupConfiguration(
+ meta.peersList(),
+ meta.learnersList(),
+ meta.oldPeersList(),
+ meta.oldLearnersList()
+ );
- return null;
- });
+ partitionSnapshotStorage.partition().updateLastApplied(meta.lastIncludedIndex(), meta.lastIncludedTerm(), raftGroupConfig);
LOG.info(
"Copier has finished updating last applied index for the partition [partId={}, lastAppliedIndex={}, lastAppliedTerm={}]",
diff --git a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/snapshot/outgoing/OutgoingSnapshot.java b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/snapshot/outgoing/OutgoingSnapshot.java
index c79d08edf0..8966819034 100644
--- a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/snapshot/outgoing/OutgoingSnapshot.java
+++ b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/snapshot/outgoing/OutgoingSnapshot.java
@@ -148,23 +148,17 @@ public class OutgoingSnapshot {
try {
frozenMeta = takeSnapshotMeta();
- txDataCursor = partition.txStatePartitionStorage().scan();
+ txDataCursor = partition.getAllTxMeta();
} finally {
releaseMvLock();
}
}
private SnapshotMeta takeSnapshotMeta() {
- long lastAppliedIndex = Math.max(
- partition.mvPartitionStorage().lastAppliedIndex(),
- partition.txStatePartitionStorage().lastAppliedIndex()
- );
- long lastAppliedTerm = Math.max(
- partition.mvPartitionStorage().lastAppliedTerm(),
- partition.txStatePartitionStorage().lastAppliedTerm()
- );
+ long lastAppliedIndex = partition.maxLastAppliedIndex();
+ long lastAppliedTerm = partition.maxLastAppliedTerm();
- RaftGroupConfiguration config = partition.mvPartitionStorage().committedGroupConfiguration();
+ RaftGroupConfiguration config = partition.committedGroupConfiguration();
assert config != null : "Configuration should never be null when installing a snapshot";
@@ -292,11 +286,11 @@ public class OutgoingSnapshot {
}
if (!startedToReadMvPartition) {
- lastRowId = partition.mvPartitionStorage().closestRowId(lastRowId);
+ lastRowId = partition.closestRowId(lastRowId);
startedToReadMvPartition = true;
} else {
- lastRowId = partition.mvPartitionStorage().closestRowId(lastRowId.increment());
+ lastRowId = partition.closestRowId(lastRowId.increment());
}
if (!finishedMvData()) {
@@ -358,7 +352,7 @@ public class OutgoingSnapshot {
}
private List<ReadResult> readRowVersionsN2O(RowId rowId) {
- try (Cursor<ReadResult> versions = partition.mvPartitionStorage().scanVersions(rowId)) {
+ try (Cursor<ReadResult> versions = partition.getAllRowVersions(rowId)) {
return versions.stream().collect(toList());
}
}
diff --git a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/snapshot/PartitionAccessImplTest.java b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/snapshot/PartitionAccessImplTest.java
new file mode 100644
index 0000000000..7991fcc7a4
--- /dev/null
+++ b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/snapshot/PartitionAccessImplTest.java
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.table.distributed.raft.snapshot;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.util.UUID;
+import org.apache.ignite.internal.configuration.testframework.ConfigurationExtension;
+import org.apache.ignite.internal.configuration.testframework.InjectConfiguration;
+import org.apache.ignite.internal.schema.configuration.TableConfiguration;
+import org.apache.ignite.internal.schema.configuration.TablesConfiguration;
+import org.apache.ignite.internal.storage.MvPartitionStorage;
+import org.apache.ignite.internal.storage.impl.TestMvTableStorage;
+import org.apache.ignite.internal.tx.storage.state.TxStateStorage;
+import org.apache.ignite.internal.tx.storage.state.test.TestTxStateTableStorage;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+
+/**
+ * For {@link PartitionAccessImpl} testing.
+ */
+@ExtendWith(ConfigurationExtension.class)
+public class PartitionAccessImplTest {
+ private static final int TEST_PARTITION_ID = 0;
+
+ @Test
+ void testMinMaxLastAppliedIndex(@InjectConfiguration("mock.tables.foo {}") TablesConfiguration tablesConfig) {
+ TableConfiguration tableCfg = tablesConfig.tables().get("foo");
+
+ TestMvTableStorage mvTableStorage = new TestMvTableStorage(tableCfg, tablesConfig);
+ TestTxStateTableStorage txStateTableStorage = new TestTxStateTableStorage();
+
+ MvPartitionStorage mvPartitionStorage = mvTableStorage.getOrCreateMvPartition(TEST_PARTITION_ID);
+ TxStateStorage txStateStorage = txStateTableStorage.getOrCreateTxStateStorage(TEST_PARTITION_ID);
+
+ PartitionAccess partitionAccess = new PartitionAccessImpl(
+ new PartitionKey(UUID.randomUUID(), TEST_PARTITION_ID),
+ mvTableStorage,
+ txStateTableStorage
+ );
+
+ assertEquals(0, partitionAccess.minLastAppliedIndex());
+ assertEquals(0, partitionAccess.maxLastAppliedIndex());
+
+ mvPartitionStorage.runConsistently(() -> {
+ mvPartitionStorage.lastApplied(10, 1);
+ txStateStorage.lastApplied(5, 1);
+
+ return null;
+ });
+
+ assertEquals(5, partitionAccess.minLastAppliedIndex());
+ assertEquals(10, partitionAccess.maxLastAppliedIndex());
+
+ mvPartitionStorage.runConsistently(() -> {
+ mvPartitionStorage.lastApplied(15, 2);
+
+ txStateStorage.lastApplied(20, 2);
+
+ return null;
+ });
+
+ assertEquals(15, partitionAccess.minLastAppliedIndex());
+ assertEquals(20, partitionAccess.maxLastAppliedIndex());
+ }
+
+ @Test
+ void testMinMaxLastAppliedTerm(@InjectConfiguration("mock.tables.foo {}") TablesConfiguration tablesConfig) {
+ TableConfiguration tableCfg = tablesConfig.tables().get("foo");
+
+ TestMvTableStorage mvTableStorage = new TestMvTableStorage(tableCfg, tablesConfig);
+ TestTxStateTableStorage txStateTableStorage = new TestTxStateTableStorage();
+
+ MvPartitionStorage mvPartitionStorage = mvTableStorage.getOrCreateMvPartition(TEST_PARTITION_ID);
+ TxStateStorage txStateStorage = txStateTableStorage.getOrCreateTxStateStorage(TEST_PARTITION_ID);
+
+ PartitionAccess partitionAccess = new PartitionAccessImpl(
+ new PartitionKey(UUID.randomUUID(), TEST_PARTITION_ID),
+ mvTableStorage,
+ txStateTableStorage
+ );
+
+ assertEquals(0, partitionAccess.minLastAppliedTerm());
+ assertEquals(0, partitionAccess.maxLastAppliedTerm());
+
+ mvPartitionStorage.runConsistently(() -> {
+ mvPartitionStorage.lastApplied(1, 10);
+ txStateStorage.lastApplied(1, 5);
+
+ return null;
+ });
+
+ assertEquals(5, partitionAccess.minLastAppliedTerm());
+ assertEquals(10, partitionAccess.maxLastAppliedTerm());
+
+ mvPartitionStorage.runConsistently(() -> {
+ mvPartitionStorage.lastApplied(2, 15);
+
+ txStateStorage.lastApplied(2, 20);
+
+ return null;
+ });
+
+ assertEquals(15, partitionAccess.minLastAppliedTerm());
+ assertEquals(20, partitionAccess.maxLastAppliedTerm());
+ }
+}
diff --git a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/snapshot/PartitionSnapshotStorageFactoryTest.java b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/snapshot/PartitionSnapshotStorageFactoryTest.java
index 16367902e4..43b22b73a9 100644
--- a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/snapshot/PartitionSnapshotStorageFactoryTest.java
+++ b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/snapshot/PartitionSnapshotStorageFactoryTest.java
@@ -25,15 +25,10 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.concurrent.Executor;
-import org.apache.ignite.internal.storage.MvPartitionStorage;
import org.apache.ignite.internal.storage.RaftGroupConfiguration;
-import org.apache.ignite.internal.storage.impl.TestMvPartitionStorage;
import org.apache.ignite.internal.table.distributed.raft.snapshot.outgoing.OutgoingSnapshotsManager;
-import org.apache.ignite.internal.tx.storage.state.TxStateStorage;
-import org.apache.ignite.internal.tx.storage.state.test.TestTxStateStorage;
import org.apache.ignite.network.TopologyService;
import org.apache.ignite.raft.jraft.option.RaftOptions;
-import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
@@ -44,24 +39,16 @@ import org.mockito.junit.jupiter.MockitoExtension;
*/
@ExtendWith(MockitoExtension.class)
public class PartitionSnapshotStorageFactoryTest {
- private final MvPartitionStorage mvPartitionStorage = new TestMvPartitionStorage(0);
- private final TxStateStorage txStateStorage = new TestTxStateStorage();
-
@Mock
private PartitionAccess partitionAccess;
- @BeforeEach
- void configureMocks() {
- when(partitionAccess.mvPartitionStorage()).thenReturn(mvPartitionStorage);
- when(partitionAccess.txStatePartitionStorage()).thenReturn(txStateStorage);
- }
-
@Test
void testForChoosingMinimumAppliedIndexForMeta() {
- mvPartitionStorage.lastApplied(10L, 2L);
- txStateStorage.lastApplied(5L, 1L);
+ when(partitionAccess.minLastAppliedIndex()).thenReturn(5L);
+
+ when(partitionAccess.minLastAppliedTerm()).thenReturn(1L);
- mvPartitionStorage.committedGroupConfiguration(mock(RaftGroupConfiguration.class));
+ when(partitionAccess.committedGroupConfiguration()).thenReturn(mock(RaftGroupConfiguration.class));
PartitionSnapshotStorageFactory partitionSnapshotStorageFactory = new PartitionSnapshotStorageFactory(
mock(TopologyService.class),
@@ -74,21 +61,6 @@ public class PartitionSnapshotStorageFactoryTest {
assertEquals(5L, snapshotStorage.startupSnapshotMeta().lastIncludedIndex());
assertEquals(1L, snapshotStorage.startupSnapshotMeta().lastIncludedTerm());
-
- mvPartitionStorage.lastApplied(1L, 1L);
- txStateStorage.lastApplied(2L, 2L);
-
- partitionSnapshotStorageFactory = new PartitionSnapshotStorageFactory(
- mock(TopologyService.class),
- mock(OutgoingSnapshotsManager.class),
- partitionAccess,
- mock(Executor.class)
- );
-
- snapshotStorage = partitionSnapshotStorageFactory.createSnapshotStorage("", mock(RaftOptions.class));
-
- assertEquals(1L, snapshotStorage.startupSnapshotMeta().lastIncludedIndex());
- assertEquals(1L, snapshotStorage.startupSnapshotMeta().lastIncludedTerm());
}
@Test
diff --git a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/snapshot/outgoing/OutgoingSnapshotCommonTest.java b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/snapshot/outgoing/OutgoingSnapshotCommonTest.java
index 4d1bd981b2..e477dc65e5 100644
--- a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/snapshot/outgoing/OutgoingSnapshotCommonTest.java
+++ b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/snapshot/outgoing/OutgoingSnapshotCommonTest.java
@@ -21,20 +21,16 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
-import static org.mockito.Mockito.lenient;
-import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.List;
import java.util.UUID;
-import org.apache.ignite.internal.storage.MvPartitionStorage;
import org.apache.ignite.internal.storage.RaftGroupConfiguration;
import org.apache.ignite.internal.table.distributed.TableMessagesFactory;
import org.apache.ignite.internal.table.distributed.raft.snapshot.PartitionAccess;
import org.apache.ignite.internal.table.distributed.raft.snapshot.PartitionKey;
import org.apache.ignite.internal.table.distributed.raft.snapshot.message.SnapshotMetaRequest;
import org.apache.ignite.internal.table.distributed.raft.snapshot.message.SnapshotMetaResponse;
-import org.apache.ignite.internal.tx.storage.state.TxStateStorage;
import org.jetbrains.annotations.Nullable;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -47,12 +43,6 @@ class OutgoingSnapshotCommonTest {
@Mock
private PartitionAccess partitionAccess;
- @Mock
- private MvPartitionStorage mvPartitionStorage;
-
- @Mock
- private TxStateStorage txStateStorage;
-
private OutgoingSnapshot snapshot;
private final TableMessagesFactory messagesFactory = new TableMessagesFactory();
@@ -63,9 +53,6 @@ class OutgoingSnapshotCommonTest {
void createTestInstance() {
when(partitionAccess.partitionKey()).thenReturn(partitionKey);
- lenient().when(partitionAccess.mvPartitionStorage()).thenReturn(mvPartitionStorage);
- lenient().when(partitionAccess.txStatePartitionStorage()).thenReturn(txStateStorage);
-
snapshot = new OutgoingSnapshot(UUID.randomUUID(), partitionAccess);
}
@@ -76,12 +63,11 @@ class OutgoingSnapshotCommonTest {
@Test
void sendsSnapshotMeta() {
- when(mvPartitionStorage.lastAppliedIndex()).thenReturn(100L);
- lenient().when(mvPartitionStorage.lastAppliedTerm()).thenReturn(3L);
- when(txStateStorage.lastAppliedIndex()).thenReturn(100L);
- lenient().when(txStateStorage.lastAppliedTerm()).thenReturn(3L);
+ when(partitionAccess.maxLastAppliedIndex()).thenReturn(100L);
+
+ when(partitionAccess.maxLastAppliedTerm()).thenReturn(3L);
- when(mvPartitionStorage.committedGroupConfiguration()).thenReturn(new RaftGroupConfiguration(
+ when(partitionAccess.committedGroupConfiguration()).thenReturn(new RaftGroupConfiguration(
List.of("peer1:3000", "peer2:3000"),
List.of("learner1:3000", "learner2:3000"),
List.of("peer1:3000"),
@@ -119,7 +105,7 @@ class OutgoingSnapshotCommonTest {
@Test
void doesNotSendOldConfigWhenItIsNotThere() {
- when(mvPartitionStorage.committedGroupConfiguration()).thenReturn(new RaftGroupConfiguration(
+ when(partitionAccess.committedGroupConfiguration()).thenReturn(new RaftGroupConfiguration(
List.of(), List.of(), null, null
));
@@ -131,34 +117,6 @@ class OutgoingSnapshotCommonTest {
assertThat(response.meta().oldLearnersList(), is(nullValue()));
}
- @Test
- void sendsMvIndexIfItIsAhead() {
- when(mvPartitionStorage.lastAppliedIndex()).thenReturn(100L);
- when(txStateStorage.lastAppliedIndex()).thenReturn(90L);
-
- when(mvPartitionStorage.committedGroupConfiguration()).thenReturn(mock(RaftGroupConfiguration.class));
-
- snapshot.freezeScopeUnderMvLock();
-
- SnapshotMetaResponse response = getSnapshotMetaResponse();
-
- assertThat(response.meta().lastIncludedIndex(), is(100L));
- }
-
- @Test
- void sendsTxIndexIfItIsAhead() {
- when(mvPartitionStorage.lastAppliedIndex()).thenReturn(90L);
- when(txStateStorage.lastAppliedIndex()).thenReturn(100L);
-
- when(mvPartitionStorage.committedGroupConfiguration()).thenReturn(mock(RaftGroupConfiguration.class));
-
- snapshot.freezeScopeUnderMvLock();
-
- SnapshotMetaResponse response = getSnapshotMetaResponse();
-
- assertThat(response.meta().lastIncludedIndex(), is(100L));
- }
-
@Test
void returnsNullMetaResponseWhenClosed() {
snapshot.close();
diff --git a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/snapshot/outgoing/OutgoingSnapshotMvDataStreamingTest.java b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/snapshot/outgoing/OutgoingSnapshotMvDataStreamingTest.java
index 3305a1dd12..562d081e27 100644
--- a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/snapshot/outgoing/OutgoingSnapshotMvDataStreamingTest.java
+++ b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/snapshot/outgoing/OutgoingSnapshotMvDataStreamingTest.java
@@ -37,7 +37,6 @@ import java.util.UUID;
import org.apache.ignite.internal.hlc.HybridClock;
import org.apache.ignite.internal.hlc.HybridClockImpl;
import org.apache.ignite.internal.schema.TableRow;
-import org.apache.ignite.internal.storage.MvPartitionStorage;
import org.apache.ignite.internal.storage.ReadResult;
import org.apache.ignite.internal.storage.RowId;
import org.apache.ignite.internal.table.distributed.TableMessagesFactory;
@@ -59,9 +58,6 @@ class OutgoingSnapshotMvDataStreamingTest {
@Mock
private PartitionAccess partitionAccess;
- @Mock
- private MvPartitionStorage mvPartitionStorage;
-
private OutgoingSnapshot snapshot;
private final TableMessagesFactory messagesFactory = new TableMessagesFactory();
@@ -84,8 +80,6 @@ class OutgoingSnapshotMvDataStreamingTest {
void createTestInstance() {
when(partitionAccess.partitionKey()).thenReturn(partitionKey);
- lenient().when(partitionAccess.mvPartitionStorage()).thenReturn(mvPartitionStorage);
-
snapshot = new OutgoingSnapshot(UUID.randomUUID(), partitionAccess);
}
@@ -112,7 +106,7 @@ class OutgoingSnapshotMvDataStreamingTest {
clock.now()
);
- configureStorageToHaveExactlyOneRowWith(List.of(version1, version2));
+ configurePartitionAccessToHaveExactlyOneRowWith(List.of(version1, version2));
SnapshotMvDataResponse response = getMvDataResponse(Long.MAX_VALUE);
@@ -131,10 +125,10 @@ class OutgoingSnapshotMvDataStreamingTest {
assertThat(responseRow.rowVersions().get(1).array(), is(new byte[]{1}));
}
- private void configureStorageToHaveExactlyOneRowWith(List<ReadResult> versions) {
- when(mvPartitionStorage.closestRowId(lowestRowId)).thenReturn(rowId1);
- when(mvPartitionStorage.scanVersions(rowId1)).thenReturn(Cursor.fromIterable(versions));
- lenient().when(mvPartitionStorage.closestRowId(rowId2)).thenReturn(null);
+ private void configurePartitionAccessToHaveExactlyOneRowWith(List<ReadResult> versions) {
+ when(partitionAccess.closestRowId(lowestRowId)).thenReturn(rowId1);
+ when(partitionAccess.getAllRowVersions(rowId1)).thenReturn(Cursor.fromIterable(versions));
+ lenient().when(partitionAccess.closestRowId(rowId2)).thenReturn(null);
}
private SnapshotMvDataResponse getMvDataResponse(long batchSizeHint) {
@@ -159,7 +153,7 @@ class OutgoingSnapshotMvDataStreamingTest {
ReadResult version1 = ReadResult.createFromCommitted(rowId1, new TableRow(new byte[]{1}), clock.now());
ReadResult version2 = ReadResult.createFromCommitted(rowId1, new TableRow(new byte[]{2}), clock.now());
- configureStorageToHaveExactlyOneRowWith(List.of(version1, version2));
+ configurePartitionAccessToHaveExactlyOneRowWith(List.of(version1, version2));
SnapshotMvDataResponse response = getMvDataResponse(Long.MAX_VALUE);
@@ -178,11 +172,11 @@ class OutgoingSnapshotMvDataStreamingTest {
ReadResult version1 = ReadResult.createFromCommitted(rowId1, new TableRow(new byte[]{1}), clock.now());
ReadResult version2 = ReadResult.createFromCommitted(rowId2, new TableRow(new byte[]{2}), clock.now());
- when(mvPartitionStorage.closestRowId(lowestRowId)).thenReturn(rowId1);
- when(mvPartitionStorage.scanVersions(rowId1)).thenReturn(Cursor.fromIterable(List.of(version1)));
- when(mvPartitionStorage.closestRowId(rowId2)).thenReturn(rowId2);
- when(mvPartitionStorage.scanVersions(rowId2)).thenReturn(Cursor.fromIterable(List.of(version2)));
- when(mvPartitionStorage.closestRowId(rowId3)).thenReturn(null);
+ when(partitionAccess.closestRowId(lowestRowId)).thenReturn(rowId1);
+ when(partitionAccess.getAllRowVersions(rowId1)).thenReturn(Cursor.fromIterable(List.of(version1)));
+ when(partitionAccess.closestRowId(rowId2)).thenReturn(rowId2);
+ when(partitionAccess.getAllRowVersions(rowId2)).thenReturn(Cursor.fromIterable(List.of(version2)));
+ when(partitionAccess.closestRowId(rowId3)).thenReturn(null);
SnapshotMvDataResponse response = getMvDataResponse(Long.MAX_VALUE);
@@ -204,8 +198,8 @@ class OutgoingSnapshotMvDataStreamingTest {
snapshot.releaseMvLock();
}
- when(mvPartitionStorage.closestRowId(lowestRowId)).thenReturn(rowId1);
- when(mvPartitionStorage.closestRowId(rowId2)).thenReturn(null);
+ when(partitionAccess.closestRowId(lowestRowId)).thenReturn(rowId1);
+ when(partitionAccess.closestRowId(rowId2)).thenReturn(null);
SnapshotMvDataResponse response = getMvDataResponse(Long.MAX_VALUE);
@@ -224,7 +218,7 @@ class OutgoingSnapshotMvDataStreamingTest {
clock.now()
);
- when(mvPartitionStorage.scanVersions(rowIdOutOfOrder)).thenReturn(Cursor.fromIterable(List.of(version2, version1)));
+ when(partitionAccess.getAllRowVersions(rowIdOutOfOrder)).thenReturn(Cursor.fromIterable(List.of(version2, version1)));
snapshot.acquireMvLock();
@@ -234,7 +228,7 @@ class OutgoingSnapshotMvDataStreamingTest {
snapshot.releaseMvLock();
}
- configureStorageToBeEmpty();
+ configureClosestRowIdToBeEmpty();
SnapshotMvDataResponse response = getMvDataResponse(Long.MAX_VALUE);
@@ -253,8 +247,8 @@ class OutgoingSnapshotMvDataStreamingTest {
assertThat(responseRow.rowVersions().get(1).array(), is(new byte[]{2}));
}
- private void configureStorageToBeEmpty() {
- lenient().when(mvPartitionStorage.closestRowId(lowestRowId)).thenReturn(null);
+ private void configureClosestRowIdToBeEmpty() {
+ lenient().when(partitionAccess.closestRowId(lowestRowId)).thenReturn(null);
}
@Test
@@ -262,7 +256,7 @@ class OutgoingSnapshotMvDataStreamingTest {
ReadResult version1 = ReadResult.createFromCommitted(rowIdOutOfOrder, new TableRow(new byte[]{1}), clock.now());
ReadResult version2 = ReadResult.createFromCommitted(rowId1, new TableRow(new byte[]{2}), clock.now());
- when(mvPartitionStorage.scanVersions(rowIdOutOfOrder)).thenReturn(Cursor.fromIterable(List.of(version1)));
+ when(partitionAccess.getAllRowVersions(rowIdOutOfOrder)).thenReturn(Cursor.fromIterable(List.of(version1)));
snapshot.acquireMvLock();
@@ -272,7 +266,7 @@ class OutgoingSnapshotMvDataStreamingTest {
snapshot.releaseMvLock();
}
- configureStorageToHaveExactlyOneRowWith(List.of(version2));
+ configurePartitionAccessToHaveExactlyOneRowWith(List.of(version2));
SnapshotMvDataResponse response = getMvDataResponse(Long.MAX_VALUE);
@@ -284,7 +278,7 @@ class OutgoingSnapshotMvDataStreamingTest {
@Test
void doesNotEnqueueMissingRows() {
- when(mvPartitionStorage.scanVersions(rowIdOutOfOrder)).thenReturn(CursorUtils.emptyCursor());
+ when(partitionAccess.getAllRowVersions(rowIdOutOfOrder)).thenReturn(CursorUtils.emptyCursor());
snapshot.acquireMvLock();
@@ -304,7 +298,7 @@ class OutgoingSnapshotMvDataStreamingTest {
@SuppressWarnings("unchecked")
Cursor<ReadResult> cursor = mock(Cursor.class);
- when(mvPartitionStorage.scanVersions(rowIdOutOfOrder)).thenReturn(cursor);
+ when(partitionAccess.getAllRowVersions(rowIdOutOfOrder)).thenReturn(cursor);
snapshot.acquireMvLock();
@@ -323,7 +317,7 @@ class OutgoingSnapshotMvDataStreamingTest {
void sendsTombstonesWithNullBuffers() {
ReadResult version = ReadResult.createFromCommitted(rowId1, null, clock.now());
- configureStorageToHaveExactlyOneRowWith(List.of(version));
+ configurePartitionAccessToHaveExactlyOneRowWith(List.of(version));
SnapshotMvDataResponse response = getMvDataResponse(Long.MAX_VALUE);
@@ -341,7 +335,7 @@ class OutgoingSnapshotMvDataStreamingTest {
clock.now()
);
- configureStorageToHaveExactlyOneRowWith(List.of(version));
+ configurePartitionAccessToHaveExactlyOneRowWith(List.of(version));
SnapshotMvDataResponse response = getMvDataResponse(Long.MAX_VALUE);
@@ -350,7 +344,7 @@ class OutgoingSnapshotMvDataStreamingTest {
@Test
void finalMvDataChunkHasFinishTrue() {
- configureStorageToBeEmpty();
+ configureClosestRowIdToBeEmpty();
SnapshotMvDataResponse response = getMvDataResponse(Long.MAX_VALUE);
@@ -362,10 +356,10 @@ class OutgoingSnapshotMvDataStreamingTest {
ReadResult version1 = ReadResult.createFromCommitted(rowId1, new TableRow(new byte[]{1}), clock.now());
ReadResult version2 = ReadResult.createFromCommitted(rowId2, new TableRow(new byte[]{2}), clock.now());
- when(mvPartitionStorage.closestRowId(lowestRowId)).thenReturn(rowId1);
- when(mvPartitionStorage.scanVersions(rowId1)).thenReturn(Cursor.fromIterable(List.of(version1)));
- lenient().when(mvPartitionStorage.closestRowId(rowId1)).thenReturn(rowId1);
- lenient().when(mvPartitionStorage.scanVersions(rowId2)).thenReturn(Cursor.fromIterable(List.of(version2)));
+ when(partitionAccess.closestRowId(lowestRowId)).thenReturn(rowId1);
+ when(partitionAccess.getAllRowVersions(rowId1)).thenReturn(Cursor.fromIterable(List.of(version1)));
+ lenient().when(partitionAccess.closestRowId(rowId1)).thenReturn(rowId1);
+ lenient().when(partitionAccess.getAllRowVersions(rowId2)).thenReturn(Cursor.fromIterable(List.of(version2)));
SnapshotMvDataResponse response = getMvDataResponse(1);
@@ -377,7 +371,7 @@ class OutgoingSnapshotMvDataStreamingTest {
ReadResult version1 = ReadResult.createFromCommitted(rowIdOutOfOrder, new TableRow(new byte[]{1}), clock.now());
ReadResult version2 = ReadResult.createFromCommitted(rowId1, new TableRow(new byte[]{2}), clock.now());
- when(mvPartitionStorage.scanVersions(rowIdOutOfOrder)).thenReturn(Cursor.fromIterable(List.of(version1)));
+ when(partitionAccess.getAllRowVersions(rowIdOutOfOrder)).thenReturn(Cursor.fromIterable(List.of(version1)));
snapshot.acquireMvLock();
@@ -387,9 +381,9 @@ class OutgoingSnapshotMvDataStreamingTest {
snapshot.releaseMvLock();
}
- lenient().when(mvPartitionStorage.closestRowId(lowestRowId)).thenReturn(rowId1);
- lenient().when(mvPartitionStorage.scanVersions(rowId1)).thenReturn(Cursor.fromIterable(List.of(version2)));
- lenient().when(mvPartitionStorage.closestRowId(rowId2)).thenReturn(null);
+ lenient().when(partitionAccess.closestRowId(lowestRowId)).thenReturn(rowId1);
+ lenient().when(partitionAccess.getAllRowVersions(rowId1)).thenReturn(Cursor.fromIterable(List.of(version2)));
+ lenient().when(partitionAccess.closestRowId(rowId2)).thenReturn(null);
SnapshotMvDataResponse response = getMvDataResponse(1);
@@ -401,9 +395,9 @@ class OutgoingSnapshotMvDataStreamingTest {
ReadResult version1 = ReadResult.createFromCommitted(rowId1, new TableRow(new byte[]{1}), clock.now());
ReadResult version2 = ReadResult.createFromCommitted(rowId1, new TableRow(new byte[]{2}), clock.now());
- when(mvPartitionStorage.closestRowId(lowestRowId)).thenReturn(rowId1);
- when(mvPartitionStorage.scanVersions(rowId1)).thenReturn(Cursor.fromIterable(List.of(version1, version2)));
- lenient().when(mvPartitionStorage.closestRowId(rowId2)).thenReturn(rowId2);
+ when(partitionAccess.closestRowId(lowestRowId)).thenReturn(rowId1);
+ when(partitionAccess.getAllRowVersions(rowId1)).thenReturn(Cursor.fromIterable(List.of(version1, version2)));
+ lenient().when(partitionAccess.closestRowId(rowId2)).thenReturn(rowId2);
SnapshotMvDataResponse response = getMvDataResponse(1);
@@ -414,7 +408,7 @@ class OutgoingSnapshotMvDataStreamingTest {
void sendsRowsFromPartitionBiggerThanHint() {
ReadResult version = ReadResult.createFromCommitted(rowId1, new TableRow(new byte[1000]), clock.now());
- configureStorageToHaveExactlyOneRowWith(List.of(version));
+ configurePartitionAccessToHaveExactlyOneRowWith(List.of(version));
SnapshotMvDataResponse response = getMvDataResponse(1);
@@ -427,7 +421,7 @@ class OutgoingSnapshotMvDataStreamingTest {
void sendsRowsFromOutOfOrderQueueBiggerThanHint() {
ReadResult version = ReadResult.createFromCommitted(rowIdOutOfOrder, new TableRow(new byte[1000]), clock.now());
- when(mvPartitionStorage.scanVersions(rowIdOutOfOrder)).thenReturn(Cursor.fromIterable(List.of(version)));
+ when(partitionAccess.getAllRowVersions(rowIdOutOfOrder)).thenReturn(Cursor.fromIterable(List.of(version)));
snapshot.acquireMvLock();
@@ -437,7 +431,7 @@ class OutgoingSnapshotMvDataStreamingTest {
snapshot.releaseMvLock();
}
- configureStorageToBeEmpty();
+ configureClosestRowIdToBeEmpty();
SnapshotMvDataResponse response = getMvDataResponse(1);
@@ -462,9 +456,9 @@ class OutgoingSnapshotMvDataStreamingTest {
ReadResult version1 = ReadResult.createFromCommitted(rowId1, new TableRow(new byte[]{1}), clock.now());
ReadResult version2 = ReadResult.createFromCommitted(rowId1, new TableRow(new byte[]{2}), clock.now());
- when(mvPartitionStorage.closestRowId(lowestRowId)).thenReturn(rowId1);
- when(mvPartitionStorage.scanVersions(rowId1)).thenReturn(Cursor.fromIterable(List.of(version1, version2)));
- lenient().when(mvPartitionStorage.closestRowId(rowId2)).thenReturn(rowId2);
+ when(partitionAccess.closestRowId(lowestRowId)).thenReturn(rowId1);
+ when(partitionAccess.getAllRowVersions(rowId1)).thenReturn(Cursor.fromIterable(List.of(version1, version2)));
+ lenient().when(partitionAccess.closestRowId(rowId2)).thenReturn(rowId2);
getMvDataResponse(1);
@@ -482,9 +476,9 @@ class OutgoingSnapshotMvDataStreamingTest {
ReadResult version1 = ReadResult.createFromCommitted(rowId1, new TableRow(new byte[]{1}), clock.now());
ReadResult version2 = ReadResult.createFromCommitted(rowId1, new TableRow(new byte[]{2}), clock.now());
- when(mvPartitionStorage.closestRowId(lowestRowId)).thenReturn(rowId1);
- when(mvPartitionStorage.scanVersions(rowId1)).thenReturn(Cursor.fromIterable(List.of(version1, version2)));
- lenient().when(mvPartitionStorage.closestRowId(rowId2)).thenReturn(rowId2);
+ when(partitionAccess.closestRowId(lowestRowId)).thenReturn(rowId1);
+ when(partitionAccess.getAllRowVersions(rowId1)).thenReturn(Cursor.fromIterable(List.of(version1, version2)));
+ lenient().when(partitionAccess.closestRowId(rowId2)).thenReturn(rowId2);
getMvDataResponse(1);
@@ -501,7 +495,7 @@ class OutgoingSnapshotMvDataStreamingTest {
void anyRowIdIsPassedForFinishedSnapshot() {
ReadResult version = ReadResult.createFromCommitted(rowId1, new TableRow(new byte[]{1}), clock.now());
- configureStorageToHaveExactlyOneRowWith(List.of(version));
+ configurePartitionAccessToHaveExactlyOneRowWith(List.of(version));
getMvDataResponse(Long.MAX_VALUE);
diff --git a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/snapshot/outgoing/OutgoingSnapshotReaderTest.java b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/snapshot/outgoing/OutgoingSnapshotReaderTest.java
index 577819030f..e74cfe45ed 100644
--- a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/snapshot/outgoing/OutgoingSnapshotReaderTest.java
+++ b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/snapshot/outgoing/OutgoingSnapshotReaderTest.java
@@ -25,14 +25,10 @@ import static org.mockito.Mockito.when;
import java.util.UUID;
import java.util.concurrent.Executor;
-import org.apache.ignite.internal.storage.MvPartitionStorage;
import org.apache.ignite.internal.storage.RaftGroupConfiguration;
-import org.apache.ignite.internal.storage.impl.TestMvPartitionStorage;
import org.apache.ignite.internal.table.distributed.raft.snapshot.PartitionAccess;
import org.apache.ignite.internal.table.distributed.raft.snapshot.PartitionKey;
import org.apache.ignite.internal.table.distributed.raft.snapshot.PartitionSnapshotStorage;
-import org.apache.ignite.internal.tx.storage.state.TxStateStorage;
-import org.apache.ignite.internal.tx.storage.state.test.TestTxStateStorage;
import org.apache.ignite.network.TopologyService;
import org.apache.ignite.raft.jraft.entity.RaftOutter.SnapshotMeta;
import org.apache.ignite.raft.jraft.option.RaftOptions;
@@ -44,14 +40,10 @@ import org.junit.jupiter.api.Test;
public class OutgoingSnapshotReaderTest {
@Test
void testForChoosingMaximumAppliedIndexForMeta() {
- MvPartitionStorage mvPartitionStorage = new TestMvPartitionStorage(0);
- TxStateStorage txStateStorage = new TestTxStateStorage();
-
PartitionAccess partitionAccess = mock(PartitionAccess.class);
- when(partitionAccess.mvPartitionStorage()).thenReturn(mvPartitionStorage);
- when(partitionAccess.txStatePartitionStorage()).thenReturn(txStateStorage);
when(partitionAccess.partitionKey()).thenReturn(new PartitionKey(UUID.randomUUID(), 0));
+ when(partitionAccess.committedGroupConfiguration()).thenReturn(mock(RaftGroupConfiguration.class));
OutgoingSnapshotsManager outgoingSnapshotsManager = mock(OutgoingSnapshotsManager.class);
doAnswer(invocation -> {
@@ -62,8 +54,6 @@ public class OutgoingSnapshotReaderTest {
return null;
}).when(outgoingSnapshotsManager).startOutgoingSnapshot(any(), any());
- mvPartitionStorage.committedGroupConfiguration(mock(RaftGroupConfiguration.class));
-
PartitionSnapshotStorage snapshotStorage = new PartitionSnapshotStorage(
mock(TopologyService.class),
outgoingSnapshotsManager,
@@ -74,18 +64,14 @@ public class OutgoingSnapshotReaderTest {
mock(Executor.class)
);
- mvPartitionStorage.lastApplied(10L, 2L);
- txStateStorage.lastApplied(5L, 1L);
-
- SnapshotMeta meta1 = new OutgoingSnapshotReader(snapshotStorage).load();
- assertEquals(10L, meta1.lastIncludedIndex());
- assertEquals(2L, meta1.lastIncludedTerm());
+ when(partitionAccess.minLastAppliedIndex()).thenReturn(5L);
+ when(partitionAccess.maxLastAppliedIndex()).thenReturn(10L);
- mvPartitionStorage.lastApplied(1L, 1L);
- txStateStorage.lastApplied(2L, 2L);
+ when(partitionAccess.minLastAppliedTerm()).thenReturn(1L);
+ when(partitionAccess.maxLastAppliedTerm()).thenReturn(2L);
- SnapshotMeta meta2 = new OutgoingSnapshotReader(snapshotStorage).load();
- assertEquals(2L, meta2.lastIncludedIndex());
- assertEquals(2L, meta2.lastIncludedTerm());
+ SnapshotMeta meta = new OutgoingSnapshotReader(snapshotStorage).load();
+ assertEquals(10L, meta.lastIncludedIndex());
+ assertEquals(2L, meta.lastIncludedTerm());
}
}
diff --git a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/snapshot/outgoing/OutgoingSnapshotTxDataStreamingTest.java b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/snapshot/outgoing/OutgoingSnapshotTxDataStreamingTest.java
index 5b78b20e6f..67be728a63 100644
--- a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/snapshot/outgoing/OutgoingSnapshotTxDataStreamingTest.java
+++ b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/snapshot/outgoing/OutgoingSnapshotTxDataStreamingTest.java
@@ -35,7 +35,6 @@ import java.util.List;
import java.util.UUID;
import org.apache.ignite.internal.hlc.HybridClock;
import org.apache.ignite.internal.hlc.HybridClockImpl;
-import org.apache.ignite.internal.storage.MvPartitionStorage;
import org.apache.ignite.internal.storage.RaftGroupConfiguration;
import org.apache.ignite.internal.table.distributed.TableMessagesFactory;
import org.apache.ignite.internal.table.distributed.raft.snapshot.PartitionAccess;
@@ -45,7 +44,6 @@ import org.apache.ignite.internal.table.distributed.raft.snapshot.message.Snapsh
import org.apache.ignite.internal.table.distributed.replicator.TablePartitionId;
import org.apache.ignite.internal.tx.TxMeta;
import org.apache.ignite.internal.tx.TxState;
-import org.apache.ignite.internal.tx.storage.state.TxStateStorage;
import org.apache.ignite.internal.util.Cursor;
import org.apache.ignite.lang.IgniteBiTuple;
import org.jetbrains.annotations.Nullable;
@@ -60,12 +58,6 @@ class OutgoingSnapshotTxDataStreamingTest {
@Mock
private PartitionAccess partitionAccess;
- @Mock
- private MvPartitionStorage mvPartitionStorage;
-
- @Mock
- private TxStateStorage txStateStorage;
-
private OutgoingSnapshot snapshot;
private final TableMessagesFactory messagesFactory = new TableMessagesFactory();
@@ -87,17 +79,14 @@ class OutgoingSnapshotTxDataStreamingTest {
void createTestInstance() {
when(partitionAccess.partitionKey()).thenReturn(partitionKey);
- lenient().when(partitionAccess.mvPartitionStorage()).thenReturn(mvPartitionStorage);
- lenient().when(partitionAccess.txStatePartitionStorage()).thenReturn(txStateStorage);
-
- lenient().when(mvPartitionStorage.committedGroupConfiguration()).thenReturn(mock(RaftGroupConfiguration.class));
+ lenient().when(partitionAccess.committedGroupConfiguration()).thenReturn(mock(RaftGroupConfiguration.class));
snapshot = new OutgoingSnapshot(UUID.randomUUID(), partitionAccess);
}
@Test
void sendsTxDataFromStorage() {
- configureStorageToHaveExactly(txId1, meta1, txId2, meta2);
+ configurePartitionAccessToHaveExactly(txId1, meta1, txId2, meta2);
SnapshotTxDataResponse response = getTxDataResponse(Integer.MAX_VALUE);
@@ -114,8 +103,8 @@ class OutgoingSnapshotTxDataStreamingTest {
assertThat(response.txMeta().get(1).commitTimestamp(), is(meta2.commitTimestamp()));
}
- private void configureStorageToHaveExactly(UUID txId1, TxMeta meta1, UUID txId2, TxMeta meta2) {
- when(txStateStorage.scan()).thenReturn(Cursor.fromBareIterator(
+ private void configurePartitionAccessToHaveExactly(UUID txId1, TxMeta meta1, UUID txId2, TxMeta meta2) {
+ when(partitionAccess.getAllTxMeta()).thenReturn(Cursor.fromBareIterator(
List.of(new IgniteBiTuple<>(txId1, meta1), new IgniteBiTuple<>(txId2, meta2)).iterator())
);
@@ -139,15 +128,15 @@ class OutgoingSnapshotTxDataStreamingTest {
return snapshot.handleSnapshotTxDataRequest(request);
}
- private void configureStorageToBeEmpty() {
- when(txStateStorage.scan()).thenReturn(Cursor.fromBareIterator(emptyIterator()));
+ private void configurePartitionAccessToBeEmpty() {
+ when(partitionAccess.getAllTxMeta()).thenReturn(Cursor.fromBareIterator(emptyIterator()));
snapshot.freezeScopeUnderMvLock();
}
@Test
void finalTxDataChunkHasFinishTrue() {
- configureStorageToBeEmpty();
+ configurePartitionAccessToBeEmpty();
SnapshotTxDataResponse response = getTxDataResponse(Integer.MAX_VALUE);
@@ -156,7 +145,7 @@ class OutgoingSnapshotTxDataStreamingTest {
@Test
void txDataHandlingRespectsBatchSizeHintForMessagesFromPartition() {
- configureStorageToHaveExactly(txId1, meta1, txId2, meta2);
+ configurePartitionAccessToHaveExactly(txId1, meta1, txId2, meta2);
SnapshotTxDataResponse response = getTxDataResponse(1);
@@ -165,7 +154,7 @@ class OutgoingSnapshotTxDataStreamingTest {
@Test
void txDataResponseThatIsNotLastHasFinishFalse() {
- configureStorageToHaveExactly(txId1, meta1, txId2, meta2);
+ configurePartitionAccessToHaveExactly(txId1, meta1, txId2, meta2);
SnapshotTxDataResponse response = getTxDataResponse(1);
@@ -173,10 +162,10 @@ class OutgoingSnapshotTxDataStreamingTest {
}
@Test
- void closesCursorWhenTxDataIsExhaustedInPartition() throws Exception {
+ void closesCursorWhenTxDataIsExhaustedInPartition() {
Cursor<IgniteBiTuple<UUID, TxMeta>> cursor = spy(Cursor.fromBareIterator(emptyIterator()));
- when(txStateStorage.scan()).thenReturn(cursor);
+ when(partitionAccess.getAllTxMeta()).thenReturn(cursor);
snapshot.freezeScopeUnderMvLock();
getTxDataResponse(Integer.MAX_VALUE);
diff --git a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/snapshot/outgoing/OutgoingSnapshotsManagerTest.java b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/snapshot/outgoing/OutgoingSnapshotsManagerTest.java
index 06f9c12215..9d19facc05 100644
--- a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/snapshot/outgoing/OutgoingSnapshotsManagerTest.java
+++ b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/snapshot/outgoing/OutgoingSnapshotsManagerTest.java
@@ -26,12 +26,9 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.UUID;
-import org.apache.ignite.internal.storage.MvPartitionStorage;
import org.apache.ignite.internal.storage.RaftGroupConfiguration;
import org.apache.ignite.internal.table.distributed.raft.snapshot.PartitionAccess;
import org.apache.ignite.internal.table.distributed.raft.snapshot.PartitionKey;
-import org.apache.ignite.internal.tx.storage.state.TxStateStorage;
-import org.apache.ignite.network.MessagingService;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
@@ -40,9 +37,6 @@ import org.mockito.junit.jupiter.MockitoExtension;
@ExtendWith(MockitoExtension.class)
class OutgoingSnapshotsManagerTest {
- @Mock
- private MessagingService messagingService;
-
@InjectMocks
private OutgoingSnapshotsManager manager;
@@ -69,13 +63,9 @@ class OutgoingSnapshotsManagerTest {
@Test
void startsSnapshot() {
- MvPartitionStorage mvPartitionStorage = mock(MvPartitionStorage.class);
-
when(partitionAccess.partitionKey()).thenReturn(partitionKey);
- when(partitionAccess.mvPartitionStorage()).thenReturn(mvPartitionStorage);
- when(partitionAccess.txStatePartitionStorage()).thenReturn(mock(TxStateStorage.class));
- when(mvPartitionStorage.committedGroupConfiguration()).thenReturn(mock(RaftGroupConfiguration.class));
+ when(partitionAccess.committedGroupConfiguration()).thenReturn(mock(RaftGroupConfiguration.class));
OutgoingSnapshot snapshot = new OutgoingSnapshot(UUID.randomUUID(), partitionAccess);