ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [1/3] ignite git commit: IGNITE-9420 Move logical recovery outside of PME - Fixes #5067.
Date Thu, 01 Nov 2018 17:17:05 GMT
Repository: ignite
Updated Branches:
  refs/heads/master db05c8bb2 -> c076aee4e


http://git-wip-us.apache.org/repos/asf/ignite/blob/c076aee4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
index 61b1f65..1cc2bf3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
@@ -81,9 +81,12 @@ import org.apache.ignite.internal.pagemem.wal.WALIterator;
 import org.apache.ignite.internal.pagemem.wal.WALPointer;
 import org.apache.ignite.internal.pagemem.wal.record.CheckpointRecord;
 import org.apache.ignite.internal.pagemem.wal.record.MarshalledRecord;
+import org.apache.ignite.internal.pagemem.wal.record.MemoryRecoveryRecord;
+import org.apache.ignite.internal.pagemem.wal.record.PageSnapshot;
 import org.apache.ignite.internal.pagemem.wal.record.RolloverType;
 import org.apache.ignite.internal.pagemem.wal.record.SwitchSegmentRecord;
 import org.apache.ignite.internal.pagemem.wal.record.WALRecord;
+import org.apache.ignite.internal.pagemem.wal.record.delta.PageDeltaRecord;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedManagerAdapter;
 import org.apache.ignite.internal.processors.cache.WalStateManager.WALDisableContext;
@@ -529,6 +532,23 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
     }
 
     /**
+     *
+     */
+    private void startArchiverAndCompressor() {
+        if (isArchiverEnabled()) {
+            assert archiver != null;
+
+            new IgniteThread(archiver).start();
+        }
+
+        if (walSegmentSyncWorker != null)
+            new IgniteThread(walSegmentSyncWorker).start();
+
+        if (compressor != null)
+            compressor.start();
+    }
+
+    /**
      * Archiver can be not created, all files will be written to WAL folder, using absolute segment index.
      *
      * @return flag indicating if archiver is disabled.
@@ -627,11 +647,17 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
             if (archiver != null)
                 archiver.shutdown();
 
-            if (compressor != null)
+            if (compressor != null) {
                 compressor.shutdown();
 
-            if (decompressor != null)
+                compressor = null;
+            }
+
+            if (decompressor != null) {
                 decompressor.shutdown();
+
+                decompressor = null;
+            }
         }
         catch (Exception e) {
             U.error(log, "Failed to gracefully close WAL segment: " + this.currHnd.fileIO, e);
@@ -645,20 +671,6 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
                 " topVer=" + cctx.discovery().topologyVersionEx() + " ]");
 
         start0();
-
-        if (!cctx.kernalContext().clientNode()) {
-            if (isArchiverEnabled()) {
-                assert archiver != null;
-
-                new IgniteThread(archiver).start();
-            }
-
-            if (walSegmentSyncWorker != null)
-                new IgniteThread(walSegmentSyncWorker).start();
-
-            if (compressor != null)
-                compressor.start();
-        }
     }
 
     /** {@inheritDoc} */
@@ -686,6 +698,9 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
     @Override public void resumeLogging(WALPointer lastPtr) throws IgniteCheckedException {
         assert currHnd == null;
         assert lastPtr == null || lastPtr instanceof FileWALPointer;
+
+        startArchiverAndCompressor();
+
         assert (isArchiverEnabled() && archiver != null) || (!isArchiverEnabled() && archiver == null) :
             "Trying to restore FileWriteHandle on deactivated write ahead log manager";
 
@@ -809,6 +824,11 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
         if (serializer == null || mode == WALMode.NONE)
             return null;
 
+        // Only delta-records, page snapshots and memory recovery are allowed to write in recovery mode.
+        if (cctx.kernalContext().recoveryMode() &&
+            !(rec instanceof PageDeltaRecord || rec instanceof PageSnapshot || rec instanceof MemoryRecoveryRecord))
+            return null;
+
         FileWriteHandle currWrHandle = currentHandle();
 
         WALDisableContext isDisable = walDisableContext;
@@ -1772,7 +1792,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
                         blockingSectionEnd();
                     }
 
-                    if (evt.isRecordable(EVT_WAL_SEGMENT_ARCHIVED)) {
+                    if (evt.isRecordable(EVT_WAL_SEGMENT_ARCHIVED) && !cctx.kernalContext().recoveryMode()) {
                         evt.record(new WalSegmentArchivedEvent(
                             cctx.discovery().localNode(),
                             res.getAbsIdx(),
@@ -2011,6 +2031,8 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
                 for (FileCompressorWorker worker: workers)
                     U.join(worker);
 
+                workers.clear();
+
                 U.cancel(this);
             }
 
@@ -2084,7 +2106,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
                             f0.force();
                         }
 
-                        if (evt.isRecordable(EVT_WAL_SEGMENT_COMPACTED)) {
+                        if (evt.isRecordable(EVT_WAL_SEGMENT_COMPACTED) && !cctx.kernalContext().recoveryMode()) {
                             evt.record(new WalSegmentCompactedEvent(
                                     cctx.localNode(),
                                     segIdx,

http://git-wip-us.apache.org/repos/asf/ignite/blob/c076aee4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FsyncModeFileWriteAheadLogManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FsyncModeFileWriteAheadLogManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FsyncModeFileWriteAheadLogManager.java
index def9bf2..c74c7ef 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FsyncModeFileWriteAheadLogManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FsyncModeFileWriteAheadLogManager.java
@@ -76,9 +76,12 @@ import org.apache.ignite.internal.pagemem.wal.IgniteWriteAheadLogManager;
 import org.apache.ignite.internal.pagemem.wal.WALIterator;
 import org.apache.ignite.internal.pagemem.wal.WALPointer;
 import org.apache.ignite.internal.pagemem.wal.record.MarshalledRecord;
+import org.apache.ignite.internal.pagemem.wal.record.MemoryRecoveryRecord;
+import org.apache.ignite.internal.pagemem.wal.record.PageSnapshot;
 import org.apache.ignite.internal.pagemem.wal.record.RolloverType;
 import org.apache.ignite.internal.pagemem.wal.record.SwitchSegmentRecord;
 import org.apache.ignite.internal.pagemem.wal.record.WALRecord;
+import org.apache.ignite.internal.pagemem.wal.record.delta.PageDeltaRecord;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedManagerAdapter;
 import org.apache.ignite.internal.processors.cache.WalStateManager.WALDisableContext;
@@ -443,6 +446,20 @@ public class FsyncModeFileWriteAheadLogManager extends GridCacheSharedManagerAda
     }
 
     /**
+     *
+     */
+    private void startArchiverAndCompressor() {
+        if (isArchiverEnabled()) {
+            assert archiver != null;
+
+            new IgniteThread(archiver).start();
+        }
+
+        if (compressor != null)
+            compressor.start();
+    }
+
+    /**
      * @throws IgniteCheckedException if WAL store path is configured and archive path isn't (or vice versa)
      */
     private void checkWalConfiguration() throws IgniteCheckedException {
@@ -481,11 +498,17 @@ public class FsyncModeFileWriteAheadLogManager extends GridCacheSharedManagerAda
             if (archiver != null)
                 archiver.shutdown();
 
-            if (compressor != null)
+            if (compressor != null) {
                 compressor.shutdown();
 
-            if (decompressor != null)
+                compressor = null;
+            }
+
+            if (decompressor != null) {
                 decompressor.shutdown();
+
+                decompressor = null;
+            }
         }
         catch (Exception e) {
             U.error(log, "Failed to gracefully close WAL segment: " + currentHnd.fileIO, e);
@@ -499,17 +522,6 @@ public class FsyncModeFileWriteAheadLogManager extends GridCacheSharedManagerAda
                 " topVer=" + cctx.discovery().topologyVersionEx() + " ]");
 
         start0();
-
-        if (!cctx.kernalContext().clientNode()) {
-            if (isArchiverEnabled()) {
-                assert archiver != null;
-
-                new IgniteThread(archiver).start();
-            }
-
-            if (compressor != null)
-                compressor.start();
-        }
     }
 
     /** {@inheritDoc} */
@@ -537,6 +549,9 @@ public class FsyncModeFileWriteAheadLogManager extends GridCacheSharedManagerAda
     @Override public void resumeLogging(WALPointer lastPtr) throws IgniteCheckedException {
         assert currentHnd == null;
         assert lastPtr == null || lastPtr instanceof FileWALPointer;
+
+        startArchiverAndCompressor();
+
         assert (isArchiverEnabled() && archiver != null) || (!isArchiverEnabled() && archiver == null) :
             "Trying to restore FileWriteHandle on deactivated write ahead log manager";
 
@@ -701,6 +716,11 @@ public class FsyncModeFileWriteAheadLogManager extends GridCacheSharedManagerAda
         if (serializer == null || mode == WALMode.NONE)
             return null;
 
+        // Only delta-records, page snapshots and memory recovery are allowed to write in recovery mode.
+        if (cctx.kernalContext().recoveryMode() &&
+            !(record instanceof PageDeltaRecord || record instanceof PageSnapshot || record instanceof MemoryRecoveryRecord))
+            return null;
+
         FileWriteHandle currWrHandle = currentHandle();
 
         WALDisableContext isDisable = walDisableContext;
@@ -1649,7 +1669,7 @@ public class FsyncModeFileWriteAheadLogManager extends GridCacheSharedManagerAda
                         notifyAll();
                     }
 
-                    if (evt.isRecordable(EventType.EVT_WAL_SEGMENT_ARCHIVED)) {
+                    if (evt.isRecordable(EventType.EVT_WAL_SEGMENT_ARCHIVED) && !cctx.kernalContext().recoveryMode()) {
                         evt.record(new WalSegmentArchivedEvent(cctx.discovery().localNode(),
                             res.getAbsIdx(), res.getDstArchiveFile()));
                     }
@@ -2015,7 +2035,7 @@ public class FsyncModeFileWriteAheadLogManager extends GridCacheSharedManagerAda
                             f0.force();
                         }
 
-                        if (evt.isRecordable(EVT_WAL_SEGMENT_COMPACTED)) {
+                        if (evt.isRecordable(EVT_WAL_SEGMENT_COMPACTED) && !cctx.kernalContext().recoveryMode()) {
                             evt.record(new WalSegmentCompactedEvent(
                                 cctx.discovery().localNode(),
                                 currReservedSegment,

http://git-wip-us.apache.org/repos/asf/ignite/blob/c076aee4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StandaloneGridKernalContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StandaloneGridKernalContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StandaloneGridKernalContext.java
index 6d379a9..e70a027 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StandaloneGridKernalContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StandaloneGridKernalContext.java
@@ -653,6 +653,11 @@ public class StandaloneGridKernalContext implements GridKernalContext {
     }
 
     /** {@inheritDoc} */
+    @Override public boolean recoveryMode() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
     @Override public PdsFoldersResolver pdsFolderResolver() {
         return new PdsFoldersResolver() {
             /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/c076aee4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/serializer/RecordDataV1Serializer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/serializer/RecordDataV1Serializer.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/serializer/RecordDataV1Serializer.java
index 2c8f03f..ee40039 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/serializer/RecordDataV1Serializer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/serializer/RecordDataV1Serializer.java
@@ -221,7 +221,7 @@ public class RecordDataV1Serializer implements RecordDataSerializer {
      * @return {@code True} if this record should be encrypted.
      */
     private boolean needEncryption(WALRecord rec) {
-        if (!(rec instanceof WalRecordCacheGroupAware))
+        if (!(rec instanceof WalRecordCacheGroupAware) || rec instanceof MetastoreDataRecord)
             return false;
 
         return needEncryption(((WalRecordCacheGroupAware)rec).groupId());
@@ -1925,7 +1925,7 @@ public class RecordDataV1Serializer implements RecordDataSerializer {
      */
     boolean isDataRecordEncrypted(DataRecord rec) {
         for (DataEntry e : rec.writeEntries()) {
-            if(needEncryption(cctx.cacheContext(e.cacheId()).groupId()))
+            if (cctx.cacheContext(e.cacheId()) != null && needEncryption(cctx.cacheContext(e.cacheId()).groupId()))
                 return true;
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c076aee4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java
index 87d7d16..90d4e4e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java
@@ -1378,7 +1378,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest
             GridCacheProcessor cache = ((IgniteEx)ignite(i)).context().cache();
 
             assertTrue(cache.caches().isEmpty());
-            assertTrue(cache.internalCaches().isEmpty());
+            assertTrue(cache.internalCaches().stream().allMatch(c -> c.context().isRecoveryMode()));
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/c076aee4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsBinaryMetadataOnClusterRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsBinaryMetadataOnClusterRestartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsBinaryMetadataOnClusterRestartTest.java
index e9d9b9e..9121cca 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsBinaryMetadataOnClusterRestartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsBinaryMetadataOnClusterRestartTest.java
@@ -72,6 +72,8 @@ public class IgnitePdsBinaryMetadataOnClusterRestartTest extends GridCommonAbstr
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(gridName);
 
+        cfg.setConsistentId(gridName);
+
         if (customWorkSubDir != null)
             cfg.setWorkDirectory(Paths.get(U.defaultWorkDirectory(), customWorkSubDir).toString());
 
@@ -356,8 +358,8 @@ public class IgnitePdsBinaryMetadataOnClusterRestartTest extends GridCommonAbstr
     ) throws Exception {
         String workDir = U.defaultWorkDirectory();
 
-        Path fromFile = Paths.get(workDir, fromWorkDir, "binary_meta", "node00-" + fromConsId, fileName);
-        Path toFile = Paths.get(workDir, toWorkDir, "binary_meta", "node00-" + toConsId, fileName);
+        Path fromFile = Paths.get(workDir, fromWorkDir, "binary_meta", fromConsId, fileName);
+        Path toFile = Paths.get(workDir, toWorkDir, "binary_meta", toConsId, fileName);
 
         Files.copy(fromFile, toFile, StandardCopyOption.REPLACE_EXISTING);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/c076aee4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCorruptedIndexTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCorruptedIndexTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCorruptedIndexTest.java
index 14d0fb6..da19285 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCorruptedIndexTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCorruptedIndexTest.java
@@ -318,16 +318,6 @@ public class IgnitePdsCorruptedIndexTest extends GridCommonAbstractTest {
         }
 
         /** {@inheritDoc} */
-        @Override public FileIO create(File file) throws IOException {
-            FileIO delegate = delegateFactory.create(file);
-
-            if (isPartitionFile(file))
-                return new HaltOnTruncateFileIO(delegate, file);
-
-            return delegate;
-        }
-
-        /** {@inheritDoc} */
         @Override public FileIO create(File file, OpenOption... modes) throws IOException {
             FileIO delegate = delegateFactory.create(file, modes);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c076aee4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCorruptedStoreTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCorruptedStoreTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCorruptedStoreTest.java
index 059b5ee..39faf5a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCorruptedStoreTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCorruptedStoreTest.java
@@ -54,9 +54,6 @@ import org.apache.ignite.lang.IgniteBiClosure;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
-import static java.nio.file.StandardOpenOption.CREATE;
-import static java.nio.file.StandardOpenOption.READ;
-import static java.nio.file.StandardOpenOption.WRITE;
 import static org.apache.ignite.IgniteSystemProperties.IGNITE_PDS_SKIP_CRC;
 import static org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.DFLT_STORE_DIR;
 import static org.apache.ignite.internal.processors.cache.persistence.metastorage.MetaStorage.METASTORAGE_CACHE_ID;
@@ -180,6 +177,9 @@ public class IgnitePdsCorruptedStoreTest extends GridCommonAbstractTest {
             startGrid(0);
         }
         catch (IgniteCheckedException ex) {
+            if (X.hasCause(ex, StorageException.class, IOException.class))
+                return; // Success;
+
             throw ex;
         }
 
@@ -459,11 +459,6 @@ public class IgnitePdsCorruptedStoreTest extends GridCommonAbstractTest {
         private volatile IgniteBiClosure<File, OpenOption[], FileIO> createClo;
 
         /** {@inheritDoc} */
-        @Override public FileIO create(File file) throws IOException {
-            return create(file, CREATE, READ, WRITE);
-        }
-
-        /** {@inheritDoc} */
         @Override public FileIO create(File file, OpenOption... openOption) throws IOException {
             FileIO fileIO = null;
             if (createClo != null)

http://git-wip-us.apache.org/repos/asf/ignite/blob/c076aee4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsPartitionFilesDestroyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsPartitionFilesDestroyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsPartitionFilesDestroyTest.java
index 3605700..578692c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsPartitionFilesDestroyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsPartitionFilesDestroyTest.java
@@ -450,16 +450,6 @@ public class IgnitePdsPartitionFilesDestroyTest extends GridCommonAbstractTest {
         }
 
         /** {@inheritDoc} */
-        @Override public FileIO create(File file) throws IOException {
-            FileIO delegate = delegateFactory.create(file);
-
-            if (isPartitionFile(file))
-                return new FailingFileIO(delegate);
-
-            return delegate;
-        }
-
-        /** {@inheritDoc} */
         @Override public FileIO create(File file, OpenOption... modes) throws IOException {
             FileIO delegate = delegateFactory.create(file, modes);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c076aee4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsTaskCancelingTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsTaskCancelingTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsTaskCancelingTest.java
index b36bac0..6b457ef 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsTaskCancelingTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsTaskCancelingTest.java
@@ -288,11 +288,6 @@ public class IgnitePdsTaskCancelingTest extends GridCommonAbstractTest {
         private final FileIOFactory delegateFactory = new RandomAccessFileIOFactory();
 
         /** {@inheritDoc} */
-        @Override public FileIO create(File file) throws IOException {
-            return create(file, CREATE, READ, WRITE);
-        }
-
-        /** {@inheritDoc} */
         @Override public FileIO create(File file, OpenOption... openOption) throws IOException {
             final FileIO delegate = delegateFactory.create(file, openOption);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c076aee4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/LocalWalModeChangeDuringRebalancingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/LocalWalModeChangeDuringRebalancingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/LocalWalModeChangeDuringRebalancingSelfTest.java
index 4dd5f51..48b60d4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/LocalWalModeChangeDuringRebalancingSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/LocalWalModeChangeDuringRebalancingSelfTest.java
@@ -546,11 +546,6 @@ public class LocalWalModeChangeDuringRebalancingSelfTest extends GridCommonAbstr
         }
 
         /** {@inheritDoc} */
-        @Override public FileIO create(File file) throws IOException {
-            return new TestFileIO(delegate.create(file));
-        }
-
-        /** {@inheritDoc} */
         @Override public FileIO create(File file, OpenOption... modes) throws IOException {
             return new TestFileIO(delegate.create(file, modes));
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/c076aee4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/CheckpointBufferDeadlockTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/CheckpointBufferDeadlockTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/CheckpointBufferDeadlockTest.java
index 3afafe6..f58d02d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/CheckpointBufferDeadlockTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/CheckpointBufferDeadlockTest.java
@@ -336,11 +336,6 @@ public class CheckpointBufferDeadlockTest extends GridCommonAbstractTest {
         private final FileIOFactory delegateFactory = new RandomAccessFileIOFactory();
 
         /** {@inheritDoc} */
-        @Override public FileIO create(File file) throws IOException {
-            return create(file, CREATE, READ, WRITE);
-        }
-
-        /** {@inheritDoc} */
         @Override public FileIO create(File file, OpenOption... openOption) throws IOException {
             final FileIO delegate = delegateFactory.create(file, openOption);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c076aee4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgniteLogicalRecoveryTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgniteLogicalRecoveryTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgniteLogicalRecoveryTest.java
new file mode 100644
index 0000000..584196f
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgniteLogicalRecoveryTest.java
@@ -0,0 +1,577 @@
+/*
+ * 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;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.file.OpenOption;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.atomic.AtomicBoolean;
+import com.google.common.collect.Lists;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+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.failure.FailureHandler;
+import org.apache.ignite.failure.StopNodeFailureHandler;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager;
+import org.apache.ignite.internal.processors.cache.persistence.file.FileIO;
+import org.apache.ignite.internal.processors.cache.persistence.file.FileIODecorator;
+import org.apache.ignite.internal.processors.cache.persistence.file.FileIOFactory;
+import org.apache.ignite.internal.processors.cache.persistence.file.RandomAccessFileIOFactory;
+import org.apache.ignite.internal.processors.cache.persistence.wal.memtracker.PageMemoryTrackerConfiguration;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.jetbrains.annotations.Nullable;
+import org.junit.Assert;
+
+/**
+ * A set of tests that check correctness of logical recovery performed during node start.
+ */
+public class IgniteLogicalRecoveryTest extends GridCommonAbstractTest {
+    /** Shared group name. */
+    private static final String SHARED_GROUP_NAME = "group";
+
+    /** Dynamic cache prefix. */
+    private static final String DYNAMIC_CACHE_PREFIX = "dynamic-cache-";
+
+    /** Cache prefix. */
+    private static final String CACHE_PREFIX = "cache-";
+
+    /** Io factory. */
+    private FileIOFactory ioFactory;
+
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+        cfg.setConsistentId(igniteInstanceName);
+
+        cfg.setCacheConfiguration(
+            cacheConfiguration(CACHE_PREFIX + 0, CacheMode.PARTITIONED, CacheAtomicityMode.ATOMIC),
+            cacheConfiguration(CACHE_PREFIX + 1, CacheMode.PARTITIONED, CacheAtomicityMode.TRANSACTIONAL),
+            cacheConfiguration(CACHE_PREFIX + 2, CacheMode.REPLICATED, CacheAtomicityMode.ATOMIC),
+            cacheConfiguration(CACHE_PREFIX + 3, CacheMode.REPLICATED, CacheAtomicityMode.TRANSACTIONAL),
+            cacheConfiguration(CACHE_PREFIX + 4, SHARED_GROUP_NAME, CacheMode.PARTITIONED, CacheAtomicityMode.TRANSACTIONAL),
+            cacheConfiguration(CACHE_PREFIX + 5, SHARED_GROUP_NAME, CacheMode.PARTITIONED, CacheAtomicityMode.TRANSACTIONAL)
+        );
+
+        DataStorageConfiguration dsCfg = new DataStorageConfiguration()
+            .setAlwaysWriteFullPages(true)
+            .setWalMode(WALMode.LOG_ONLY)
+            .setCheckpointFrequency(1024 * 1024 * 1024) // Disable automatic checkpoints.
+            .setDefaultDataRegionConfiguration(
+                new DataRegionConfiguration()
+                    .setName("dflt")
+                    .setInitialSize(256 * 1024 * 1024)
+                    .setMaxSize(256 * 1024 * 1024)
+                    .setPersistenceEnabled(true)
+            );
+
+        cfg.setDataStorageConfiguration(dsCfg);
+
+        if (ioFactory != null)
+            dsCfg.setFileIOFactory(ioFactory);
+
+        cfg.setPluginConfigurations(new PageMemoryTrackerConfiguration().setEnabled(false).setCheckPagesOnCheckpoint(true));
+
+        return cfg;
+    }
+
+    /**
+     * @param name Name.
+     * @param cacheMode Cache mode.
+     * @param atomicityMode Atomicity mode.
+     */
+    private CacheConfiguration<Object, Object> cacheConfiguration(String name, CacheMode cacheMode, CacheAtomicityMode atomicityMode) {
+        return cacheConfiguration(name, null, cacheMode, atomicityMode);
+    }
+
+    /**
+     * @param name Name.
+     * @param groupName Group name.
+     * @param cacheMode Cache mode.
+     * @param atomicityMode Atomicity mode.
+     */
+    private CacheConfiguration<Object, Object> cacheConfiguration(String name, @Nullable String groupName, CacheMode cacheMode, CacheAtomicityMode atomicityMode) {
+        CacheConfiguration<Object, Object> cfg = new CacheConfiguration<>();
+
+        cfg.setGroupName(groupName);
+        cfg.setName(name);
+        cfg.setCacheMode(cacheMode);
+        cfg.setAtomicityMode(atomicityMode);
+        cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
+        cfg.setBackups(2);
+        cfg.setAffinity(new RendezvousAffinityFunction(false, 32));
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        stopAllGrids();
+
+        cleanPersistenceDir();
+
+        System.setProperty(GridCacheDatabaseSharedManager.IGNITE_PDS_SKIP_CHECKPOINT_ON_NODE_STOP, "true");
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids();
+
+        cleanPersistenceDir();
+
+        System.clearProperty(GridCacheDatabaseSharedManager.IGNITE_PDS_SKIP_CHECKPOINT_ON_NODE_STOP);
+    }
+
+    /**
+     *
+     */
+    public void testRecoveryOnJoinToActiveCluster() throws Exception {
+        IgniteEx crd = (IgniteEx) startGridsMultiThreaded(3);
+
+        crd.cluster().active(true);
+
+        IgniteEx node = grid(2);
+
+        AggregateCacheLoader aggCacheLoader = new AggregateCacheLoader(node);
+
+        aggCacheLoader.start();
+
+        U.sleep(3000);
+
+        forceCheckpoint();
+
+        U.sleep(3000);
+
+        aggCacheLoader.stop();
+
+        stopGrid(2, true);
+
+        startGrid(2);
+
+        awaitPartitionMapExchange();
+
+        aggCacheLoader.consistencyCheck(grid(2));
+    }
+
+    /**
+     *
+     */
+    public void testRecoveryOnJoinToInactiveCluster() throws Exception {
+        IgniteEx crd = (IgniteEx) startGridsMultiThreaded(3);
+
+        crd.cluster().active(true);
+
+        IgniteEx node = grid(2);
+
+        AggregateCacheLoader aggCacheLoader = new AggregateCacheLoader(node);
+
+        aggCacheLoader.start();
+
+        U.sleep(3000);
+
+        forceCheckpoint();
+
+        U.sleep(3000);
+
+        aggCacheLoader.stop();
+
+        stopGrid(2, true);
+
+        crd.cluster().active(false);
+
+        startGrid(2);
+
+        crd.cluster().active(true);
+
+        awaitPartitionMapExchange();
+
+        aggCacheLoader.consistencyCheck(grid(2));
+    }
+
+    /**
+     *
+     */
+    public void testRecoveryOnDynamicallyStartedCaches() throws Exception {
+        List<CacheConfiguration> dynamicCaches = Lists.newArrayList(
+            cacheConfiguration(DYNAMIC_CACHE_PREFIX + 0, CacheMode.PARTITIONED, CacheAtomicityMode.TRANSACTIONAL),
+            cacheConfiguration(DYNAMIC_CACHE_PREFIX + 1, CacheMode.REPLICATED, CacheAtomicityMode.TRANSACTIONAL),
+            cacheConfiguration(DYNAMIC_CACHE_PREFIX + 2, CacheMode.PARTITIONED, CacheAtomicityMode.ATOMIC),
+            cacheConfiguration(DYNAMIC_CACHE_PREFIX + 3, CacheMode.REPLICATED, CacheAtomicityMode.ATOMIC)
+        );
+
+        doTestWithDynamicCaches(dynamicCaches);
+    }
+
+    /**
+     *
+     */
+    public void testRecoveryWithMvccCaches() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-10052");
+
+        List<CacheConfiguration> dynamicCaches = Lists.newArrayList(
+            cacheConfiguration(DYNAMIC_CACHE_PREFIX + 0, CacheMode.PARTITIONED, CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT),
+            cacheConfiguration(DYNAMIC_CACHE_PREFIX + 1, CacheMode.REPLICATED, CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT)
+        );
+
+        doTestWithDynamicCaches(dynamicCaches);
+    }
+
+    /**
+     * @param dynamicCaches Dynamic caches.
+     */
+    private void doTestWithDynamicCaches(List<CacheConfiguration> dynamicCaches) throws Exception {
+        IgniteEx crd = (IgniteEx) startGridsMultiThreaded(3);
+
+        crd.cluster().active(true);
+
+        IgniteEx node = grid(2);
+
+        node.getOrCreateCaches(dynamicCaches);
+
+        AggregateCacheLoader aggCacheLoader = new AggregateCacheLoader(node);
+
+        aggCacheLoader.start();
+
+        U.sleep(3000);
+
+        forceCheckpoint();
+
+        U.sleep(3000);
+
+        aggCacheLoader.stop();
+
+        stopGrid(2, true);
+
+        startGrid(2);
+
+        awaitPartitionMapExchange();
+
+        for (int idx = 0; idx < 3; idx++)
+            aggCacheLoader.consistencyCheck(grid(idx));
+    }
+
+    /**
+     *
+     */
+    public void testRecoveryOnJoinToDifferentBlt() throws Exception {
+        IgniteEx crd = (IgniteEx) startGridsMultiThreaded(3);
+
+        crd.cluster().active(true);
+
+        IgniteEx node = grid(2);
+
+        AggregateCacheLoader aggCacheLoader = new AggregateCacheLoader(node);
+
+        aggCacheLoader.start();
+
+        U.sleep(3000);
+
+        forceCheckpoint();
+
+        U.sleep(3000);
+
+        aggCacheLoader.stop();
+
+        stopGrid(2, true);
+
+        resetBaselineTopology();
+
+        startGrid(2);
+
+        resetBaselineTopology();
+
+        awaitPartitionMapExchange();
+
+        for (int idx = 0; idx < 3; idx++)
+            aggCacheLoader.consistencyCheck(grid(idx));
+    }
+
+    /**
+     *
+     */
+    public void testRecoveryOnCrushDuringCheckpointOnNodeStart() throws Exception {
+        // Crash recovery fails because of the bug in pages recycling.
+        // Test passes if don't perform removes in cache loader.
+        fail("https://issues.apache.org/jira/browse/IGNITE-9303");
+
+        IgniteEx crd = (IgniteEx) startGridsMultiThreaded(3, false);
+
+        crd.cluster().active(true);
+
+        IgniteEx node = grid(2);
+
+        AggregateCacheLoader aggCacheLoader = new AggregateCacheLoader(node);
+
+        aggCacheLoader.start();
+
+        U.sleep(3000);
+
+        forceCheckpoint();
+
+        U.sleep(3000);
+
+        aggCacheLoader.stop();
+
+        stopGrid(2, false);
+
+        ioFactory = new CheckpointFailIoFactory();
+
+        IgniteInternalFuture startNodeFut = GridTestUtils.runAsync(() -> startGrid(2));
+
+        try {
+            startNodeFut.get();
+        }
+        catch (Exception expected) { }
+
+        ioFactory = null;
+
+        // Start node again and check recovery.
+        startGrid(2);
+
+        awaitPartitionMapExchange();
+
+        for (int idx = 0; idx < 3; idx++)
+            aggCacheLoader.consistencyCheck(grid(idx));
+    }
+
+    /** {@inheritDoc} */
+    @Override protected FailureHandler getFailureHandler(String igniteInstanceName) {
+        return new StopNodeFailureHandler();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected long getTestTimeout() {
+        return 600 * 1000;
+    }
+
+    /**
+     *
+     */
+    private class AggregateCacheLoader {
+        /** Ignite. */
+        IgniteEx ignite;
+
+        /** Stop flag. */
+        AtomicBoolean stopFlag;
+
+        /** Cache loaders. */
+        Map<CacheLoader, IgniteInternalFuture> cacheLoaders;
+
+        /**
+         * @param ignite Ignite.
+         */
+        public AggregateCacheLoader(IgniteEx ignite) {
+            this.ignite = ignite;
+        }
+
+        /**
+         *
+         */
+        public void start() {
+            if (stopFlag != null && !stopFlag.get())
+                throw new IllegalStateException("Cache loaders must be stopped before start again");
+
+            stopFlag = new AtomicBoolean();
+            cacheLoaders = new HashMap<>();
+
+            for (String cacheName : ignite.cacheNames()) {
+                CacheLoader loader = new CacheLoader(ignite, stopFlag, cacheName);
+
+                IgniteInternalFuture loadFuture = GridTestUtils.runAsync(loader);
+
+                cacheLoaders.put(loader, loadFuture);
+            }
+        }
+
+        /**
+         *
+         */
+        public void stop() throws IgniteCheckedException {
+            if (stopFlag != null)
+                stopFlag.set(true);
+
+            if (cacheLoaders != null)
+                for (IgniteInternalFuture loadFuture : cacheLoaders.values())
+                    loadFuture.get();
+        }
+
+        /**
+         * @param ignite Ignite.
+         */
+        public void consistencyCheck(IgniteEx ignite) throws IgniteCheckedException {
+            if (cacheLoaders != null)
+                for (CacheLoader cacheLoader : cacheLoaders.keySet())
+                    cacheLoader.consistencyCheck(ignite);
+        }
+    }
+
+    /**
+     *
+     */
+    static class CacheLoader implements Runnable {
+        /** Keys space. */
+        static final int KEYS_SPACE = 3096;
+
+        /** Ignite. */
+        final IgniteEx ignite;
+
+        /** Stop flag. */
+        final AtomicBoolean stopFlag;
+
+        /** Cache name. */
+        final String cacheName;
+
+        /** Local cache. */
+        final Map<Object, Object> locCache = new ConcurrentHashMap<>();
+
+        /**
+         * @param ignite Ignite.
+         * @param stopFlag Stop flag.
+         * @param cacheName Cache name.
+         */
+        public CacheLoader(IgniteEx ignite, AtomicBoolean stopFlag, String cacheName) {
+            this.ignite = ignite;
+            this.stopFlag = stopFlag;
+            this.cacheName = cacheName;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void run() {
+            while (!stopFlag.get()) {
+                ThreadLocalRandom rnd = ThreadLocalRandom.current();
+
+                int key = rnd.nextInt(KEYS_SPACE);
+
+                boolean remove = rnd.nextInt(100) <= 20;
+
+                IgniteCache<Object, Object> cache = ignite.getOrCreateCache(cacheName);
+
+                try {
+                    if (remove) {
+                        cache.remove(key);
+
+                        locCache.remove(key);
+                    }
+                    else {
+                        int[] payload = new int[KEYS_SPACE];
+                        Arrays.fill(payload, key);
+
+                        cache.put(key, payload);
+
+                        locCache.put(key, payload);
+                    }
+                }
+                catch (Exception ignored) { }
+            }
+        }
+
+        /**
+         *
+         */
+        public void consistencyCheck(IgniteEx ignite) {
+            IgniteCache<Object, Object> cache = ignite.getOrCreateCache(cacheName);
+
+            for (int key = 0; key < KEYS_SPACE; key++) {
+                int[] expectedValue = (int[]) locCache.get(key);
+                int[] actualValue = (int[]) cache.get(key);
+
+                Assert.assertEquals("Consistency check failed for: " + cache.getName() + ", key=" + key,
+                    arrayToString(expectedValue), arrayToString(actualValue));
+            }
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean equals(Object o) {
+            if (this == o)
+                return true;
+            if (o == null || getClass() != o.getClass())
+                return false;
+
+            CacheLoader loader = (CacheLoader) o;
+
+            return Objects.equals(cacheName, loader.cacheName);
+        }
+
+        /** {@inheritDoc} */
+        @Override public int hashCode() {
+            return Objects.hash(cacheName);
+        }
+    }
+
+    /**
+     *
+     */
+    static class CheckpointFailIoFactory implements FileIOFactory {
+        /** {@inheritDoc} */
+        @Override public FileIO create(File file, OpenOption... modes) throws IOException {
+            FileIO delegate = new RandomAccessFileIOFactory().create(file, modes);
+
+            if (file.getName().contains("part-"))
+                return new FileIODecorator(delegate) {
+                    @Override public int write(ByteBuffer srcBuf) throws IOException {
+                        throw new IOException("test");
+                    }
+
+                    @Override public int write(ByteBuffer srcBuf, long position) throws IOException {
+                        throw new IOException("test");
+                    }
+
+                    @Override public int write(byte[] buf, int off, int len) throws IOException {
+                        throw new IOException("test");
+                    }
+                };
+
+            return delegate;
+        }
+    }
+
+    /**
+     * @param arr Array.
+     */
+    static String arrayToString(int[] arr) {
+        if (arr == null)
+            return "null";
+
+        StringBuilder sb = new StringBuilder();
+        sb.append('[');
+        for (int i = 0; i < Math.min(arr.length, 10); i++)
+            sb.append(i + ",");
+        sb.append(']');
+
+        return sb.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c076aee4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsDataRegionMetricsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsDataRegionMetricsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsDataRegionMetricsTest.java
index 4a22a2b..c05f65c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsDataRegionMetricsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsDataRegionMetricsTest.java
@@ -323,7 +323,8 @@ public class IgnitePdsDataRegionMetricsTest extends GridCommonAbstractTest {
             .memoryMetrics()
             .getTotalAllocatedPages();
 
-        assertEquals(totalPersistenceSize / pageStoreMgr.pageSize(), totalAllocatedPagesFromMetrics);
+        assertEquals("Number of allocated pages is different than in metrics for [node=" + node.name() + ", cache=" + cacheName + "]",
+            totalPersistenceSize / pageStoreMgr.pageSize(), totalAllocatedPagesFromMetrics);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/c076aee4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsDiskErrorsRecoveringTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsDiskErrorsRecoveringTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsDiskErrorsRecoveringTest.java
index 2f4e4a3..93c4047 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsDiskErrorsRecoveringTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsDiskErrorsRecoveringTest.java
@@ -38,6 +38,7 @@ import org.apache.ignite.failure.FailureHandler;
 import org.apache.ignite.failure.StopNodeFailureHandler;
 import org.apache.ignite.internal.GridKernalState;
 import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.IgniteInterruptedCheckedException;
 import org.apache.ignite.internal.processors.cache.persistence.file.FileIO;
 import org.apache.ignite.internal.processors.cache.persistence.file.FileIODecorator;
@@ -50,9 +51,6 @@ import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.junit.Assert;
 
-import static java.nio.file.StandardOpenOption.CREATE;
-import static java.nio.file.StandardOpenOption.READ;
-import static java.nio.file.StandardOpenOption.WRITE;
 import static org.apache.ignite.IgniteSystemProperties.IGNITE_WAL_MMAP;
 
 /**
@@ -95,6 +93,8 @@ public class IgnitePdsDiskErrorsRecoveringTest extends GridCommonAbstractTest {
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
+        cfg.setConsistentId(igniteInstanceName);
+
         DataStorageConfiguration dsCfg = new DataStorageConfiguration()
                 .setDefaultDataRegionConfiguration(
                         new DataRegionConfiguration().setMaxSize(100L * 1024 * 1024).setPersistenceEnabled(true))
@@ -127,27 +127,36 @@ public class IgnitePdsDiskErrorsRecoveringTest extends GridCommonAbstractTest {
         // Fail to initialize page store. 2 extra pages is needed for MetaStorage.
         ioFactory = new FilteringFileIOFactory(".bin", new LimitedSizeFileIOFactory(new RandomAccessFileIOFactory(), 2 * PAGE_SIZE));
 
-        final IgniteEx grid = startGrid(0);
-
         boolean failed = false;
+
+        IgniteInternalFuture startGridFut = GridTestUtils.runAsync(() -> {
+            try {
+                IgniteEx grid = startGrid(0);
+
+                grid.cluster().active(true);
+            }
+            catch (Exception e) {
+                throw new RuntimeException("Failed to start node.", e);
+            }
+        });
+
         try {
-            grid.cluster().active(true);
-        } catch (Exception expected) {
-            log.warning("Expected cache error", expected);
+            startGridFut.get();
+        }
+        catch (Exception e) {
+            Assert.assertTrue(e.getMessage().contains("Failed to start node."));
 
             failed = true;
         }
 
         Assert.assertTrue("Cache initialization must failed", failed);
 
-        // Grid should be automatically stopped after checkpoint fail.
-        awaitStop(grid);
-
         // Grid should be successfully recovered after stopping.
         ioFactory = null;
 
-        IgniteEx recoveredGrid = startGrid(0);
-        recoveredGrid.active(true);
+        IgniteEx grid = startGrid(0);
+
+        grid.cluster().active(true);
     }
 
     /**
@@ -315,7 +324,9 @@ public class IgnitePdsDiskErrorsRecoveringTest extends GridCommonAbstractTest {
     public void testRecoveringOnWALWritingFail1() throws Exception {
         // Allow to allocate only 1 wal segment, fail on write to second.
         ioFactory = new FilteringFileIOFactory(".wal", new LimitedSizeFileIOFactory(new RandomAccessFileIOFactory(), WAL_SEGMENT_SIZE));
+
         System.setProperty(IGNITE_WAL_MMAP, "true");
+
         doTestRecoveringOnWALWritingFail();
     }
 
@@ -325,7 +336,9 @@ public class IgnitePdsDiskErrorsRecoveringTest extends GridCommonAbstractTest {
     public void testRecoveringOnWALWritingFail2() throws Exception {
         // Fail somewhere on the second wal segment.
         ioFactory = new FilteringFileIOFactory(".wal", new LimitedSizeFileIOFactory(new RandomAccessFileIOFactory(), (long) (1.5 * WAL_SEGMENT_SIZE)));
+
         System.setProperty(IGNITE_WAL_MMAP, "false");
+
         doTestRecoveringOnWALWritingFail();
     }
 
@@ -333,18 +346,23 @@ public class IgnitePdsDiskErrorsRecoveringTest extends GridCommonAbstractTest {
      * Test node stopping & recovery on WAL writing fail.
      */
     private void doTestRecoveringOnWALWritingFail() throws Exception {
-        final IgniteEx grid = startGrid(0);
+        IgniteEx grid = startGrid(0);
 
         FileWriteAheadLogManager wal = (FileWriteAheadLogManager)grid.context().cache().context().wal();
+
         wal.setFileIOFactory(ioFactory);
 
         grid.cluster().active(true);
 
         int failedPosition = -1;
 
-        for (int i = 0; i < 1000; i++) {
+        final int keysCount = 2000;
+
+        final int dataSize = 2048;
+
+        for (int i = 0; i < keysCount; i++) {
             byte payload = (byte) i;
-            byte[] data = new byte[2048];
+            byte[] data = new byte[dataSize];
             Arrays.fill(data, payload);
 
             try {
@@ -358,7 +376,7 @@ public class IgnitePdsDiskErrorsRecoveringTest extends GridCommonAbstractTest {
         }
 
         // We must be able to put something into cache before fail.
-        Assert.assertTrue(failedPosition > 0);
+        Assert.assertTrue("One of the cache puts must be failed", failedPosition > 0);
 
         // Grid should be automatically stopped after WAL fail.
         awaitStop(grid);
@@ -366,15 +384,16 @@ public class IgnitePdsDiskErrorsRecoveringTest extends GridCommonAbstractTest {
         ioFactory = null;
 
         // Grid should be successfully recovered after stopping.
-        IgniteEx recoveredGrid = startGrid(0);
-        recoveredGrid.cluster().active(true);
+        grid = startGrid(0);
+
+        grid.cluster().active(true);
 
         for (int i = 0; i < failedPosition; i++) {
             byte payload = (byte) i;
-            byte[] data = new byte[2048];
+            byte[] data = new byte[dataSize];
             Arrays.fill(data, payload);
 
-            byte[] actualData = (byte[]) recoveredGrid.cache(CACHE_NAME).get(i);
+            byte[] actualData = (byte[]) grid.cache(CACHE_NAME).get(i);
             Assert.assertArrayEquals(data, actualData);
         }
     }
@@ -474,11 +493,6 @@ public class IgnitePdsDiskErrorsRecoveringTest extends GridCommonAbstractTest {
         }
 
         /** {@inheritDoc} */
-        @Override public FileIO create(File file) throws IOException {
-            return create(file, CREATE, WRITE, READ);
-        }
-
-        /** {@inheritDoc} */
         @Override public FileIO create(File file, OpenOption... modes) throws IOException {
             if (file.getName().endsWith(pattern))
                 return delegate.create(file, modes);
@@ -509,11 +523,6 @@ public class IgnitePdsDiskErrorsRecoveringTest extends GridCommonAbstractTest {
         }
 
         /** {@inheritDoc} */
-        @Override public FileIO create(File file) throws IOException {
-            return new LimitedSizeFileIO(delegate.create(file), availableSpaceBytes);
-        }
-
-        /** {@inheritDoc} */
         @Override public FileIO create(File file, OpenOption... modes) throws IOException {
             return new LimitedSizeFileIO(delegate.create(file, modes), availableSpaceBytes);
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/c076aee4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteNodeStoppedDuringDisableWALTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteNodeStoppedDuringDisableWALTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteNodeStoppedDuringDisableWALTest.java
index a744ab1..906f191 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteNodeStoppedDuringDisableWALTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteNodeStoppedDuringDisableWALTest.java
@@ -48,7 +48,6 @@ import org.junit.Assert;
 import static java.nio.file.FileVisitResult.CONTINUE;
 import static java.nio.file.Files.walkFileTree;
 import static org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager.CP_FILE_NAME_PATTERN;
-
 import static org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.INDEX_FILE_NAME;
 import static org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.META_STORAGE_NAME;
 import static org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.PART_FILE_PREFIX;
@@ -92,6 +91,8 @@ public class IgniteNodeStoppedDuringDisableWALTest extends GridCommonAbstractTes
     }
 
     /**
+     * Test checks that after WAL is globally disabled and node is stopped, persistent store is cleaned properly after node restart.
+     *
      * @throws Exception If failed.
      */
     public void test() throws Exception {
@@ -190,6 +191,8 @@ public class IgniteNodeStoppedDuringDisableWALTest extends GridCommonAbstractTes
 
         String msg = nodeStopPoint.toString();
 
+        int pageSize = ig1.configuration().getDataStorageConfiguration().getPageSize();
+
         if (nodeStopPoint.needCleanUp) {
             PdsFoldersResolver foldersResolver = ((IgniteEx)ig1).context().pdsFolderResolver();
 
@@ -215,14 +218,14 @@ public class IgniteNodeStoppedDuringDisableWALTest extends GridCommonAbstractTes
                     if (CP_FILE_NAME_PATTERN.matcher(name).matches())
                         failed = true;
 
-                    if (name.startsWith(PART_FILE_PREFIX))
+                    if (name.startsWith(PART_FILE_PREFIX) && path.toFile().length() > pageSize)
                         failed = true;
 
-                    if (name.startsWith(INDEX_FILE_NAME))
+                    if (name.startsWith(INDEX_FILE_NAME) && path.toFile().length() > pageSize)
                         failed = true;
 
                     if (failed)
-                        fail(msg + " " + filePath);
+                        fail(msg + " " + filePath + " " + path.toFile().length());
 
                     return CONTINUE;
                 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/c076aee4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushFailoverTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushFailoverTest.java
index de654f1..e6e72e0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushFailoverTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushFailoverTest.java
@@ -185,11 +185,6 @@ public class IgniteWalFlushFailoverTest extends GridCommonAbstractTest {
         }
 
         /** {@inheritDoc} */
-        @Override public FileIO create(File file) throws IOException {
-            return create(file, CREATE, READ, WRITE);
-        }
-
-        /** {@inheritDoc} */
         @Override public FileIO create(File file, OpenOption... modes) throws IOException {
             final FileIO delegate = delegateFactory.create(file, modes);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c076aee4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushMultiNodeFailoverAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushMultiNodeFailoverAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushMultiNodeFailoverAbstractSelfTest.java
index a28ec5f..0134e69 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushMultiNodeFailoverAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushMultiNodeFailoverAbstractSelfTest.java
@@ -257,11 +257,6 @@ public abstract class IgniteWalFlushMultiNodeFailoverAbstractSelfTest extends Gr
         }
 
         /** {@inheritDoc} */
-        @Override public FileIO create(File file) throws IOException {
-            return create(file, CREATE, READ, WRITE);
-        }
-
-        /** {@inheritDoc} */
         @Override public FileIO create(File file, OpenOption... modes) throws IOException {
             final FileIO delegate = delegateFactory.create(file, modes);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c076aee4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFormatFileFailoverTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFormatFileFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFormatFileFailoverTest.java
index 5a1a6fa..a77ab98 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFormatFileFailoverTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFormatFileFailoverTest.java
@@ -112,6 +112,8 @@ public class IgniteWalFormatFileFailoverTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testFailureHandlerTriggeredFsync() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-10035");
+
         fsync = true;
 
         failFormatFileOnClusterActivate();
@@ -121,6 +123,8 @@ public class IgniteWalFormatFileFailoverTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testFailureHandlerTriggered() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-10035");
+
         fsync = false;
 
         failFormatFileOnClusterActivate();
@@ -225,11 +229,6 @@ public class IgniteWalFormatFileFailoverTest extends GridCommonAbstractTest {
         }
 
         /** {@inheritDoc} */
-        @Override public FileIO create(File file) throws IOException {
-            return create(file, CREATE, READ, WRITE);
-        }
-
-        /** {@inheritDoc} */
         @Override public FileIO create(File file, OpenOption... modes) throws IOException {
             final FileIO delegate = delegateFactory.create(file, modes);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c076aee4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalHistoryReservationsTest.java
----------------------------------------------------------------------
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 6d2b1f7..4c34093 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
@@ -114,7 +114,7 @@ public class IgniteWalHistoryReservationsTest extends GridCommonAbstractTest {
 
         final IgniteEx ig0 = (IgniteEx)startGrids(initGridCnt + 1);
 
-        ig0.active(true);
+        ig0.cluster().active(true);
 
         stopGrid(initGridCnt);
 
@@ -256,7 +256,7 @@ public class IgniteWalHistoryReservationsTest extends GridCommonAbstractTest {
 
         IgniteEx ig0 = (IgniteEx)startGrids(2);
 
-        ig0.active(true);
+        ig0.cluster().active(true);
 
         IgniteCache<Integer, Integer> cache = ig0.cache("cache1");
 
@@ -270,6 +270,8 @@ public class IgniteWalHistoryReservationsTest extends GridCommonAbstractTest {
 
         IgniteEx ig1 = startGrid(1);
 
+        awaitPartitionMapExchange();
+
         IgniteCache<Integer, Integer> cache1 = ig1.cache("cache1");
 
         assertEquals(entryCnt / 2, cache.size());
@@ -286,8 +288,6 @@ public class IgniteWalHistoryReservationsTest extends GridCommonAbstractTest {
             }
         }
 
-        cache.rebalance().get();
-
         for (int p = 0; p < ig1.affinity("cache1").partitions(); p++) {
             GridDhtLocalPartition p0 = ig0.context().cache().cache("cache1").context().topology().localPartition(p);
             GridDhtLocalPartition p1 = ig1.context().cache().cache("cache1").context().topology().localPartition(p);
@@ -305,7 +305,7 @@ public class IgniteWalHistoryReservationsTest extends GridCommonAbstractTest {
 
         IgniteEx ig0 = (IgniteEx)startGrids(2);
 
-        ig0.active(true);
+        ig0.cluster().active(true);
 
         IgniteCache<Integer, Integer> cache = ig0.cache("cache1");
 
@@ -330,6 +330,8 @@ public class IgniteWalHistoryReservationsTest extends GridCommonAbstractTest {
 
         IgniteEx ig1 = startGrid(1);
 
+        awaitPartitionMapExchange();
+
         IgniteCache<Integer, Integer> cache1 = ig1.cache("cache1");
 
         assertEquals(entryCnt / 2, cache.size());
@@ -346,8 +348,6 @@ public class IgniteWalHistoryReservationsTest extends GridCommonAbstractTest {
             }
         }
 
-        cache.rebalance().get();
-
         for (int p = 0; p < ig1.affinity("cache1").partitions(); p++) {
             GridDhtLocalPartition p0 = ig0.context().cache().cache("cache1").context().topology().localPartition(p);
             GridDhtLocalPartition p1 = ig1.context().cache().cache("cache1").context().topology().localPartition(p);
@@ -407,7 +407,7 @@ public class IgniteWalHistoryReservationsTest extends GridCommonAbstractTest {
 
         final Ignite ig0 = startGrids(initGridCnt);
 
-        ig0.active(true);
+        ig0.cluster().active(true);
 
         IgniteCache<Object, Object> cache = ig0.cache("cache1");
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c076aee4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRebalanceTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRebalanceTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRebalanceTest.java
index 57565bf..0409a29 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRebalanceTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRebalanceTest.java
@@ -613,11 +613,6 @@ public class IgniteWalRebalanceTest extends GridCommonAbstractTest {
         }
 
         /** {@inheritDoc} */
-        @Override public FileIO create(File file) throws IOException {
-            return create(file, CREATE, WRITE, READ);
-        }
-
-        /** {@inheritDoc} */
         @Override public FileIO create(File file, OpenOption... modes) throws IOException {
             FileIO delegateIO = delegate.create(file, modes);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c076aee4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalRecoveryTxLogicalRecordsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalRecoveryTxLogicalRecordsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalRecoveryTxLogicalRecordsTest.java
index 261167a..d2ea4f1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalRecoveryTxLogicalRecordsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalRecoveryTxLogicalRecordsTest.java
@@ -49,8 +49,8 @@ import org.apache.ignite.internal.processors.cache.CacheGroupContext;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
 import org.apache.ignite.internal.processors.cache.IgniteCacheOffheapManager;
 import org.apache.ignite.internal.processors.cache.IgniteRebalanceIterator;
-import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtLocalPartition;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtDemandedPartitionsMap;
+import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtLocalPartition;
 import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
 import org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager;
 import org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager;
@@ -584,6 +584,8 @@ public class WalRecoveryTxLogicalRecordsTest extends GridCommonAbstractTest {
     }
 
     /**
+     * Test checks that the number of pages per each page store are not changing before and after node restart.
+     *
      * @throws Exception If failed.
      */
     public void testRecoveryNoPageLost3() throws Exception {
@@ -679,7 +681,7 @@ public class WalRecoveryTxLogicalRecordsTest extends GridCommonAbstractTest {
 
                 pages = allocatedPages(ignite, CACHE2_NAME);
 
-                ignite.close();
+                stopGrid(0, true);
             }
         }
         finally {

http://git-wip-us.apache.org/repos/asf/ignite/blob/c076aee4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PagesWriteThrottleSmokeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PagesWriteThrottleSmokeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PagesWriteThrottleSmokeTest.java
index 7ff1348..b05d5db 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PagesWriteThrottleSmokeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PagesWriteThrottleSmokeTest.java
@@ -288,11 +288,6 @@ public class PagesWriteThrottleSmokeTest extends GridCommonAbstractTest {
         private final FileIOFactory delegateFactory = new RandomAccessFileIOFactory();
 
         /** {@inheritDoc} */
-        @Override public FileIO create(File file) throws IOException {
-            return create(file, CREATE, READ, WRITE);
-        }
-
-        /** {@inheritDoc} */
         @Override public FileIO create(File file, OpenOption... openOption) throws IOException {
             final FileIO delegate = delegateFactory.create(file, openOption);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c076aee4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/AbstractNodeJoinTemplate.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/AbstractNodeJoinTemplate.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/AbstractNodeJoinTemplate.java
index 219db8d..a888ecb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/AbstractNodeJoinTemplate.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/AbstractNodeJoinTemplate.java
@@ -786,7 +786,9 @@ public abstract class AbstractNodeJoinTemplate extends GridCommonAbstractTest {
 
                     Map<String, GridCacheAdapter> caches = caches(ig);
 
-                    Assert.assertEquals(0, caches.size());
+                    for (GridCacheAdapter cacheAdapter : caches.values())
+                        Assert.assertTrue("Cache should be in recovery mode: " + cacheAdapter.context(),
+                            cacheAdapter.context().isRecoveryMode());
                 }
             });
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/c076aee4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/wal/AbstractWalDeltaConsistencyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/wal/AbstractWalDeltaConsistencyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/wal/AbstractWalDeltaConsistencyTest.java
index 7f872fd..e0057b0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/wal/AbstractWalDeltaConsistencyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/wal/AbstractWalDeltaConsistencyTest.java
@@ -76,6 +76,8 @@ public abstract class AbstractWalDeltaConsistencyTest extends GridCommonAbstract
     protected DataStorageConfiguration getDataStorageConfiguration() {
         return new DataStorageConfiguration()
             .setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+                .setInitialSize(256 * 1024 * 1024)
+                .setMaxSize(256 * 1024 * 1024)
                 .setPersistenceEnabled(true)
                 .setName("dflt-plc"));
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/c076aee4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/wal/ExplicitWalDeltaConsistencyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/wal/ExplicitWalDeltaConsistencyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/wal/ExplicitWalDeltaConsistencyTest.java
index 1b9a18a..e9512e1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/wal/ExplicitWalDeltaConsistencyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/wal/ExplicitWalDeltaConsistencyTest.java
@@ -72,6 +72,8 @@ public class ExplicitWalDeltaConsistencyTest extends AbstractWalDeltaConsistency
         for (int i = 0; i < 3_000; i++)
             cache.put(i, "Cache value " + i);
 
+        forceCheckpoint();
+
         stopGrid(0);
 
         ignite = startGrid(0);

http://git-wip-us.apache.org/repos/asf/ignite/blob/c076aee4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/wal/memtracker/PageMemoryTracker.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/wal/memtracker/PageMemoryTracker.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/wal/memtracker/PageMemoryTracker.java
index 09cacfb..864d2cc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/wal/memtracker/PageMemoryTracker.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/wal/memtracker/PageMemoryTracker.java
@@ -475,18 +475,7 @@ public class PageMemoryTracker implements IgnitePlugin {
             return;
 
         // Increment statistics.
-        AtomicInteger statCnt = stats.get(record.type());
-
-        if (statCnt == null) {
-            statCnt = new AtomicInteger();
-
-            AtomicInteger oldCnt = stats.putIfAbsent(record.type(), statCnt);
-
-            if (oldCnt != null)
-                statCnt = oldCnt;
-        }
-
-        statCnt.incrementAndGet();
+        stats.computeIfAbsent(record.type(), r -> new AtomicInteger()).incrementAndGet();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/c076aee4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/wal/memtracker/PageMemoryTrackerPluginProvider.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/wal/memtracker/PageMemoryTrackerPluginProvider.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/wal/memtracker/PageMemoryTrackerPluginProvider.java
index c5f83b5..cad3b02 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/wal/memtracker/PageMemoryTrackerPluginProvider.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/wal/memtracker/PageMemoryTrackerPluginProvider.java
@@ -20,12 +20,16 @@ package org.apache.ignite.internal.processors.cache.persistence.wal.memtracker;
 import java.io.Serializable;
 import java.util.UUID;
 import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.IgniteEx;
 import org.apache.ignite.internal.pagemem.store.IgnitePageStoreManager;
 import org.apache.ignite.internal.pagemem.wal.IgniteWriteAheadLogManager;
+import org.apache.ignite.internal.processors.cache.persistence.DatabaseLifecycleListener;
+import org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager;
 import org.apache.ignite.internal.processors.cluster.IgniteChangeGlobalStateSupport;
 import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.plugin.CachePluginContext;
@@ -43,7 +47,7 @@ import org.jetbrains.annotations.Nullable;
  * PageMemory tracker plugin provider.
  */
 public class PageMemoryTrackerPluginProvider implements PluginProvider<PageMemoryTrackerConfiguration>,
-    IgniteChangeGlobalStateSupport {
+    IgniteChangeGlobalStateSupport, DatabaseLifecycleListener {
     /** System property name to implicitly enable page memory tracker . */
     public static final String IGNITE_ENABLE_PAGE_MEMORY_TRACKER = "IGNITE_ENABLE_PAGE_MEMORY_TRACKER";
 
@@ -132,7 +136,7 @@ public class PageMemoryTrackerPluginProvider implements PluginProvider<PageMemor
 
     /** {@inheritDoc} */
     @Override public void start(PluginContext ctx) {
-        // No-op
+        ((IgniteEx)ctx.grid()).context().internalSubscriptionProcessor().registerDatabaseListener(this);
     }
 
     /** {@inheritDoc} */
@@ -197,4 +201,15 @@ public class PageMemoryTrackerPluginProvider implements PluginProvider<PageMemor
             return null;
         }
     }
+
+    @Override public void beforeBinaryMemoryRestore(IgniteCacheDatabaseSharedManager mgr) throws IgniteCheckedException {
+        if (plugin != null) {
+            try {
+                plugin.start();
+            }
+            catch (Exception e) {
+                log.error("Can't start plugin", e);
+            }
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/c076aee4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StandaloneWalRecordsIteratorTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StandaloneWalRecordsIteratorTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StandaloneWalRecordsIteratorTest.java
index aa24479..8132c12 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StandaloneWalRecordsIteratorTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StandaloneWalRecordsIteratorTest.java
@@ -269,11 +269,6 @@ public class StandaloneWalRecordsIteratorTest extends GridCommonAbstractTest {
      */
     private static class CountedFileIOFactory extends RandomAccessFileIOFactory {
         /** {@inheritDoc} */
-        @Override public FileIO create(File file) throws IOException {
-            return create(file, StandardOpenOption.CREATE, StandardOpenOption.READ, StandardOpenOption.WRITE);
-        }
-
-        /** {@inheritDoc} */
         @Override public FileIO create(File file, OpenOption... modes) throws IOException {
             return new CountedFileIO(file, modes);
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/c076aee4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TransactionIntegrityWithPrimaryIndexCorruptionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TransactionIntegrityWithPrimaryIndexCorruptionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TransactionIntegrityWithPrimaryIndexCorruptionTest.java
index 473eaf5..fd31ee5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TransactionIntegrityWithPrimaryIndexCorruptionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TransactionIntegrityWithPrimaryIndexCorruptionTest.java
@@ -181,9 +181,6 @@ public class TransactionIntegrityWithPrimaryIndexCorruptionTest extends Abstract
                     return hnd;
 
                 if (treeCorruptionPred.apply(hnd, tree)) {
-                    log.info("Created corrupted tree handler [nodeOrder=" + locIgnite.localNode().order() + ", hnd=" + hnd +
-                        ", tree=" + tree + ']');
-
                     PageHandler<Object, BPlusTree.Result> delegate = (PageHandler<Object, BPlusTree.Result>)hnd;
 
                     return new PageHandler<BPlusTree.Get, BPlusTree.Result>() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/c076aee4/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java b/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java
index c8cf9aa..4159f6e 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java
@@ -90,6 +90,7 @@ public class GridCacheTestContext<K, V> extends GridCacheContext<K, V> {
             AffinityTopologyVersion.ZERO,
             true,
             true,
+            false,
             new GridCacheEventManager(),
             new CacheOsStoreManager(null, new CacheConfiguration()),
             new GridCacheEvictionManager(),

http://git-wip-us.apache.org/repos/asf/ignite/blob/c076aee4/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
index 057087e..af573fe 100755
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
@@ -184,9 +184,6 @@ public abstract class GridAbstractTest extends TestCase {
     /** Timestamp for tests. */
     private static long ts = System.currentTimeMillis();
 
-    /** Starting Ignite instance name. */
-    protected static final ThreadLocal<String> startingIgniteInstanceName = new ThreadLocal<>();
-
     /** Force failure flag. */
     private boolean forceFailure;
 
@@ -923,7 +920,7 @@ public abstract class GridAbstractTest extends TestCase {
         checkConfiguration(cfg);
 
         if (!isRemoteJvm(igniteInstanceName)) {
-            startingIgniteInstanceName.set(igniteInstanceName);
+            IgniteUtils.setCurrentIgniteName(igniteInstanceName);
 
             try {
                 String cfgProcClsName = System.getProperty(IGNITE_CFG_PREPROCESSOR_CLS);
@@ -959,7 +956,7 @@ public abstract class GridAbstractTest extends TestCase {
                 return node;
             }
             finally {
-                startingIgniteInstanceName.set(null);
+                IgniteUtils.setCurrentIgniteName(null);
             }
         }
         else

http://git-wip-us.apache.org/repos/asf/ignite/blob/c076aee4/modules/direct-io/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AlignedBuffersDirectFileIOFactory.java
----------------------------------------------------------------------
diff --git a/modules/direct-io/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AlignedBuffersDirectFileIOFactory.java b/modules/direct-io/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AlignedBuffersDirectFileIOFactory.java
index 8a28e9e..ea555a0 100644
--- a/modules/direct-io/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AlignedBuffersDirectFileIOFactory.java
+++ b/modules/direct-io/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AlignedBuffersDirectFileIOFactory.java
@@ -145,11 +145,6 @@ public class AlignedBuffersDirectFileIOFactory implements FileIOFactory {
     }
 
     /** {@inheritDoc} */
-    @Override public FileIO create(File file) throws IOException {
-        return create(file, CREATE, READ, WRITE);
-    }
-
-    /** {@inheritDoc} */
     @Override public FileIO create(File file, OpenOption... modes) throws IOException {
         if (useBackupFactory)
             return backupFactory.create(file, modes);

http://git-wip-us.apache.org/repos/asf/ignite/blob/c076aee4/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgnitePdsWithIndexingCoreTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgnitePdsWithIndexingCoreTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgnitePdsWithIndexingCoreTestSuite.java
index e9159bf..214a541 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgnitePdsWithIndexingCoreTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgnitePdsWithIndexingCoreTestSuite.java
@@ -27,6 +27,7 @@ import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsTxCacheR
 import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsTxHistoricalRebalancingTest;
 import org.apache.ignite.internal.processors.cache.persistence.IgnitePersistentStoreCacheGroupsTest;
 import org.apache.ignite.internal.processors.cache.persistence.PersistenceDirectoryWarningLoggingTest;
+import org.apache.ignite.internal.processors.cache.persistence.db.IgniteLogicalRecoveryTest;
 import org.apache.ignite.internal.processors.cache.persistence.db.IgnitePdsMultiNodePutGetRestartTest;
 import org.apache.ignite.internal.processors.cache.persistence.db.IgnitePdsPageEvictionTest;
 import org.apache.ignite.internal.processors.cache.persistence.db.file.IgnitePdsCacheDestroyDuringCheckpointTest;
@@ -88,6 +89,8 @@ public class IgnitePdsWithIndexingCoreTestSuite extends TestSuite {
 
         suite.addTestSuite(IgnitePdsCorruptedIndexTest.class);
 
+        suite.addTestSuite(IgniteLogicalRecoveryTest.class);
+
         return suite;
     }
 }


Mime
View raw message