ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ira...@apache.org
Subject [ignite] branch master updated: IGNITE-11699 Node can't start after forced shutdown if the wal archiver disabled - Fixes #6464.
Date Mon, 13 May 2019 17:08:43 GMT
This is an automated email from the ASF dual-hosted git repository.

irakov 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 e1918d5  IGNITE-11699 Node can't start after forced shutdown if the wal archiver
disabled - Fixes #6464.
e1918d5 is described below

commit e1918d5819d33f6ce01c945d281e46d70ec6994b
Author: Slava Koptilin <slava.koptilin@gmail.com>
AuthorDate: Mon May 13 20:07:43 2019 +0300

    IGNITE-11699 Node can't start after forced shutdown if the wal archiver disabled - Fixes
#6464.
    
    Signed-off-by: Ivan Rakov <irakov@apache.org>
---
 .../wal/record/delta/InitNewPageRecord.java        |   7 +-
 .../wal/record/delta/MetaPageInitRecord.java       |  16 +-
 .../processors/cache/mvcc/txlog/TxLog.java         |   2 +
 .../GridCacheDatabaseSharedManager.java            |  36 +++--
 .../cache/persistence/GridCacheOffheapManager.java |   7 +-
 .../cache/persistence/freelist/PagesList.java      |   5 +
 .../cache/persistence/metastorage/MetaStorage.java |   5 +-
 .../cache/persistence/pagemem/PageMemoryImpl.java  |   4 +-
 .../cache/persistence/wal/SegmentRouter.java       |  12 +-
 .../db/wal/IgniteWalReplayingAfterRestartTest.java | 178 +++++++++++++++++++++
 .../ignite/testsuites/IgnitePdsTestSuite2.java     |   3 +
 11 files changed, 247 insertions(+), 28 deletions(-)

diff --git a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/delta/InitNewPageRecord.java
b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/delta/InitNewPageRecord.java
index 5c20167..60a60c0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/delta/InitNewPageRecord.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/delta/InitNewPageRecord.java
@@ -43,7 +43,7 @@ public class InitNewPageRecord extends PageDeltaRecord {
 
     /**
      * @param grpId Cache group ID.
-     * @param pageId  Page ID.
+     * @param pageId Page ID.
      * @param ioType IO type.
      * @param ioVer IO version.
      * @param newPageId New page ID.
@@ -54,7 +54,7 @@ public class InitNewPageRecord extends PageDeltaRecord {
 
     /**
      * @param grpId Cache group ID.
-     * @param pageId  Page ID.
+     * @param pageId Page ID.
      * @param ioType IO type.
      * @param ioVer IO version.
      * @param newPageId New page ID.
@@ -77,7 +77,8 @@ public class InitNewPageRecord extends PageDeltaRecord {
 
             // Partition consistency failure came from https://issues.apache.org/jira/browse/IGNITE-11030
             // This invalid record can come from persistent stores, version < 2.7.5 where
this bug was not fixed.
-            newPartId = partId; // Just hack new page ID to make this record to be correctly
applied.
+            // Just hack new page ID to make this record to be correctly applied.
+            newPartId = partId;
 
             this.newPageId = PageIdUtils.pageId(
                 newPartId,
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/delta/MetaPageInitRecord.java
b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/delta/MetaPageInitRecord.java
index d683a5a..3e3bb4f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/delta/MetaPageInitRecord.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/delta/MetaPageInitRecord.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.pagemem.wal.record.delta;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.internal.pagemem.PageMemory;
-import org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO;
 import org.apache.ignite.internal.processors.cache.persistence.tree.io.PageMetaIO;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.jetbrains.annotations.Nullable;
@@ -54,23 +53,26 @@ public class MetaPageInitRecord extends InitNewPageRecord {
      * @param grpId Cache group ID.
      * @param pageId Page ID.
      * @param ioType IO type.
-     * @param ioVer Io version.
      * @param treeRoot Tree root.
      * @param reuseListRoot Reuse list root.
      * @param log Logger for case data is invalid. Can be {@code null}, but is needed when
processing existing storage.
      */
-    public MetaPageInitRecord(int grpId, long pageId, int ioType, int ioVer, long treeRoot,
long reuseListRoot,
-        @Nullable IgniteLogger log) {
+    public MetaPageInitRecord(
+        int grpId,
+        long pageId,
+        int ioType,
+        int ioVer,
+        long treeRoot,
+        long reuseListRoot,
+        @Nullable IgniteLogger log
+    ) {
         super(grpId, pageId, ioType, ioVer, pageId, log);
 
-        assert ioType == PageIO.T_META || ioType == PageIO.T_PART_META;
-
         this.treeRoot = treeRoot;
         this.reuseListRoot = reuseListRoot;
         this.ioType = ioType;
     }
 
-
     /**
      * @return Tree root.
      */
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/txlog/TxLog.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/txlog/TxLog.java
index 2351d29..b7303e6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/txlog/TxLog.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/mvcc/txlog/TxLog.java
@@ -126,6 +126,8 @@ public class TxLog implements DbCheckpointListener {
                             io.setReuseListRoot(pageAddr, reuseListRoot);
 
                             if (PageHandler.isWalDeltaRecordNeeded(pageMemory, TX_LOG_CACHE_ID,
metaId, metaPage, wal, null))
+                                assert io.getType() == PageIO.T_META;
+
                                 wal.log(new MetaPageInitRecord(
                                     TX_LOG_CACHE_ID,
                                     metaId,
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
index 1cc1ebb..498ccf1 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
@@ -2277,10 +2277,14 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
 
                                         applied.incrementAndGet();
                                     }
-                                    catch (IgniteCheckedException e) {
-                                        U.error(log, "Failed to apply page snapshot, " +
pageSnapshot);
-
-                                        applyError.compareAndSet(null, e);
+                                    catch (Throwable t) {
+                                        U.error(log, "Failed to apply page snapshot. rec=["
+ pageSnapshot + ']');
+
+                                        applyError.compareAndSet(
+                                            null,
+                                            (t instanceof IgniteCheckedException)?
+                                                (IgniteCheckedException)t:
+                                                new IgniteCheckedException("Failed to apply
page snapshot", t));
                                     }
                                 }, groupId, partId, exec, semaphore
                             );
@@ -2304,10 +2308,14 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
                                 try {
                                     cancelOrWaitPartitionDestroy(groupId, partId);
                                 }
-                                catch (IgniteCheckedException e) {
-                                    U.error(log, "Failed to cancel or wait partition destroy,
" + metaStateRecord);
-
-                                    applyError.compareAndSet(null, e);
+                                catch (Throwable t) {
+                                    U.error(log, "Failed to cancel or wait partition destroy.
rec=[" + metaStateRecord + ']');
+
+                                    applyError.compareAndSet(
+                                        null,
+                                        (t instanceof IgniteCheckedException) ?
+                                            (IgniteCheckedException)t :
+                                            new IgniteCheckedException("Failed to cancel
or wait partition destroy", t));
                                 }
                             }
                         }, groupId, partId, exec, semaphore);
@@ -2347,10 +2355,14 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
 
                                     applied.incrementAndGet();
                                 }
-                                catch (IgniteCheckedException e) {
-                                    U.error(log, "Failed to apply page delta, " + pageDelta);
-
-                                    applyError.compareAndSet(null, e);
+                                catch (Throwable t) {
+                                    U.error(log, "Failed to apply page delta. rec=[" + pageDelta
+ ']');
+
+                                    applyError.compareAndSet(
+                                        null,
+                                        (t instanceof IgniteCheckedException) ?
+                                            (IgniteCheckedException)t :
+                                            new IgniteCheckedException("Failed to apply page
delta", t));
                                 }
                             }, groupId, partId, exec, semaphore);
                         }
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java
index 4f02dcf..84a23d3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java
@@ -884,7 +884,9 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl
imple
                     pageIO.setTreeRoot(pageAddr, metastoreRoot);
                     pageIO.setReuseListRoot(pageAddr, reuseListRoot);
 
-                    if (PageHandler.isWalDeltaRecordNeeded(pageMem, grpId, metaId, metaPage,
wal, null))
+                    if (PageHandler.isWalDeltaRecordNeeded(pageMem, grpId, metaId, metaPage,
wal, null)) {
+                        assert pageIO.getType() == PageIO.T_META;
+
                         wal.log(new MetaPageInitRecord(
                             grpId,
                             metaId,
@@ -893,6 +895,7 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl
imple
                             metastoreRoot,
                             reuseListRoot
                         ));
+                    }
 
                     allocated = true;
                 }
@@ -2020,7 +2023,7 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl
imple
 
             return delegate.mvccInitialValue(cctx, key, val, ver, expireTime, mvccVer, newMvccVer);
         }
-        
+
         /** {@inheritDoc} */
         @Override public boolean mvccApplyHistoryIfAbsent(
             GridCacheContext cctx,
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/PagesList.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/PagesList.java
index 78f44bb..e5cb3a6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/PagesList.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/PagesList.java
@@ -1256,6 +1256,11 @@ public abstract class PagesList extends DataStructure {
         boolean needWalDeltaRecord = needWalDeltaRecord(reusedPageId, reusedPage, null);
 
         if (needWalDeltaRecord) {
+            assert PageIdUtils.partId(reusedPageId) == PageIdUtils.partId(newPageId):
+                "Partition consistency failure: " +
+                "newPageId=" + Long.toHexString(newPageId) + " (newPartId: " + PageIdUtils.partId(newPageId)
+ ") " +
+                "reusedPageId=" + Long.toHexString(reusedPageId) + " (partId: " + PageIdUtils.partId(reusedPageId)
+ ")";
+
             wal.log(new InitNewPageRecord(grpId, reusedPageId, initIo.getType(),
                 initIo.getVersion(), newPageId));
         }
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/metastorage/MetaStorage.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/metastorage/MetaStorage.java
index 05efb40..cfab287 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/metastorage/MetaStorage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/metastorage/MetaStorage.java
@@ -525,7 +525,9 @@ public class MetaStorage implements DbCheckpointListener, ReadWriteMetastorage
{
                         io.setTreeRoot(pageAddr, treeRoot);
                         io.setReuseListRoot(pageAddr, reuseListRoot);
 
-                        if (PageHandler.isWalDeltaRecordNeeded(pageMem, METASTORAGE_CACHE_ID,
partMetaId, partMetaPage, wal, null))
+                        if (PageHandler.isWalDeltaRecordNeeded(pageMem, METASTORAGE_CACHE_ID,
partMetaId, partMetaPage, wal, null)) {
+                            assert io.getType() == PageIO.T_PART_META;
+
                             wal.log(new MetaPageInitRecord(
                                 METASTORAGE_CACHE_ID,
                                 partMetaId,
@@ -534,6 +536,7 @@ public class MetaStorage implements DbCheckpointListener, ReadWriteMetastorage
{
                                 treeRoot,
                                 reuseListRoot
                             ));
+                        }
 
                         allocated = true;
                     }
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
index 471afcc..9949dc7 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
@@ -1775,10 +1775,10 @@ public class PageMemoryImpl implements PageMemoryEx {
      *
      */
     void beforeReleaseWrite(FullPageId pageId, long ptr, boolean pageWalRec) throws IgniteCheckedException
{
-        boolean walIsNotDisable = walMgr != null && !walMgr.disabled(pageId.groupId());
+        boolean walIsNotDisabled = walMgr != null && !walMgr.disabled(pageId.groupId());
         boolean pageRecOrAlwaysWriteFullPage = walMgr != null && (pageWalRec || walMgr.isAlwaysWriteFullPages());
 
-        if (pageRecOrAlwaysWriteFullPage && walIsNotDisable)
+        if (pageRecOrAlwaysWriteFullPage && walIsNotDisabled)
             walMgr.log(new PageSnapshot(pageId, ptr, pageSize(), realPageSize(pageId.groupId())));
     }
 
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/SegmentRouter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/SegmentRouter.java
index 2d47e9d..ecb6965 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/SegmentRouter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/SegmentRouter.java
@@ -69,7 +69,7 @@ public class SegmentRouter {
     public FileDescriptor findSegment(long segmentId) throws FileNotFoundException {
         FileDescriptor fd;
 
-        if (segmentAware.lastArchivedAbsoluteIndex() >= segmentId)
+        if (segmentAware.lastArchivedAbsoluteIndex() >= segmentId || !isArchiverEnabled())
             fd = new FileDescriptor(new File(walArchiveDir, fileName(segmentId)));
         else
             fd = new FileDescriptor(new File(walWorkDir, fileName(segmentId % dsCfg.getWalSegments())),
segmentId);
@@ -87,4 +87,14 @@ public class SegmentRouter {
 
         return fd;
     }
+
+    /**
+     * Returns {@code true} if archiver is enabled.
+     */
+    private boolean isArchiverEnabled() {
+        if (walArchiveDir != null && walWorkDir != null)
+            return !walArchiveDir.equals(walWorkDir);
+
+        return !new File(dsCfg.getWalArchivePath()).equals(new File(dsCfg.getWalPath()));
+    }
 }
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalReplayingAfterRestartTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalReplayingAfterRestartTest.java
new file mode 100644
index 0000000..db7263f
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalReplayingAfterRestartTest.java
@@ -0,0 +1,178 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.persistence.db.wal;
+
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheRebalanceMode;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.pagemem.FullPageId;
+import org.apache.ignite.internal.pagemem.wal.WALIterator;
+import org.apache.ignite.internal.pagemem.wal.WALPointer;
+import org.apache.ignite.internal.pagemem.wal.record.PageSnapshot;
+import org.apache.ignite.internal.pagemem.wal.record.WALRecord;
+import org.apache.ignite.internal.pagemem.wal.record.delta.MetaPageUpdatePartitionDataRecord;
+import org.apache.ignite.internal.processors.cache.persistence.wal.reader.IgniteWalIteratorFactory;
+import org.apache.ignite.internal.processors.cache.persistence.wal.reader.IgniteWalIteratorFactory.IteratorParametersBuilder;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteBiTuple;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH;
+import static org.apache.ignite.internal.pagemem.wal.record.WALRecord.RecordPurpose.PHYSICAL;
+import static org.apache.ignite.internal.pagemem.wal.record.WALRecord.RecordType.CHECKPOINT_RECORD;
+
+/**
+ * Tests WAL replying after node restart when wal archiver is disabled.
+ */
+public class IgniteWalReplayingAfterRestartTest extends GridCommonAbstractTest {
+    /** */
+    public static final String CACHE_NAME = "test-cache";
+
+    /** */
+    public static final String CONSISTENT_ID = "wal-replying-after-restart-test";
+
+    /** */
+    public static final int SEGMENTS_CNT = 3;
+
+    /** */
+    public static final int PART_NUM = 32;
+
+    /** */
+    @Before
+    public void beforeIgniteWalReplayingAfterRestartTest() throws Exception {
+        U.delete(Paths.get(U.defaultWorkDirectory()));
+    }
+
+    /** */
+    @After
+    public void afterIgniteWalReplayingAfterRestartTest() throws Exception {
+        stopAllGrids();
+
+        U.delete(Paths.get(U.defaultWorkDirectory()));
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception
{
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        CacheConfiguration<Integer, byte[]> ccfg = new CacheConfiguration<>(CACHE_NAME);
+
+        ccfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
+        ccfg.setRebalanceMode(CacheRebalanceMode.SYNC);
+        ccfg.setAffinity(new RendezvousAffinityFunction(false, PART_NUM));
+
+        cfg.setCacheConfiguration(ccfg);
+
+        DataStorageConfiguration dbCfg = new DataStorageConfiguration()
+            .setWalMode(WALMode.LOG_ONLY)
+            .setWalSegments(SEGMENTS_CNT)
+            .setWalSegmentSize(512 * 1024)
+            .setWalHistorySize(100)
+            .setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+                    .setPersistenceEnabled(true)
+                    .setCheckpointPageBufferSize(4L * 1024 * 1024 * 1024))
+            // disable WAL archiver
+            .setWalArchivePath(DFLT_WAL_PATH)
+            .setWalPath(DFLT_WAL_PATH)
+            .setCheckpointFrequency(1_000_000);
+
+        cfg.setDataStorageConfiguration(dbCfg);
+
+        cfg.setConsistentId(CONSISTENT_ID);
+
+        return cfg;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    @Test
+    public void testWalRecordsAfterRestart() throws Exception {
+        IgniteEx ignite = startGrid(0);
+
+        ignite.cluster().active(true);
+
+        IgniteCache<Integer, byte[]> cache = ignite.getOrCreateCache(CACHE_NAME);
+
+        int key = 0;
+
+        while (ignite.context().cache().context().wal().lastArchivedSegment() < SEGMENTS_CNT)
+            cache.put(key++ % PART_NUM, new byte[1024]);
+
+        ignite.context().cache().context().database().waitForCheckpoint("test-checkpoint");
+
+        long lastArchived = ignite.context().cache().context().wal().lastArchivedSegment();
+
+        while (ignite.context().cache().context().wal().lastArchivedSegment() < lastArchived
+ 1)
+            cache.put(key++ % PART_NUM, new byte[1024]);
+
+        stopGrid(0);
+
+        // There are no exceptions should be thrown here.
+        ignite = startGrid(0);
+
+        ignite.cluster().active();
+
+        // delta records should always follow PageSnapshot records.
+        String workDir = U.defaultWorkDirectory();
+
+        IteratorParametersBuilder builder = new IteratorParametersBuilder()
+            .filesOrDirs(workDir)
+            .filter((rec, ptr) -> rec.purpose() == PHYSICAL);
+
+        Map<FullPageId, PageSnapshot> snapshots = new HashMap<>();
+
+        try (WALIterator it = new IgniteWalIteratorFactory().iterator(builder)) {
+            while (it.hasNext()) {
+                IgniteBiTuple<WALPointer, WALRecord> tup = it.next();
+
+                WALRecord rec = tup.get2();
+
+                if (rec.type() == CHECKPOINT_RECORD)
+                    snapshots.clear();
+
+                // let's check partition meta pages.
+                if (rec instanceof PageSnapshot) {
+                    PageSnapshot snpRec = (PageSnapshot)rec;
+
+                    assertFalse(snapshots.containsKey(snpRec.fullPageId()));
+
+                    snapshots.put(snpRec.fullPageId(), snpRec);
+                }
+                else if (rec instanceof MetaPageUpdatePartitionDataRecord) {
+                    MetaPageUpdatePartitionDataRecord metaRec = (MetaPageUpdatePartitionDataRecord)rec;
+
+                    assertTrue(snapshots.containsKey(metaRec.fullPageId()));
+                }
+            }
+        }
+    }
+}
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite2.java
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite2.java
index 8f7be9a..b064380 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite2.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite2.java
@@ -61,6 +61,7 @@ import org.apache.ignite.internal.processors.cache.persistence.db.wal.IgniteWalF
 import org.apache.ignite.internal.processors.cache.persistence.db.wal.IgniteWalHistoryReservationsTest;
 import org.apache.ignite.internal.processors.cache.persistence.db.wal.IgniteWalIteratorExceptionDuringReadTest;
 import org.apache.ignite.internal.processors.cache.persistence.db.wal.IgniteWalIteratorSwitchSegmentTest;
+import org.apache.ignite.internal.processors.cache.persistence.db.wal.IgniteWalReplayingAfterRestartTest;
 import org.apache.ignite.internal.processors.cache.persistence.db.wal.IgniteWalSerializerVersionTest;
 import org.apache.ignite.internal.processors.cache.persistence.db.wal.WalCompactionSwitchOnTest;
 import org.apache.ignite.internal.processors.cache.persistence.db.wal.WalCompactionTest;
@@ -190,6 +191,8 @@ public class IgnitePdsTestSuite2 {
         GridTestUtils.addTestIfNeeded(suite, IgnitePdsReserveWalSegmentsTest.class, ignoredTests);
         GridTestUtils.addTestIfNeeded(suite, IgnitePdsReserveWalSegmentsWithCompactionTest.class,
ignoredTests);
 
+        GridTestUtils.addTestIfNeeded(suite, IgniteWalReplayingAfterRestartTest.class, ignoredTests);
+
         // new style folders with generated consistent ID test
         GridTestUtils.addTestIfNeeded(suite, IgniteUidAsConsistentIdMigrationTest.class,
ignoredTests);
 


Mime
View raw message