IGNITE-7021 IgniteOOM is not propogated to client in case of implicit transaction
Signed-off-by: Andrey Gura <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/661ada68 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/661ada68 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/661ada68 Branch: refs/heads/ignite-zk Commit: 661ada6874a4aa36aa2be1b9db15a3f3a4d1a393 Parents: 1c09a92 Author: mcherkasov <[email protected]> Authored: Fri Dec 22 16:38:00 2017 +0300 Committer: Andrey Gura <[email protected]> Committed: Fri Dec 22 16:38:00 2017 +0300 ---------------------------------------------------------------------- .../distributed/dht/GridDhtTxPrepareFuture.java | 3 ++ .../cache/IgniteOutOfMemoryPropagationTest.java | 41 +++++++++++--------- 2 files changed, 25 insertions(+), 19 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/661ada68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java index 0fb9ee4..a1f3984 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java @@ -717,6 +717,9 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite CIX1<IgniteInternalFuture<IgniteInternalTx>> resClo = new CIX1<IgniteInternalFuture<IgniteInternalTx>>() { @Override public void applyx(IgniteInternalFuture<IgniteInternalTx> fut) { + if(res.error() == null && fut.error() != null) + res.error(fut.error()); + if (REPLIED_UPD.compareAndSet(GridDhtTxPrepareFuture.this, 0, 1)) sendPrepareResponse(res); } http://git-wip-us.apache.org/repos/asf/ignite/blob/661ada68/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOutOfMemoryPropagationTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOutOfMemoryPropagationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOutOfMemoryPropagationTest.java index a13cbd4..24ff3fc 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOutOfMemoryPropagationTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOutOfMemoryPropagationTest.java @@ -43,7 +43,6 @@ import org.apache.ignite.transactions.TransactionIsolation; * */ public class IgniteOutOfMemoryPropagationTest extends GridCommonAbstractTest { - /** */ public static final int NODES = 3; @@ -54,7 +53,7 @@ public class IgniteOutOfMemoryPropagationTest extends GridCommonAbstractTest { private CacheMode mode; /** */ - private int backupsCount; + private int backupsCnt; /** */ private CacheWriteSynchronizationMode writeSyncMode; @@ -89,7 +88,7 @@ public class IgniteOutOfMemoryPropagationTest extends GridCommonAbstractTest { for (CacheAtomicityMode atomicityMode : CacheAtomicityMode.values()) { for (CacheMode cacheMode : CacheMode.values()) { for (CacheWriteSynchronizationMode writeSyncMode : CacheWriteSynchronizationMode.values()) { - for (int backupsCount = 0; backupsCount < 1; backupsCount++) { + for (int backupsCnt = 0; backupsCnt <= 1; backupsCnt++) { if (writeSyncMode == CacheWriteSynchronizationMode.FULL_ASYNC || cacheMode == CacheMode.REPLICATED) continue; @@ -102,14 +101,14 @@ public class IgniteOutOfMemoryPropagationTest extends GridCommonAbstractTest { CacheAtomicityMode.TRANSACTIONAL, cacheMode, writeSyncMode, - backupsCount, + backupsCnt, concurrency, isolation); } } } - else - checkOOMPropagation(useStreamer, atomicityMode, cacheMode, writeSyncMode, backupsCount); + + checkOOMPropagation(useStreamer, atomicityMode, cacheMode, writeSyncMode, backupsCnt); } } } @@ -118,21 +117,21 @@ public class IgniteOutOfMemoryPropagationTest extends GridCommonAbstractTest { /** */ private void checkOOMPropagation(boolean useStreamer, CacheAtomicityMode atomicityMode, CacheMode cacheMode, - CacheWriteSynchronizationMode writeSyncMode, int backupsCount) throws Exception { - checkOOMPropagation(useStreamer, atomicityMode, cacheMode, writeSyncMode, backupsCount, null, null); + CacheWriteSynchronizationMode writeSyncMode, int backupsCnt) throws Exception { + checkOOMPropagation(useStreamer, atomicityMode, cacheMode, writeSyncMode, backupsCnt, null, null); } /** */ private void checkOOMPropagation(boolean useStreamer, CacheAtomicityMode atomicityMode, CacheMode cacheMode, - CacheWriteSynchronizationMode writeSyncMode, int backupsCount, + CacheWriteSynchronizationMode writeSyncMode, int backupsCnt, TransactionConcurrency concurrency, TransactionIsolation isolation) throws Exception { Throwable t = null; System.out.println("Checking conf: CacheAtomicityMode." + atomicityMode + - " CacheMode." + mode + " CacheWriteSynchronizationMode." + writeSyncMode + " backupsCount = " + backupsCount + " CacheMode." + cacheMode + " CacheWriteSynchronizationMode." + writeSyncMode + " backupsCount = " + backupsCnt + " TransactionConcurrency." + concurrency + " TransactionIsolation." + isolation); - initGrid(atomicityMode, cacheMode, writeSyncMode, backupsCount); + initGrid(atomicityMode, cacheMode, writeSyncMode, backupsCnt); try { forceOOM(useStreamer, concurrency, isolation); } @@ -156,15 +155,15 @@ public class IgniteOutOfMemoryPropagationTest extends GridCommonAbstractTest { * @param atomicityMode atomicity mode * @param mode cache mode * @param writeSyncMode cache write synchronization mode - * @param backupsCount backups count - * @throws Exception + * @param backupsCnt backups count + * @throws Exception If failed. */ private void initGrid(CacheAtomicityMode atomicityMode, CacheMode mode, - CacheWriteSynchronizationMode writeSyncMode, int backupsCount) throws Exception { + CacheWriteSynchronizationMode writeSyncMode, int backupsCnt) throws Exception { this.atomicityMode = atomicityMode; this.mode = mode; - this.backupsCount = backupsCount; + this.backupsCnt = backupsCnt; this.writeSyncMode = writeSyncMode; Ignition.setClientMode(false); @@ -183,9 +182,13 @@ public class IgniteOutOfMemoryPropagationTest extends GridCommonAbstractTest { } - /** */ - public void forceOOM(boolean useStreamer, TransactionConcurrency concurrency, - TransactionIsolation isolation) throws Exception { + + /** + * @param useStreamer Use streamer. + * @param concurrency Concurrency. + * @param isolation Isolation. + */ + public void forceOOM(boolean useStreamer, TransactionConcurrency concurrency, TransactionIsolation isolation) { final IgniteCache<Object, Object> cache = client.cache(DEFAULT_CACHE_NAME); IgniteDataStreamer<String, String> streamer = client.dataStreamer(DEFAULT_CACHE_NAME); @@ -241,7 +244,7 @@ public class IgniteOutOfMemoryPropagationTest extends GridCommonAbstractTest { baseCfg.setAtomicityMode(this.atomicityMode); baseCfg.setCacheMode(this.mode); - baseCfg.setBackups(this.backupsCount); + baseCfg.setBackups(this.backupsCnt); baseCfg.setWriteSynchronizationMode(this.writeSyncMode); cfg.setCacheConfiguration(baseCfg);
