tkalkirill commented on code in PR #1263:
URL: https://github.com/apache/ignite-3/pull/1263#discussion_r1007839859
##########
modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/PartitionCommandListenerTest.java:
##########
@@ -206,6 +215,42 @@ public void testInsertRowsBatchedAndCheck() {
readAndCheck(false);
}
+ /**
+ * The test checks that {@link PartitionListener#onSnapshotSave(Path,
Consumer)} propagates
+ * the maximal last applied index among storages to all storages.
+ */
+ @Test
+ public void testOnSnapshotSavePropagateLastAppliedIndex() {
+ ReplicaService replicaService = mock(ReplicaService.class,
RETURNS_DEEP_STUBS);
+
+ TestConcurrentHashMapTxStateStorage txStateStorage = new
TestConcurrentHashMapTxStateStorage();
+
+ TestPartitionDataStorage partitionDataStorage = new
TestPartitionDataStorage(mvPartitionStorage);
+
+ PartitionListener testCommandListener = new PartitionListener(
+ partitionDataStorage,
+ txStateStorage,
+ new TxManagerImpl(replicaService, new HeapLockManager(), new
HybridClock()),
+ () -> Map.of(pkStorage.id(), pkStorage)
+ );
+
+ txStateStorage.lastAppliedIndex(3L);
+
+ partitionDataStorage.lastAppliedIndex(5L);
+
+ AtomicLong counter = new AtomicLong(0);
+
+ testCommandListener.onSnapshotSave(workDir, (throwable) -> {
+ counter.incrementAndGet();
+ });
+
+ assertEquals(1L, counter.get());
+
+ assertEquals(5L, partitionDataStorage.lastAppliedIndex());
Review Comment:
fix it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]