This is an automated email from the ASF dual-hosted git repository.
NSAmelchev pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new f38a8b0412a IGNITE-29111 Fix startTime metric of the snapshot check
operation (#13656)
f38a8b0412a is described below
commit f38a8b0412af9a088919810b838e9d0b75d15be2
Author: Nikita Amelchev <[email protected]>
AuthorDate: Wed Oct 7 13:39:40 2026 +0300
IGNITE-29111 Fix startTime metric of the snapshot check operation (#13656)
---
.../cache/persistence/snapshot/SnapshotCheckProcess.java | 4 +++-
.../persistence/snapshot/IgniteClusterSnapshotCheckTest.java | 10 ++++++++--
.../cache/persistence/snapshot/IgniteSnapshotMXBeanTest.java | 10 ++++++----
3 files changed, 17 insertions(+), 7 deletions(-)
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotCheckProcess.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotCheckProcess.java
index 2f19878617a..533f3e1a44d 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotCheckProcess.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotCheckProcess.java
@@ -729,7 +729,9 @@ public class SnapshotCheckProcess {
assert !mreg.iterator().hasNext();
assert ctx.req.requestId() != null;
- mreg.register("startTime", U::currentTimeMillis,
+ long startTime = U.currentTimeMillis();
+
+ mreg.register("startTime", () -> startTime,
"The system time of the start of the cluster snapshot check
operation on current node.");
if (ctx.req.incrementalIndex() > 0) {
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotCheckTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotCheckTest.java
index 306d44224a4..69b23adbe46 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotCheckTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotCheckTest.java
@@ -725,7 +725,7 @@ public class IgniteClusterSnapshotCheckTest extends
AbstractSnapshotSelfTest {
discoSpi(grid(coordId)).block(msg -> msg instanceof FullMessage
&& ((FullMessage<?>)msg).type() ==
CHECK_SNAPSHOT_METAS.ordinal());
- long mills = System.currentTimeMillis();
+ long mills = U.currentTimeMillis();
if (restore) {
fut2 = snp(grid(initiator)).restoreSnapshot(SNAPSHOT_NAME,
null, null, incremental ? 1 : 0,
@@ -742,6 +742,10 @@ public class IgniteClusterSnapshotCheckTest extends
AbstractSnapshotSelfTest {
discoSpi(grid(coordId)).waitBlocked(getTestTimeout());
+ long blockedMills = U.currentTimeMillis();
+
+ assertTrue(waitForCondition(() -> U.currentTimeMillis() >
blockedMills, getTestTimeout()));
+
for (int i = 0; i < G.allGrids().size(); ++i) {
if (stoppedNodes0.contains(i))
continue;
@@ -757,7 +761,9 @@ public class IgniteClusterSnapshotCheckTest extends
AbstractSnapshotSelfTest {
assertTrue(mreg.iterator().hasNext());
- assertTrue(mreg.<LongMetric>findMetric("startTime").value() >
mills);
+ long startTime =
mreg.<LongMetric>findMetric("startTime").value();
+
+ assertTrue(startTime >= mills && startTime <= blockedMills);
if (incremental) {
assertEquals(1,
mreg.<IntMetric>findMetric("incrementIndex").value());
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotMXBeanTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotMXBeanTest.java
index cf359d313ef..cdb30ae79b8 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotMXBeanTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotMXBeanTest.java
@@ -82,10 +82,12 @@ public class IgniteSnapshotMXBeanTest extends
AbstractSnapshotSelfTest {
if (!encryption) {
mxBean.createIncrementalSnapshot(SNAPSHOT_NAME, "");
- assertTrue(
- "Waiting for incremental snapshot failed",
- GridTestUtils.waitForCondition(() -> checkIncremental(ignite,
SNAPSHOT_NAME, null, 1), TIMEOUT)
- );
+ DynamicMBean incSnpMBean = metricRegistry(ignite.name(),
SNAPSHOT_METRICS, "incremental");
+
+ assertTrue("Waiting for incremental snapshot failed",
+ GridTestUtils.waitForCondition(() ->
(long)getMetric("endTime", incSnpMBean) > 0, TIMEOUT));
+
+ assertTrue(checkIncremental(ignite, SNAPSHOT_NAME, null, 1));
}
stopAllGrids();