timoninmaxim commented on code in PR #12456:
URL: https://github.com/apache/ignite/pull/12456#discussion_r2460176606
##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotSelfTest.java:
##########
@@ -1311,6 +1313,80 @@ public void testClientHandlesSnapshotFailOnStartStage()
throws Exception {
assertSnapshotCacheKeys(cln.cache(dfltCacheCfg.getName()));
}
+ /**
+ * Test snapshot operation logging for incremental snapshots.
+ */
+ @Test
+ public void testIncrementalSnapshotOperationLogging() throws Exception {
+ ListeningTestLogger listeningLog = new ListeningTestLogger(log);
+
+ LogListener fullStartListener = LogListener.matches("Starting local
snapshot operation")
+ .andMatches("snpName=testSnapshot")
+ .andMatches("incremental=false")
+ .build();
+
+ LogListener fullEndListener = LogListener.matches("Finishing local
snapshot operation")
+ .andMatches("snpName=testSnapshot")
+ .andMatches("incremental=false")
+ .andMatches("status=COMPLETED")
+ .build();
+
+ LogListener incStartListener = LogListener.matches("Starting local
snapshot operation")
+ .andMatches("snpName=testSnapshot")
+ .andMatches("incremental=true")
+ .andMatches("incrementIndex=1")
+ .build();
+
+ LogListener incEndListener = LogListener.matches("Finishing local
snapshot operation")
+ .andMatches("snpName=testSnapshot")
+ .andMatches("incremental=true")
+ .andMatches("incrementIndex=1")
+ .andMatches("status=COMPLETED")
+ .build();
+
+ LogListener failureListener = LogListener.matches("Finishing local
snapshot operation")
+ .andMatches("status=FAILED")
+ .build();
+
+ listeningLog.registerListener(fullStartListener);
+ listeningLog.registerListener(fullEndListener);
+ listeningLog.registerListener(incStartListener);
+ listeningLog.registerListener(incEndListener);
+ listeningLog.registerListener(failureListener);
+
+ IgniteConfiguration cfg =
getConfiguration(getTestIgniteInstanceName(0))
+ .setGridLogger(listeningLog);
+
+ IgniteEx ignite = startGrid(cfg);
+ ignite.cluster().state(ACTIVE);
+
+ IgniteFuture<Void> snpFut =
ignite.snapshot().createSnapshot(SNAPSHOT_NAME);
+
+ snpFut.get(getTestTimeout());
+
+ assertTrue("Full snapshot start log not found",
fullStartListener.check());
+ assertTrue("Full snapshot end log not found", fullEndListener.check());
+
+ IgniteFuture<Void> incSnpFut =
ignite.snapshot().createIncrementalSnapshot(SNAPSHOT_NAME);
+
+ incSnpFut.get(getTestTimeout());
+
+ assertTrue("Incremental snapshot start log not found",
incStartListener.check());
+ assertTrue("Incremental snapshot end log not found",
incEndListener.check());
+
+ try {
+ IgniteFuture<Void> fut =
ignite.snapshot().createSnapshot("testSnp2");
+ ignite.snapshot().cancelSnapshot("testSnp2").get();
Review Comment:
Let's block snapshot creation before cancelling it. For example, see
blockingLocalSnapshotSender, BlockingCustomMessageDiscoverySpi
--
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]