You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by tk...@apache.org on 2025/04/14 17:20:55 UTC

(ignite-3) 01/01: IGNITE-25128 wip

This is an automated email from the ASF dual-hosted git repository.

tkalkirill pushed a commit to branch ignite-25128
in repository https://gitbox.apache.org/repos/asf/ignite-3.git

commit eb00a184a006ce8339f2dcede2d604b3d90e5981
Author: Kirill Tkalenko <tk...@yandex.ru>
AuthorDate: Mon Apr 14 20:20:32 2025 +0300

    IGNITE-25128 wip
---
 .../ignite/internal/lowwatermark/LowWatermarkImpl.java    |  3 ++-
 .../internal/lowwatermark/LowWatermarkImplTest.java       | 15 ++++++++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/modules/low-watermark/src/main/java/org/apache/ignite/internal/lowwatermark/LowWatermarkImpl.java b/modules/low-watermark/src/main/java/org/apache/ignite/internal/lowwatermark/LowWatermarkImpl.java
index 2b176921888..db237c7ced3 100644
--- a/modules/low-watermark/src/main/java/org/apache/ignite/internal/lowwatermark/LowWatermarkImpl.java
+++ b/modules/low-watermark/src/main/java/org/apache/ignite/internal/lowwatermark/LowWatermarkImpl.java
@@ -22,6 +22,7 @@ import static org.apache.ignite.internal.hlc.HybridTimestamp.MIN_VALUE;
 import static org.apache.ignite.internal.hlc.HybridTimestamp.hybridTimestampToLong;
 import static org.apache.ignite.internal.lowwatermark.event.LowWatermarkEvent.LOW_WATERMARK_CHANGED;
 import static org.apache.ignite.internal.util.CompletableFutures.nullCompletedFuture;
+import static org.apache.ignite.internal.util.ExceptionUtils.unwrapCause;
 import static org.apache.ignite.internal.util.IgniteUtils.inBusyLock;
 import static org.apache.ignite.internal.util.IgniteUtils.inBusyLockAsync;
 
@@ -343,7 +344,7 @@ public class LowWatermarkImpl extends AbstractEventProducer<LowWatermarkEvent, L
                                     new ChangeLowWatermarkEventParameters(newLowWatermark)), scheduledThreadPool)
                             .whenCompleteAsync((unused, throwable) -> {
                                 if (throwable != null) {
-                                    if (!(throwable instanceof NodeStoppingException)) {
+                                    if (!(unwrapCause(throwable) instanceof NodeStoppingException)) {
                                         LOG.error("Failed to update low watermark, will schedule again: {}", throwable, newLowWatermark);
 
                                         failureManager.process(new FailureContext(CRITICAL_ERROR, throwable));
diff --git a/modules/low-watermark/src/test/java/org/apache/ignite/internal/lowwatermark/LowWatermarkImplTest.java b/modules/low-watermark/src/test/java/org/apache/ignite/internal/lowwatermark/LowWatermarkImplTest.java
index 70cf3321fba..3311f5c012d 100644
--- a/modules/low-watermark/src/test/java/org/apache/ignite/internal/lowwatermark/LowWatermarkImplTest.java
+++ b/modules/low-watermark/src/test/java/org/apache/ignite/internal/lowwatermark/LowWatermarkImplTest.java
@@ -21,6 +21,7 @@ import static java.util.concurrent.CompletableFuture.failedFuture;
 import static java.util.stream.Collectors.toList;
 import static org.apache.ignite.internal.lowwatermark.LowWatermarkImpl.LOW_WATERMARK_VAULT_KEY;
 import static org.apache.ignite.internal.lowwatermark.event.LowWatermarkEvent.LOW_WATERMARK_CHANGED;
+import static org.apache.ignite.internal.testframework.matchers.CompletableFutureExceptionMatcher.willThrowWithCauseOrSuppressed;
 import static org.apache.ignite.internal.testframework.matchers.CompletableFutureExceptionMatcher.willTimeoutFast;
 import static org.apache.ignite.internal.testframework.matchers.CompletableFutureMatcher.willBe;
 import static org.apache.ignite.internal.testframework.matchers.CompletableFutureMatcher.willCompleteSuccessfully;
@@ -60,6 +61,7 @@ import org.apache.ignite.internal.hlc.ClockService;
 import org.apache.ignite.internal.hlc.HybridClockImpl;
 import org.apache.ignite.internal.hlc.HybridTimestamp;
 import org.apache.ignite.internal.hlc.TestClockService;
+import org.apache.ignite.internal.lang.NodeStoppingException;
 import org.apache.ignite.internal.lowwatermark.event.ChangeLowWatermarkEventParameters;
 import org.apache.ignite.internal.lowwatermark.message.GetLowWatermarkRequest;
 import org.apache.ignite.internal.lowwatermark.message.GetLowWatermarkResponse;
@@ -89,6 +91,8 @@ public class LowWatermarkImplTest extends BaseIgniteAbstractTest {
 
     private final VaultManager vaultManager = mock(VaultManager.class);
 
+    private final FailureManager failureManager = mock(FailureManager.class);
+
     private EventListener<ChangeLowWatermarkEventParameters> lwmChangedListener;
 
     private LowWatermarkImpl lowWatermark;
@@ -105,7 +109,7 @@ public class LowWatermarkImplTest extends BaseIgniteAbstractTest {
                 lowWatermarkConfig,
                 clockService,
                 vaultManager,
-                mock(FailureManager.class),
+                failureManager,
                 messagingService
         );
 
@@ -323,6 +327,15 @@ public class LowWatermarkImplTest extends BaseIgniteAbstractTest {
         assertThat(lowWatermark.updateAndNotify(newLwm), willCompleteSuccessfully());
     }
 
+    @Test
+    void testUpdateAndNotifyNotInvokeFailureManagerWhenGetNodeStoppingException() {
+        lowWatermark.listen(LOW_WATERMARK_CHANGED, parameters -> failedFuture(new NodeStoppingException()));
+
+        assertThat(lowWatermark.updateAndNotify(clockService.now()), willThrowWithCauseOrSuppressed(NodeStoppingException.class));
+
+        verify(failureManager, never()).process(any());
+    }
+
     private CompletableFuture<HybridTimestamp> listenUpdateLowWatermark() {
         var future = new CompletableFuture<HybridTimestamp>();