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

amashenkov pushed a commit to branch gg-21368
in repository https://gitbox.apache.org/repos/asf/ignite.git

commit f7f0b89c947ac421c3e49a45a5357413198c59ba
Author: Dmitriy Govorukhin <dmitriy.govoruk...@gmail.com>
AuthorDate: Wed Jul 17 12:50:00 2019 +0300

    GG-21254 Fixed *.testFailAfterStart failed on TC
---
 ...eWalFlushMultiNodeFailoverAbstractSelfTest.java | 59 ++++++++++++----------
 1 file changed, 31 insertions(+), 28 deletions(-)

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 815de97..d71d563 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
@@ -25,8 +25,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
 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;
@@ -43,6 +41,7 @@ import 
org.apache.ignite.internal.processors.cache.persistence.wal.FileWriteAhea
 import org.apache.ignite.internal.util.lang.GridAbsPredicate;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.MvccFeatureChecker;
+import org.apache.ignite.testframework.junits.WithSystemProperty;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.apache.ignite.transactions.Transaction;
 import org.apache.ignite.transactions.TransactionConcurrency;
@@ -51,15 +50,14 @@ import org.junit.Assume;
 import org.junit.Test;
 
 import static 
org.apache.ignite.IgniteSystemProperties.IGNITE_BASELINE_AUTO_ADJUST_ENABLED;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;
 
 /**
  * Tests error recovery while node flushing
  */
 public abstract class IgniteWalFlushMultiNodeFailoverAbstractSelfTest extends 
GridCommonAbstractTest {
     /** */
-    private static final String TEST_CACHE = "testCache";
-
-    /** */
     private static final int ITRS = 2000;
 
     /** */
@@ -131,22 +129,23 @@ public abstract class 
IgniteWalFlushMultiNodeFailoverAbstractSelfTest extends Gr
 
         cfg.setConsistentId(gridName);
 
-        CacheConfiguration cacheCfg = new CacheConfiguration(TEST_CACHE)
-                .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)
+        cfg.setCacheConfiguration(
+            new CacheConfiguration(DEFAULT_CACHE_NAME)
+                .setAtomicityMode(TRANSACTIONAL)
                 .setBackups(1)
-                .setRebalanceMode(CacheRebalanceMode.SYNC)
-                .setAffinity(new RendezvousAffinityFunction(false, 32));
+                .setRebalanceMode(SYNC)
+                .setAffinity(new RendezvousAffinityFunction(false, 32))
+        );
 
-        cfg.setCacheConfiguration(cacheCfg);
-
-        DataStorageConfiguration memCfg = new DataStorageConfiguration()
+        cfg.setDataStorageConfiguration(
+            new DataStorageConfiguration()
                 .setDefaultDataRegionConfiguration(
-                        new DataRegionConfiguration().setMaxSize(2048L * 1024 
* 1024).setPersistenceEnabled(true))
-                .setWalMode(this.walMode())
+                    new DataRegionConfiguration()
+                        .setMaxSize(2048L * 1024 * 1024)
+                        .setPersistenceEnabled(true))
+                .setWalMode(walMode())
                 .setWalSegmentSize(512 * 1024)
-                .setWalBufferSize(512 * 1024);
-
-        cfg.setDataStorageConfiguration(memCfg);
+                .setWalBufferSize(512 * 1024));
 
         cfg.setFailureHandler(new StopNodeFailureHandler());
 
@@ -159,6 +158,7 @@ public abstract class 
IgniteWalFlushMultiNodeFailoverAbstractSelfTest extends Gr
      * @throws Exception In case of fail
      */
     @Test
+    @WithSystemProperty(key = "IGNITE_DISABLE_WAL_DURING_REBALANCING", value = 
"false")
     public void testFailWhileStart() throws Exception {
         failWhilePut(true);
     }
@@ -169,6 +169,7 @@ public abstract class 
IgniteWalFlushMultiNodeFailoverAbstractSelfTest extends Gr
      * @throws Exception In case of fail
      */
     @Test
+    @WithSystemProperty(key = "IGNITE_DISABLE_WAL_DURING_REBALANCING", value = 
"false")
     public void testFailAfterStart() throws Exception {
         failWhilePut(false);
     }
@@ -177,15 +178,15 @@ public abstract class 
IgniteWalFlushMultiNodeFailoverAbstractSelfTest extends Gr
      * @throws Exception if failed.
      */
     private void failWhilePut(boolean failWhileStart) throws Exception {
-        final Ignite grid = startGridsMultiThreaded(gridCount());
+        Ignite ig = startGrids(gridCount());
 
-        grid.cluster().active(true);
+        ig.cluster().active(true);
 
-        IgniteCache<Object, Object> cache = grid.cache(TEST_CACHE);
+        IgniteCache<Object, Object> cache = ig.cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < ITRS; i++) {
             while (!Thread.currentThread().isInterrupted()) {
-                try (Transaction tx = grid.transactions().txStart(
+                try (Transaction tx = ig.transactions().txStart(
                         TransactionConcurrency.PESSIMISTIC, 
TransactionIsolation.REPEATABLE_READ)) {
                     cache.put(i, "testValue" + i);
 
@@ -207,7 +208,7 @@ public abstract class 
IgniteWalFlushMultiNodeFailoverAbstractSelfTest extends Gr
 
                     
setFileIOFactory(grid(gridCount()).context().cache().context().wal());
 
-                    
grid.cluster().setBaselineTopology(grid.cluster().topologyVersion());
+                    
ig.cluster().setBaselineTopology(ig.cluster().topologyVersion());
 
                     awaitPartitionMapExchange();
                 }
@@ -223,7 +224,7 @@ public abstract class 
IgniteWalFlushMultiNodeFailoverAbstractSelfTest extends Gr
         // We should await successful stop of node.
         GridTestUtils.waitForCondition(new GridAbsPredicate() {
             @Override public boolean apply() {
-                return grid.cluster().nodes().size() == gridCount();
+                return ig.cluster().nodes().size() == gridCount();
             }
         }, getTestTimeout());
 
@@ -233,11 +234,9 @@ public abstract class 
IgniteWalFlushMultiNodeFailoverAbstractSelfTest extends Gr
 
         Ignite grid0 = startGrids(gridCount() + 1);
 
-        setFileIOFactory(grid(gridCount()).context().cache().context().wal());
-
         grid0.cluster().active(true);
 
-        cache = grid0.cache(TEST_CACHE);
+        cache = grid0.cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < ITRS; i++)
             assertEquals(cache.get(i), "testValue" + i);
@@ -276,7 +275,9 @@ public abstract class 
IgniteWalFlushMultiNodeFailoverAbstractSelfTest extends Gr
             return new FileIODecorator(delegate) {
                 /** {@inheritDoc} */
                 @Override public int write(ByteBuffer srcBuf) throws 
IOException {
-                    if (fail != null && fail.get())
+                    System.out.println(">>>!!!! W "+file.getName());
+
+                    if (fail != null && file.getName().endsWith(".wal") && 
fail.get())
                         throw new IOException("No space left on device");
 
                     return super.write(srcBuf);
@@ -284,7 +285,9 @@ public abstract class 
IgniteWalFlushMultiNodeFailoverAbstractSelfTest extends Gr
 
                 /** {@inheritDoc} */
                 @Override public MappedByteBuffer map(int sizeBytes) throws 
IOException {
-                    if (fail != null && fail.get())
+                    System.out.println(">>>!!!! M "+file.getName());
+
+                    if (fail != null && file.getName().endsWith(".wal") && 
fail.get())
                         throw new IOException("No space left on deive");
 
                     return delegate.map(sizeBytes);

Reply via email to