Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 24266200BF6 for ; Mon, 26 Dec 2016 12:16:20 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 22FE7160B61; Mon, 26 Dec 2016 11:16:20 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B654A160B4A for ; Mon, 26 Dec 2016 12:16:18 +0100 (CET) Received: (qmail 23551 invoked by uid 500); 26 Dec 2016 11:16:17 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 23062 invoked by uid 99); 26 Dec 2016 11:16:17 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Dec 2016 11:16:17 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 93E7CF2DC7; Mon, 26 Dec 2016 11:16:17 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: vozerov@apache.org To: commits@ignite.apache.org Date: Mon, 26 Dec 2016 11:16:34 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [18/50] [abbrv] ignite git commit: ignite-4371 Neat TX finish request processing may fall into sync wait of dht finish response - enabled striped pool usage for GridDistributedTxFinishResponse - convert exceptions from CacheStoreSessionListener.onSession archived-at: Mon, 26 Dec 2016 11:16:20 -0000 ignite-4371 Neat TX finish request processing may fall into sync wait of dht finish response - enabled striped pool usage for GridDistributedTxFinishResponse - convert exceptions from CacheStoreSessionListener.onSessionStart into IgniteCheckedException - should not use IgniteTxLocalAdapter.commitErr for rollback exceptions (otherwise cyclic reference in exception->cause is possible, this leads to infinite loop in 'X.hasCause') (cherry picked from commit cf7b6a0) Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/147277d8 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/147277d8 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/147277d8 Branch: refs/heads/ignite-2.0 Commit: 147277d89fcdbd134425b74fc0b63596572a4af1 Parents: c1fde05 Author: sboikov Authored: Mon Dec 19 14:49:25 2016 +0300 Committer: sboikov Committed: Mon Dec 19 15:17:38 2016 +0300 ---------------------------------------------------------------------- .../GridDistributedTxFinishResponse.java | 6 ---- .../cache/store/CacheStoreManager.java | 4 ++- .../store/GridCacheStoreManagerAdapter.java | 34 ++++++++++++-------- .../cache/store/GridCacheWriteBehindStore.java | 6 ++-- .../transactions/IgniteTxLocalAdapter.java | 27 ++++++---------- 5 files changed, 36 insertions(+), 41 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/147277d8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java index c5cf332..109d665 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishResponse.java @@ -86,12 +86,6 @@ public class GridDistributedTxFinishResponse extends GridCacheMessage { } /** {@inheritDoc} */ - @Override public int partition() { - // TODO https://issues.apache.org/jira/browse/IGNITE-4371 - return Integer.MIN_VALUE; - } - - /** {@inheritDoc} */ @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) { writer.setBuffer(buf); http://git-wip-us.apache.org/repos/asf/ignite/blob/147277d8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/CacheStoreManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/CacheStoreManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/CacheStoreManager.java index 67c9334..8d6b63d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/CacheStoreManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/CacheStoreManager.java @@ -171,8 +171,10 @@ public interface CacheStoreManager extends GridCacheManager { /** * End session initiated by write-behind store. + * + * @throws IgniteCheckedException If failed. */ - public void writeBehindSessionInit(); + public void writeBehindSessionInit() throws IgniteCheckedException; /** * End session initiated by write-behind store. http://git-wip-us.apache.org/repos/asf/ignite/blob/147277d8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java index 024375e..8b93afa 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java @@ -288,7 +288,7 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt } /** {@inheritDoc} */ - @Override @Nullable public Object load(@Nullable IgniteInternalTx tx, KeyCacheObject key) + @Override @Nullable public final Object load(@Nullable IgniteInternalTx tx, KeyCacheObject key) throws IgniteCheckedException { return loadFromStore(tx, key, true); } @@ -377,7 +377,7 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt } /** {@inheritDoc} */ - @Override public void localStoreLoadAll(@Nullable IgniteInternalTx tx, Collection keys, GridInClosure3 vis) + @Override public final void localStoreLoadAll(@Nullable IgniteInternalTx tx, Collection keys, GridInClosure3 vis) throws IgniteCheckedException { assert store != null; assert locStore; @@ -386,7 +386,7 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt } /** {@inheritDoc} */ - @Override public boolean loadAll(@Nullable IgniteInternalTx tx, Collection keys, IgniteBiInClosure vis) + @Override public final boolean loadAll(@Nullable IgniteInternalTx tx, Collection keys, IgniteBiInClosure vis) throws IgniteCheckedException { if (store != null) { loadAllFromStore(tx, keys, vis, null); @@ -499,7 +499,7 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt } /** {@inheritDoc} */ - @Override public boolean loadCache(final GridInClosure3 vis, Object[] args) throws IgniteCheckedException { + @Override public final boolean loadCache(final GridInClosure3 vis, Object[] args) throws IgniteCheckedException { if (store != null) { if (log.isDebugEnabled()) log.debug("Loading all values from store."); @@ -554,7 +554,7 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt } /** {@inheritDoc} */ - @Override public boolean put(@Nullable IgniteInternalTx tx, Object key, Object val, GridCacheVersion ver) + @Override public final boolean put(@Nullable IgniteInternalTx tx, Object key, Object val, GridCacheVersion ver) throws IgniteCheckedException { if (store != null) { // Never persist internal keys. @@ -599,7 +599,7 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt } /** {@inheritDoc} */ - @Override public boolean putAll(@Nullable IgniteInternalTx tx, Map map) throws IgniteCheckedException { + @Override public final boolean putAll(@Nullable IgniteInternalTx tx, Map map) throws IgniteCheckedException { if (F.isEmpty(map)) return true; @@ -658,7 +658,7 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt } /** {@inheritDoc} */ - @Override public boolean remove(@Nullable IgniteInternalTx tx, Object key) throws IgniteCheckedException { + @Override public final boolean remove(@Nullable IgniteInternalTx tx, Object key) throws IgniteCheckedException { if (store != null) { // Never remove internal key from store as it is never persisted. if (key instanceof GridCacheInternal) @@ -701,7 +701,7 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt } /** {@inheritDoc} */ - @Override public boolean removeAll(@Nullable IgniteInternalTx tx, Collection keys) throws IgniteCheckedException { + @Override public final boolean removeAll(@Nullable IgniteInternalTx tx, Collection keys) throws IgniteCheckedException { if (F.isEmpty(keys)) return true; @@ -763,7 +763,7 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt } /** {@inheritDoc} */ - @Override public void sessionEnd(IgniteInternalTx tx, boolean commit, boolean last) throws IgniteCheckedException { + @Override public final void sessionEnd(IgniteInternalTx tx, boolean commit, boolean last) throws IgniteCheckedException { assert store != null; sessionInit0(tx); @@ -807,7 +807,7 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt } /** {@inheritDoc} */ - @Override public void writeBehindSessionInit() { + @Override public void writeBehindSessionInit() throws IgniteCheckedException { sessionInit0(null); } @@ -818,8 +818,9 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt /** * @param tx Current transaction. + * @throws IgniteCheckedException If failed. */ - private void sessionInit0(@Nullable IgniteInternalTx tx) { + private void sessionInit0(@Nullable IgniteInternalTx tx) throws IgniteCheckedException { assert sesHolder != null; SessionData ses; @@ -841,9 +842,14 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt sesHolder.set(ses); - if (sesLsnrs != null && !ses.started(this)) { - for (CacheStoreSessionListener lsnr : sesLsnrs) - lsnr.onSessionStart(locSes); + try { + if (sesLsnrs != null && !ses.started(this)) { + for (CacheStoreSessionListener lsnr : sesLsnrs) + lsnr.onSessionStart(locSes); + } + } + catch (Exception e) { + throw new IgniteCheckedException("Failed to start store session: " + e, e); } } http://git-wip-us.apache.org/repos/asf/ignite/blob/147277d8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStore.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStore.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStore.java index 858d9a7..f5c0c12 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStore.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStore.java @@ -673,10 +673,10 @@ public class GridCacheWriteBehindStore implements CacheStore, Lifecy Map> vals, boolean initSes) { - if (initSes && storeMgr != null) - storeMgr.writeBehindSessionInit(); - try { + if (initSes && storeMgr != null) + storeMgr.writeBehindSessionInit(); + boolean threwEx = true; try { http://git-wip-us.apache.org/repos/asf/ignite/blob/147277d8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java index 8d0a2b1..9f794b4 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java @@ -1063,7 +1063,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements Ig setRollbackOnly(); throw new IgniteCheckedException("Invalid transaction state for rollback [state=" + state + - ", tx=" + this + ']', commitErr); + ", tx=" + this + ']'); } if (near()) { @@ -1074,28 +1074,21 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements Ig } if (DONE_FLAG_UPD.compareAndSet(this, 0, 1)) { - try { - cctx.tm().rollbackTx(this); + cctx.tm().rollbackTx(this); - if (!internal()) { - Collection stores = txState.stores(cctx); + if (!internal()) { + Collection stores = txState.stores(cctx); - if (stores != null && !stores.isEmpty()) { - assert isWriteToStoreFromDhtValid(stores) : - "isWriteToStoreFromDht can't be different within one transaction"; + if (stores != null && !stores.isEmpty()) { + assert isWriteToStoreFromDhtValid(stores) : + "isWriteToStoreFromDht can't be different within one transaction"; - boolean isWriteToStoreFromDht = F.first(stores).isWriteToStoreFromDht(); + boolean isWriteToStoreFromDht = F.first(stores).isWriteToStoreFromDht(); - if (stores != null && !stores.isEmpty() && (near() || isWriteToStoreFromDht)) - sessionEnd(stores, false); - } + if (!stores.isEmpty() && (near() || isWriteToStoreFromDht)) + sessionEnd(stores, false); } } - catch (Error | IgniteCheckedException | RuntimeException e) { - U.addLastCause(e, commitErr, log); - - throw e; - } } }