You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by av...@apache.org on 2022/08/16 09:26:54 UTC

[ignite] branch master updated: IGNITE-17496 LWM may be after HWM (reserved) on primary after the node restart (#10185)

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

av 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 4728d01995e IGNITE-17496 LWM may be after HWM (reserved) on primary after the node restart (#10185)
4728d01995e is described below

commit 4728d01995ed95357844361cba5668fcd3a4c2df
Author: Anton Vinogradov <av...@apache.org>
AuthorDate: Tue Aug 16 12:26:45 2022 +0300

    IGNITE-17496 LWM may be after HWM (reserved) on primary after the node restart (#10185)
---
 .../processors/cache/PartitionUpdateCounterTrackingImpl.java      | 4 +++-
 .../processors/cache/transactions/PartitionUpdateCounterTest.java | 8 +++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/PartitionUpdateCounterTrackingImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/PartitionUpdateCounterTrackingImpl.java
index 57da22e13f4..80bb1807cde 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/PartitionUpdateCounterTrackingImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/PartitionUpdateCounterTrackingImpl.java
@@ -102,9 +102,11 @@ public class PartitionUpdateCounterTrackingImpl implements PartitionUpdateCounte
     @Override public void init(long initUpdCntr, @Nullable byte[] cntrUpdData) {
         cntr.set(initUpdCntr);
 
-        reserveCntr.set(initCntr = initUpdCntr);
+        initCntr = initUpdCntr;
 
         queue = fromBytes(cntrUpdData);
+
+        reserveCntr.set(highestAppliedCounter());
     }
 
     /** {@inheritDoc} */
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/PartitionUpdateCounterTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/PartitionUpdateCounterTest.java
index 32c727712b7..5e43476d3cb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/PartitionUpdateCounterTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/PartitionUpdateCounterTest.java
@@ -351,7 +351,7 @@ public class PartitionUpdateCounterTest extends GridCommonAbstractTest {
      *
      */
     @Test
-    public void testGapsSerialization() {
+    public void testGapsSerialization() throws IgniteCheckedException {
         PartitionUpdateCounter pc = new PartitionUpdateCounterTrackingImpl(null);
 
         Random r = new Random();
@@ -368,6 +368,12 @@ public class PartitionUpdateCounterTest extends GridCommonAbstractTest {
         NavigableMap q1 = U.field(pc2, "queue");
 
         assertEquals(q0, q1);
+
+        long reserved = pc2.reserved();
+        long highestApplied = U.invoke(PartitionUpdateCounterTrackingImpl.class, pc2, "highestAppliedCounter");
+
+        // Checking correct initialization.
+        assertEquals(reserved, highestApplied);
     }
 
     /**