ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ag...@apache.org
Subject ignite git commit: IGNITE-8727 Fixed WalFlush with MMap tests.
Date Fri, 15 Jun 2018 14:53:00 GMT
Repository: ignite
Updated Branches:
  refs/heads/master bc374f85c -> 41954cca0


IGNITE-8727 Fixed WalFlush with MMap tests.

Signed-off-by: Andrey Gura <agura@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/41954cca
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/41954cca
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/41954cca

Branch: refs/heads/master
Commit: 41954cca0d5e783ae60a348a2ff381fcd37933ae
Parents: bc374f8
Author: Pavel Kovalenko <jokserfn@gmail.com>
Authored: Fri Jun 15 17:49:12 2018 +0300
Committer: Andrey Gura <agura@apache.org>
Committed: Fri Jun 15 17:49:12 2018 +0300

----------------------------------------------------------------------
 .../persistence/file/FilePageStoreManager.java  |  1 -
 .../file/FileVersionCheckingFactory.java        |  7 ++++--
 .../wal/FileWriteAheadLogManager.java           |  8 +++----
 .../wal/FsyncModeFileWriteAheadLogManager.java  | 17 ++++++---------
 ...alFlushBackgroundWithMmapBufferSelfTest.java | 14 ------------
 ...teWalFlushLogOnlyWithMmapBufferSelfTest.java | 14 ------------
 ...lFlushMultiNodeFailoverAbstractSelfTest.java | 23 ++++++++++++++------
 .../ignite/testsuites/IgnitePdsTestSuite2.java  |  8 +++----
 8 files changed, 36 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/41954cca/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreManager.java
index 1e9c32b..afc8281 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreManager.java
@@ -977,5 +977,4 @@ public class FilePageStoreManager extends GridCacheSharedManagerAdapter
implemen
             this.partStores = partStores;
         }
     }
-
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/41954cca/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FileVersionCheckingFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FileVersionCheckingFactory.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FileVersionCheckingFactory.java
index c7aaf1b..ab36d7c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FileVersionCheckingFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FileVersionCheckingFactory.java
@@ -52,8 +52,11 @@ public class FileVersionCheckingFactory implements FilePageStoreFactory
{
      * @param fileIOFactoryStoreV1 File IO factory for V1 page store and for version checking.
      * @param memCfg Memory configuration.
      */
-    public FileVersionCheckingFactory(FileIOFactory fileIOFactory, FileIOFactory fileIOFactoryStoreV1,
-        DataStorageConfiguration memCfg) {
+    public FileVersionCheckingFactory(
+        FileIOFactory fileIOFactory,
+        FileIOFactory fileIOFactoryStoreV1,
+        DataStorageConfiguration memCfg
+    ) {
         this.fileIOFactory = fileIOFactory;
         this.fileIOFactoryStoreV1 = fileIOFactoryStoreV1;
         this.memCfg = memCfg;

http://git-wip-us.apache.org/repos/asf/ignite/blob/41954cca/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 a55f156..03eb1af 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
@@ -282,7 +282,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter
impl
     private volatile long lastTruncatedArchiveIdx = -1L;
 
     /** Factory to provide I/O interfaces for read/write operations with files */
-    private FileIOFactory ioFactory;
+    private volatile FileIOFactory ioFactory;
 
     /** Next WAL segment archived monitor. Manages last archived index, emulates archivation
in no-archiver mode. */
     private final SegmentArchivedMonitor archivedMonitor = new SegmentArchivedMonitor();
@@ -3313,13 +3313,13 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter
impl
                         }
                     }
                 }
-
-                unparkWaiters(Long.MAX_VALUE);
             }
             catch (Throwable t) {
                 err = t;
             }
             finally {
+                unparkWaiters(Long.MAX_VALUE);
+
                 if (err == null && !shutdown)
                     err = new IllegalStateException("Thread " + getName() + " is terminated
unexpectedly");
 
@@ -3480,7 +3480,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter
impl
                 assert hdl.written == hdl.fileIO.position();
             }
             catch (IOException e) {
-                StorageException se = new StorageException("Unable to write", e);
+                StorageException se = new StorageException("Failed to write buffer.", e);
 
                 cctx.kernalContext().failure().process(new FailureContext(CRITICAL_ERROR,
se));
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/41954cca/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 867f13f..c58ab3d 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
@@ -230,7 +230,7 @@ public class FsyncModeFileWriteAheadLogManager extends GridCacheSharedManagerAda
     private volatile long lastTruncatedArchiveIdx = -1L;
 
     /** Factory to provide I/O interfaces for read/write operations with files */
-    private FileIOFactory ioFactory;
+    private volatile FileIOFactory ioFactory;
 
     /** Updater for {@link #currentHnd}, used for verify there are no concurrent update for
current log segment handle */
     private static final AtomicReferenceFieldUpdater<FsyncModeFileWriteAheadLogManager,
FileWriteHandle> currentHndUpd =
@@ -266,9 +266,6 @@ public class FsyncModeFileWriteAheadLogManager extends GridCacheSharedManagerAda
     /** Current log segment handle */
     private volatile FileWriteHandle currentHnd;
 
-    /** Environment failure. */
-    private volatile Throwable envFailed;
-
     /**
      * Positive (non-0) value indicates WAL can be archived even if not complete<br>
      * See {@link DataStorageConfiguration#setWalAutoArchiveAfterInactivity(long)}<br>
@@ -2412,9 +2409,9 @@ public class FsyncModeFileWriteAheadLogManager extends GridCacheSharedManagerAda
          * Write serializer version to current handle.
          * NOTE: Method mutates {@code fileIO} position, written and lastFsyncPos fields.
          *
-         * @throws IgniteCheckedException If fail to write serializer version.
+         * @throws IOException If fail to write serializer version.
          */
-        public void writeSerializerVersion() throws IgniteCheckedException {
+        public void writeSerializerVersion() throws IOException {
             try {
                 assert fileIO.position() == 0 : "Serializer version can be written only at
the begin of file " +
                     fileIO.position();
@@ -2427,7 +2424,7 @@ public class FsyncModeFileWriteAheadLogManager extends GridCacheSharedManagerAda
                 head.set(new FakeRecord(new FileWALPointer(idx, (int)updatedPosition, 0),
false));
             }
             catch (IOException e) {
-                throw new IgniteCheckedException("Unable to write serializer version for
segment " + idx, e);
+                throw new IOException("Unable to write serializer version for segment " +
idx, e);
             }
         }
 
@@ -2542,7 +2539,7 @@ public class FsyncModeFileWriteAheadLogManager extends GridCacheSharedManagerAda
             lock.lock();
 
             try {
-                while (written < expWritten && envFailed == null)
+                while (written < expWritten && !cctx.kernalContext().invalid())
                     U.awaitQuiet(writeComplete);
             }
             finally {
@@ -2858,7 +2855,7 @@ public class FsyncModeFileWriteAheadLogManager extends GridCacheSharedManagerAda
             try {
                 WALRecord rec = head.get();
 
-                if (envFailed == null) {
+                if (!cctx.kernalContext().invalid()) {
                     assert rec instanceof FakeRecord : "Expected head FakeRecord, actual
head "
                     + (rec != null ? rec.getClass().getSimpleName() : "null");
 
@@ -2882,7 +2879,7 @@ public class FsyncModeFileWriteAheadLogManager extends GridCacheSharedManagerAda
             lock.lock();
 
             try {
-                while (fileIO != null)
+                while (fileIO != null && !cctx.kernalContext().invalid())
                     U.awaitQuiet(nextSegment);
             }
             finally {

http://git-wip-us.apache.org/repos/asf/ignite/blob/41954cca/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushBackgroundWithMmapBufferSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushBackgroundWithMmapBufferSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushBackgroundWithMmapBufferSelfTest.java
index 15d2b7a..4f021cb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushBackgroundWithMmapBufferSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushBackgroundWithMmapBufferSelfTest.java
@@ -25,18 +25,4 @@ public class IgniteWalFlushBackgroundWithMmapBufferSelfTest extends IgniteWalFlu
     @Override protected boolean mmap() {
         return true;
     }
-
-    /** {@inheritDoc} */
-    @Override public void testFailWhileStart() throws Exception {
-        fail("https://issues.apache.org/jira/browse/IGNITE-8727");
-
-        super.testFailWhileStart();
-    }
-
-    /** {@inheritDoc} */
-    @Override public void testFailAfterStart() throws Exception {
-        fail("https://issues.apache.org/jira/browse/IGNITE-8727");
-
-        super.testFailAfterStart();
-    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/41954cca/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushLogOnlyWithMmapBufferSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushLogOnlyWithMmapBufferSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushLogOnlyWithMmapBufferSelfTest.java
index ce06b7d..d1f5075 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushLogOnlyWithMmapBufferSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushLogOnlyWithMmapBufferSelfTest.java
@@ -25,18 +25,4 @@ public class IgniteWalFlushLogOnlyWithMmapBufferSelfTest extends IgniteWalFlushL
     @Override protected boolean mmap() {
         return true;
     }
-
-    /** {@inheritDoc} */
-    @Override public void testFailWhileStart() throws Exception {
-        fail("https://issues.apache.org/jira/browse/IGNITE-8727");
-
-        super.testFailWhileStart();
-    }
-
-    /** {@inheritDoc} */
-    @Override public void testFailAfterStart() throws Exception {
-        fail("https://issues.apache.org/jira/browse/IGNITE-8727");
-
-        super.testFailAfterStart();
-    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/41954cca/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 b25e703..ccf81d8 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
@@ -26,6 +26,8 @@ import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.IgniteSystemProperties;
 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;
@@ -61,7 +63,7 @@ public abstract class IgniteWalFlushMultiNodeFailoverAbstractSelfTest extends
Gr
     private static final String TEST_CACHE = "testCache";
 
     /** */
-    private static final int ITRS = 1000;
+    private static final int ITRS = 2000;
 
     /** */
     private AtomicBoolean canFail = new AtomicBoolean();
@@ -114,9 +116,13 @@ public abstract class IgniteWalFlushMultiNodeFailoverAbstractSelfTest
extends Gr
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception
{
         IgniteConfiguration cfg = super.getConfiguration(gridName);
 
+        cfg.setConsistentId(gridName);
+
         CacheConfiguration cacheCfg = new CacheConfiguration(TEST_CACHE)
                 .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)
-                .setBackups(1);
+                .setBackups(1)
+                .setRebalanceMode(CacheRebalanceMode.SYNC)
+                .setAffinity(new RendezvousAffinityFunction(false, 32));
 
         cfg.setCacheConfiguration(cacheCfg);
 
@@ -171,7 +177,8 @@ public abstract class IgniteWalFlushMultiNodeFailoverAbstractSelfTest
extends Gr
                     tx.commit();
 
                     break;
-                } catch (Exception expected) {
+                }
+                catch (Exception expected) {
                     // Expected exception.
                 }
             }
@@ -188,7 +195,8 @@ public abstract class IgniteWalFlushMultiNodeFailoverAbstractSelfTest
extends Gr
                     grid.cluster().setBaselineTopology(grid.cluster().topologyVersion());
 
                     waitForRebalancing();
-                } catch (Exception expected) {
+                }
+                catch (Throwable expected) {
                     // There can be any exception. Do nothing.
                 }
             }
@@ -258,11 +266,9 @@ public abstract class IgniteWalFlushMultiNodeFailoverAbstractSelfTest
extends Gr
             final FileIO delegate = delegateFactory.create(file, modes);
 
             return new FileIODecorator(delegate) {
-                int writeAttempts = 2;
-
                 /** {@inheritDoc} */
                 @Override public int write(ByteBuffer srcBuf) throws IOException {
-                    if (--writeAttempts <= 0 && fail != null && fail.get())
+                    if (fail != null && fail.get())
                         throw new IOException("No space left on device");
 
                     return super.write(srcBuf);
@@ -270,6 +276,9 @@ public abstract class IgniteWalFlushMultiNodeFailoverAbstractSelfTest
extends Gr
 
                 /** {@inheritDoc} */
                 @Override public MappedByteBuffer map(int sizeBytes) throws IOException {
+                    if (fail != null && fail.get())
+                        throw new IOException("No space left on deive");
+
                     return delegate.map(sizeBytes);
                 }
             };

http://git-wip-us.apache.org/repos/asf/ignite/blob/41954cca/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite2.java
----------------------------------------------------------------------
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 ca0f0e3..6a4f9fe 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
@@ -111,6 +111,10 @@ public class IgnitePdsTestSuite2 extends TestSuite {
         suite.addTestSuite(LocalWalModeChangeDuringRebalancingSelfTest.class);
 
         suite.addTestSuite(IgniteWalFlushFsyncSelfTest.class);
+
+        suite.addTestSuite(IgniteWalFlushFsyncWithDedicatedWorkerSelfTest.class);
+
+        suite.addTestSuite(IgniteWalFlushFsyncWithMmapBufferSelfTest.class);
     }
 
     /**
@@ -138,10 +142,6 @@ public class IgnitePdsTestSuite2 extends TestSuite {
         // Failover test
         suite.addTestSuite(IgniteWalFlushFailoverTest.class);
 
-        suite.addTestSuite(IgniteWalFlushFsyncWithDedicatedWorkerSelfTest.class);
-
-        suite.addTestSuite(IgniteWalFlushFsyncWithMmapBufferSelfTest.class);
-
         suite.addTestSuite(IgniteWalFlushBackgroundSelfTest.class);
 
         suite.addTestSuite(IgniteWalFlushBackgroundWithMmapBufferSelfTest.class);


Mime
View raw message