timoninmaxim commented on code in PR #12456:
URL: https://github.com/apache/ignite/pull/12456#discussion_r2472312152
##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotSelfTest.java:
##########
@@ -1311,6 +1313,92 @@ public void testClientHandlesSnapshotFailOnStartStage()
throws Exception {
assertSnapshotCacheKeys(cln.cache(dfltCacheCfg.getName()));
}
+ /**
+ * Test snapshot operation logging for incremental snapshots.
+ */
+ @Test
+ public void testIncrementalSnapshotOperationLogging() throws Exception {
+ assumeFalse("https://issues.apache.org/jira/browse/IGNITE-17819",
encryption);
+
+ ListeningTestLogger listeningLog = new ListeningTestLogger(log);
+
+ LogListener fullStartListener = LogListener.matches("Starting local
snapshot operation")
+ .andMatches("incremental=false")
+ .build();
+
+ LogListener fullEndListener = LogListener.matches("Finishing local
snapshot operation")
+ .andMatches("err=null")
+ .andMatches("incremental=false")
+ .build();
+
+ listeningLog.registerListener(fullStartListener);
+ listeningLog.registerListener(fullEndListener);
+
+ IgniteConfiguration cfg =
getConfiguration(getTestIgniteInstanceName(0))
+ .setGridLogger(listeningLog);
+
+ IgniteEx ignite = startGrid(cfg);
+ ignite.cluster().state(ACTIVE);
+
+ IgniteFuture<Void> snpFut =
ignite.snapshot().createSnapshot(SNAPSHOT_NAME);
Review Comment:
here and below - unused var
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManager.java:
##########
@@ -1274,6 +1277,9 @@ else if (!F.isEmpty(req.warnings())) {
enableIncrementalSnapshotsCreation(grpIds);
}
}
+
+ if (log.isInfoEnabled())
Review Comment:
Will not log on error, let's add error log in the underlying catch block
##########
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:
cancel blocks until `snapshotBlocked` latch is triggered. Then test runs
15sec. Let's throw an exception instead (failureSnapshotSender or similar)
##########
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotSelfTest.java:
##########
@@ -541,7 +543,7 @@ public void testBltChangeDuringClusterSnapshot() throws
Exception {
/** @throws Exception If fails. */
@Test
- public void testClusterSnapshotExOnInitiatorLeft() throws Exception {
+ public void testClusterSnapshotёExOnInitiatorLeft() throws Exception {
Review Comment:
remove this change
--
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]