You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by as...@apache.org on 2020/08/21 13:43:53 UTC

[ignite] branch master updated: IGNITE-13365 Fixed WAL reservation for historical rebalancing if WAL is disabled. - Fixes #8176.

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

ascherbakov 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 89c01b7  IGNITE-13365 Fixed WAL reservation for historical rebalancing if WAL is disabled. - Fixes #8176.
89c01b7 is described below

commit 89c01b78f79b15a6ac1dbb1b90424f4dab3d82c3
Author: sergeyuttsel <ut...@gmail.com>
AuthorDate: Fri Aug 21 16:41:32 2020 +0300

    IGNITE-13365 Fixed WAL reservation for historical rebalancing if WAL is disabled. - Fixes #8176.
    
    Signed-off-by: Alexey Scherbakov <al...@gmail.com>
---
 .../persistence/checkpoint/CheckpointHistory.java  |  6 +++-
 .../db/wal/IgniteWalHistoryReservationsTest.java   | 38 +++++++++++++++++++++-
 2 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/checkpoint/CheckpointHistory.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/checkpoint/CheckpointHistory.java
index edc9e2a..9a81366 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/checkpoint/CheckpointHistory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/checkpoint/CheckpointHistory.java
@@ -31,6 +31,7 @@ import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.IgniteSystemProperties;
 import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.WALMode;
 import org.apache.ignite.internal.GridKernalContext;
 import org.apache.ignite.internal.pagemem.wal.WALPointer;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
@@ -555,7 +556,8 @@ public class CheckpointHistory {
     public CheckpointHistoryResult searchAndReserveCheckpoints(
         final Map<Integer, Set<Integer>> groupsAndPartitions
     ) {
-        if (F.isEmpty(groupsAndPartitions))
+        if (F.isEmpty(groupsAndPartitions) ||
+            cctx.kernalContext().config().getDataStorageConfiguration().getWalMode() == WALMode.NONE)
             return new CheckpointHistoryResult(Collections.emptyMap(), null);
 
         final Map<Integer, T2<ReservationReason, Map<Integer, CheckpointEntry>>> res = new HashMap<>();
@@ -598,6 +600,8 @@ public class CheckpointHistory {
 
                 for (Map.Entry<Integer, T2<ReservationReason, Map<Integer, CheckpointEntry>>> entry : res.entrySet())
                     entry.setValue(new T2<>(ReservationReason.WAL_RESERVATION_ERROR, null));
+
+                oldestCpForReservation = null;
             }
         }
 
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalHistoryReservationsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalHistoryReservationsTest.java
index 209ca17..8d22823 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalHistoryReservationsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalHistoryReservationsTest.java
@@ -40,6 +40,7 @@ import org.apache.ignite.internal.util.lang.GridAbsPredicate;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.MvccFeatureChecker;
+import org.apache.ignite.testframework.junits.WithSystemProperty;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.junit.Assert;
 import org.junit.Assume;
@@ -54,6 +55,9 @@ public class IgniteWalHistoryReservationsTest extends GridCommonAbstractTest {
     /** */
     private volatile boolean client;
 
+    /** */
+    private WALMode walMode;
+
     /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(gridName);
@@ -71,7 +75,7 @@ public class IgniteWalHistoryReservationsTest extends GridCommonAbstractTest {
                 new DataRegionConfiguration()
                     .setMaxSize(200L * 1024 * 1024)
                     .setPersistenceEnabled(true))
-            .setWalMode(WALMode.LOG_ONLY)
+            .setWalMode(walMode)
             .setWalSegmentSize(512 * 1024);
 
         cfg.setDataStorageConfiguration(memCfg);
@@ -99,6 +103,13 @@ public class IgniteWalHistoryReservationsTest extends GridCommonAbstractTest {
     }
 
     /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        walMode = WALMode.LOG_ONLY;
+    }
+
+    /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {
         System.clearProperty(IGNITE_PDS_WAL_REBALANCE_THRESHOLD);
 
@@ -513,4 +524,29 @@ public class IgniteWalHistoryReservationsTest extends GridCommonAbstractTest {
 
         awaitPartitionMapExchange();
     }
+
+    /**
+     * @throws Exception If failed.
+     */
+    @Test
+    @WithSystemProperty(key = IGNITE_PDS_WAL_REBALANCE_THRESHOLD, value = "0")
+    public void testCheckpointsNotReserveWithWalModeNone() throws Exception {
+        walMode = WALMode.NONE;
+
+        IgniteEx grid = startGrids(2);
+
+        grid.cluster().active(true);
+
+        IgniteCache<Object, Object> cache = grid.createCache(new CacheConfiguration<>("cache").setBackups(1));
+
+        for (int i = 0; i < 1000; i++)
+            cache.put(i, i);
+
+        stopGrid(1);
+
+        for (int i = 1000; i < 2000; i++)
+            cache.put(i, i);
+
+        startGrid(1);
+    }
 }