You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ap...@apache.org on 2025/03/19 13:19:04 UTC
(ignite-3) branch main updated: IGNITE-24849 Flush storages after rebalance (#5449)
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 94879bc00b7 IGNITE-24849 Flush storages after rebalance (#5449)
94879bc00b7 is described below
commit 94879bc00b755cd13730184b82d295c736a088bd
Author: Alexander Polovtcev <al...@gmail.com>
AuthorDate: Wed Mar 19 15:18:59 2025 +0200
IGNITE-24849 Flush storages after rebalance (#5449)
---
.../raft/snapshot/PartitionTxStateAccessImpl.java | 2 +-
.../raftsnapshot/ItTableRaftSnapshotsTest.java | 42 +++++++++++++++++-----
.../internal/table/distributed/TableManager.java | 2 +-
.../snapshot/PartitionMvStorageAccessImpl.java | 3 +-
4 files changed, 38 insertions(+), 11 deletions(-)
diff --git a/modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/raft/snapshot/PartitionTxStateAccessImpl.java b/modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/raft/snapshot/PartitionTxStateAccessImpl.java
index 106874f11a8..93dfe3630d1 100644
--- a/modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/raft/snapshot/PartitionTxStateAccessImpl.java
+++ b/modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/raft/snapshot/PartitionTxStateAccessImpl.java
@@ -81,6 +81,6 @@ public class PartitionTxStateAccessImpl implements PartitionTxStateAccess {
@Override
public CompletableFuture<Void> finishRebalance(MvPartitionMeta partitionMeta) {
- return storage.finishRebalance(partitionMeta);
+ return storage.finishRebalance(partitionMeta).thenCompose(v -> storage.flush());
}
}
diff --git a/modules/raft/src/integrationTest/java/org/apache/ignite/internal/raftsnapshot/ItTableRaftSnapshotsTest.java b/modules/raft/src/integrationTest/java/org/apache/ignite/internal/raftsnapshot/ItTableRaftSnapshotsTest.java
index c68f7402f28..410210cedd3 100644
--- a/modules/raft/src/integrationTest/java/org/apache/ignite/internal/raftsnapshot/ItTableRaftSnapshotsTest.java
+++ b/modules/raft/src/integrationTest/java/org/apache/ignite/internal/raftsnapshot/ItTableRaftSnapshotsTest.java
@@ -40,6 +40,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assumptions.assumeFalse;
import java.util.List;
import java.util.Map;
@@ -55,6 +56,7 @@ import java.util.concurrent.atomic.AtomicReference;
import java.util.function.BiPredicate;
import java.util.function.Consumer;
import java.util.stream.IntStream;
+import java.util.stream.Stream;
import org.apache.ignite.Ignite;
import org.apache.ignite.internal.Cluster;
import org.apache.ignite.internal.ClusterPerTestIntegrationTest;
@@ -112,7 +114,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInfo;
import org.junit.jupiter.api.Timeout;
import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.ValueSource;
+import org.junit.jupiter.params.provider.MethodSource;
/**
* Tests how RAFT snapshots installation works for table partitions.
@@ -183,17 +185,41 @@ class ItTableRaftSnapshotsTest extends ClusterPerTestIntegrationTest {
/**
* Tests that a leader successfully feeds a follower with a RAFT snapshot on any of the supported storage engines.
*/
- // TODO: IGNITE-18481 - make sure we don't forget to add new storage engines here
- @ParameterizedTest
- @ValueSource(strings = {
- RocksDbStorageEngine.ENGINE_NAME,
- PersistentPageMemoryStorageEngine.ENGINE_NAME,
- VolatilePageMemoryStorageEngine.ENGINE_NAME
- })
+ @ParameterizedTest(name = "engine = {0}")
+ @MethodSource("storageEngines")
void leaderFeedsFollowerWithSnapshot(String storageEngine) throws Exception {
testLeaderFeedsFollowerWithSnapshot(storageEngine);
}
+ /**
+ * Tests that data can be recovered on node start after snapshot installation.
+ */
+ @ParameterizedTest(name = "engine = {0}")
+ @MethodSource("storageEngines")
+ void testDataRecoveryAfterSnapshot(String storageEngine) throws InterruptedException {
+ assumeFalse(
+ storageEngine.equals(VolatilePageMemoryStorageEngine.ENGINE_NAME),
+ "https://issues.apache.org/jira/browse/IGNITE-24857"
+ );
+
+ feedNode2WithSnapshotOfOneRow(storageEngine);
+
+ cluster.restartNode(2);
+
+ transferLeadershipOnSolePartitionTo(2);
+
+ assertThat(getFromNode(2, 1), is("one"));
+ }
+
+ // TODO: IGNITE-18481 - make sure we don't forget to add new storage engines here
+ private static Stream<String> storageEngines() {
+ return Stream.of(
+ RocksDbStorageEngine.ENGINE_NAME,
+ PersistentPageMemoryStorageEngine.ENGINE_NAME,
+ VolatilePageMemoryStorageEngine.ENGINE_NAME
+ );
+ }
+
/**
* Tests that a leader successfully feeds a follower with a RAFT snapshot (using the given storage engine).
*/
diff --git a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java
index 0a12ee6cbd6..c24730329d4 100644
--- a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java
+++ b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java
@@ -2457,7 +2457,7 @@ public class TableManager implements IgniteTablesInternal, IgniteComponent {
}
assert replicaMgr.isReplicaStarted(replicaGrpId) : "The local node is outside of the replication group ["
- + ", stable=" + stableAssignments
+ + "stable=" + stableAssignments
+ ", pending=" + pendingAssignments
+ ", localName=" + localNode().name() + "].";
diff --git a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/snapshot/PartitionMvStorageAccessImpl.java b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/snapshot/PartitionMvStorageAccessImpl.java
index fcf11094e77..3e81a33fe77 100644
--- a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/snapshot/PartitionMvStorageAccessImpl.java
+++ b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/snapshot/PartitionMvStorageAccessImpl.java
@@ -222,7 +222,8 @@ public class PartitionMvStorageAccessImpl implements PartitionMvStorageAccess {
@Override
public CompletableFuture<Void> finishRebalance(MvPartitionMeta partitionMeta) {
return mvTableStorage.finishRebalancePartition(partitionId(), partitionMeta)
- .thenAccept(unused -> mvGc.addStorage(tablePartitionId(), gcUpdateHandler));
+ .thenAccept(v -> mvGc.addStorage(tablePartitionId(), gcUpdateHandler))
+ .thenCompose(v -> getMvPartitionStorage().flush());
}
@Override