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

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

commit 987d9cc53681c608b279d1d95d3c125f32db3848
Author: Kirill Tkalenko <[email protected]>
AuthorDate: Mon Nov 17 08:45:08 2025 +0300

    IGNITE-27052 wip
---
 .../internal/causality/IncrementalVersionedValue.java  | 18 ++++++++++++++----
 .../causality/IncrementalVersionedValueTest.java       |  8 +++++++-
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/causality/IncrementalVersionedValue.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/causality/IncrementalVersionedValue.java
index 1631ed4056f..c4b6a98a0a8 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/causality/IncrementalVersionedValue.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/causality/IncrementalVersionedValue.java
@@ -27,6 +27,8 @@ import java.util.concurrent.CompletionException;
 import java.util.function.BiFunction;
 import java.util.function.Function;
 import java.util.function.Supplier;
+import org.apache.ignite.lang.ErrorGroups.Common;
+import org.apache.ignite.lang.IgniteException;
 import org.jetbrains.annotations.Nullable;
 
 /**
@@ -219,13 +221,21 @@ public class IncrementalVersionedValue<T> implements 
VersionedValue<T> {
     public CompletableFuture<T> update(long causalityToken, BiFunction<T, 
Throwable, CompletableFuture<T>> updater) {
         synchronized (updateMutex) {
             if (expectedToken == -1) {
-                assert causalityToken > lastCompleteToken
-                        : String.format("Causality token is outdated, previous 
token %d, got %d", lastCompleteToken, causalityToken);
+                if (causalityToken <= lastCompleteToken) {
+                    throw new IgniteException(
+                            Common.INTERNAL_ERR,
+                            String.format("Causality token is outdated, 
previous token %d, got %d", lastCompleteToken, causalityToken)
+                    );
+                }
 
                 expectedToken = causalityToken;
             } else {
-                assert expectedToken == causalityToken
-                        : String.format("Causality token mismatch, expected 
%d, got %d", expectedToken, causalityToken);
+                if (expectedToken != causalityToken) {
+                    throw new IgniteException(
+                            Common.INTERNAL_ERR,
+                            String.format("Causality token mismatch, expected 
%d, got %d", expectedToken, causalityToken)
+                    );
+                }
             }
 
             updaterFuture = updaterFuture
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/causality/IncrementalVersionedValueTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/causality/IncrementalVersionedValueTest.java
index 08091bc54e7..f605583c356 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/causality/IncrementalVersionedValueTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/causality/IncrementalVersionedValueTest.java
@@ -51,6 +51,8 @@ import java.util.concurrent.atomic.AtomicReference;
 import java.util.function.BiFunction;
 import org.apache.ignite.internal.lang.IgniteInternalException;
 import org.apache.ignite.internal.testframework.BaseIgniteAbstractTest;
+import org.apache.ignite.internal.testframework.IgniteTestUtils;
+import org.apache.ignite.lang.IgniteException;
 import org.jetbrains.annotations.Nullable;
 import org.junit.jupiter.api.RepeatedTest;
 import org.junit.jupiter.api.Test;
@@ -99,7 +101,11 @@ public class IncrementalVersionedValueTest extends 
BaseIgniteAbstractTest {
 
         assertEquals(TEST_VALUE + incrementCount, fut.get());
 
-        assertThrows(AssertionError.class, () -> versionedValue.update(1L, (i, 
t) -> nullCompletedFuture()));
+        IgniteTestUtils.assertThrows(
+                IgniteException.class,
+                () -> versionedValue.update(1L, (i, t) -> 
nullCompletedFuture()),
+                "Causality token is outdated, previous token 1, got 1"
+        );
     }
 
     /**

Reply via email to