diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java index 0543c19c4ce1c..c5555d97ac930 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java @@ -4462,8 +4462,14 @@ public IgniteInternalFuture lockAllAsync(GridCacheContext c ); } - /** {@inheritDoc} */ - @Override protected GridCacheEntryEx entryEx(GridCacheContext cacheCtx, IgniteTxKey key) { + /** + * Gets cache entry for given key. + * + * @param cacheCtx Cache context. + * @param key Key. + * @return Cache entry. + */ + protected GridCacheEntryEx entryEx(GridCacheContext cacheCtx, IgniteTxKey key) { if (cacheCtx.isColocated()) { IgniteTxEntry txEntry = entry(key); 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 f9598b57ffb09..cda2e0a9cb1a5 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 @@ -45,7 +45,6 @@ import org.apache.ignite.internal.processors.cache.GridCacheContext; import org.apache.ignite.internal.processors.cache.GridCacheEntryEx; import org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException; -import org.apache.ignite.internal.processors.cache.GridCacheFilterFailedException; import org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate; import org.apache.ignite.internal.processors.cache.GridCacheOperation; import org.apache.ignite.internal.processors.cache.GridCacheReturn; @@ -122,7 +121,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements Ig protected GridCacheVersion minVer; /** Flag indicating with TM commit happened. */ - protected volatile int doneFlag; + private volatile int doneFlag; /** Committed versions, relative to base. */ private Collection committedVers = Collections.emptyList(); @@ -134,7 +133,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements Ig private GridCacheVersion completedBase; /** Commit error. */ - protected volatile Throwable commitErr; + private volatile Throwable commitErr; /** Implicit transaction result. */ protected GridCacheReturn implicitRes; @@ -144,10 +143,10 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements Ig /** */ @GridToStringInclude - protected IgniteTxLocalState txState; + protected final IgniteTxLocalState txState; /** */ - protected CacheWriteSynchronizationMode syncMode; + private CacheWriteSynchronizationMode syncMode; /** */ protected volatile boolean qryEnlisted; @@ -370,8 +369,7 @@ protected boolean commitAfterLock() { @Nullable @Override public GridTuple peek( GridCacheContext cacheCtx, boolean failFast, - KeyCacheObject key - ) throws GridCacheFilterFailedException { + KeyCacheObject key) { IgniteTxEntry e = entry(cacheCtx.txKey(key)); if (e != null) @@ -483,7 +481,7 @@ public void calculatePartitionUpdateCounters() throws IgniteTxRollbackCheckedExc "[tx=" + CU.txString(this) + ", readyTopVer=" + top.readyTopologyVersion() + ", lostParts=" + top.lostPartitions() + - ", part=" + part.toString() + ']'); + ", part=" + part + ']'); throw new IgniteTxRollbackCheckedException("Failed to prepare a transaction on outdated " + "topology, please try again [timeout=" + timeout() + ", tx=" + CU.txString(this) + ']'); @@ -518,17 +516,6 @@ assert ownsLockUnsafe(entry) : "Lock is not owned for commit [entry=" + entry + ", tx=" + this + ']'; } - /** - * Gets cache entry for given key. - * - * @param cacheCtx Cache context. - * @param key Key. - * @return Cache entry. - */ - protected GridCacheEntryEx entryEx(GridCacheContext cacheCtx, IgniteTxKey key) { - return cacheCtx.cache().entryEx(key.key()); - } - /** * Gets cache entry for given key and topology version. * @@ -572,7 +559,7 @@ protected GridCacheEntryEx entryEx(GridCacheContext cacheCtx, IgniteTxKey key, A WALPointer ptr = null; - IgniteCheckedException err = null; + IgniteCheckedException err; cctx.database().checkpointReadLock(); @@ -611,10 +598,7 @@ protected GridCacheEntryEx entryEx(GridCacheContext cacheCtx, IgniteTxKey key, A boolean updateNearCache = updateNearCache(cacheCtx, txEntry.key(), topVer); - boolean metrics = true; - - if (!updateNearCache && cacheCtx.isNear() && txEntry.locallyMapped()) - metrics = false; + boolean metrics = updateNearCache || !cacheCtx.isNear() || !txEntry.locallyMapped(); boolean evt = !isNearLocallyMapped(txEntry, false); @@ -707,8 +691,6 @@ else if (conflictCtx.isUseNew()) { explicitVer = null; if (conflictNeedResolve) { - assert cacheCtx.isReplicated() || conflictNeedResolve; - txEntry.value(val, true, false); txEntry.op(op); txEntry.entryProcessors(null); @@ -831,7 +813,7 @@ else if (op == RELOAD) { cached.innerReload(); if (updateNearCache) - updateNearEntrySafely(cacheCtx, txEntry.key(), entry -> entry.innerReload()); + updateNearEntrySafely(cacheCtx, txEntry.key(), GridCacheEntryEx::innerReload); } else if (op == READ) { CacheGroupContext grp = cacheCtx.group(); @@ -1564,13 +1546,6 @@ else if (explicitCand.dhtLocal()) } } - /** - * @return Map of affected partitions: cacheId -> partId. - */ - public Map> partsMap() { - return null; - } - /** {@inheritDoc} */ @Override public void touchPartition(int cacheId, int partId) { txState.touchPartition(cacheId, partId); @@ -1601,9 +1576,8 @@ void entryExpiry(IgniteTxKey key, @Nullable ExpiryPolicy expiryPlc) { * @param key Key. * @param ttl TTL. * @param expireTime Expire time. - * @return {@code true} if tx entry exists for this key, {@code false} otherwise. */ - boolean entryTtlDr(IgniteTxKey key, long ttl, long expireTime) { + void entryTtlDr(IgniteTxKey key, long ttl, long expireTime) { assert key != null; assert ttl >= 0; @@ -1616,8 +1590,6 @@ boolean entryTtlDr(IgniteTxKey key, long ttl, long expireTime) { e.expiry(null); } - - return e != null; } /** @@ -1715,18 +1687,6 @@ protected abstract class PLC2 extends PostLockClosure2 { // No-op. } - /** - * Post-lock closure alias. - * - * @param Return type. - */ - protected abstract class PMC extends PostMissClosure { - /** */ - private static final long serialVersionUID = 0L; - - // No-op. - } - /** * Post-lock closure. * @@ -1737,10 +1697,10 @@ protected abstract class PostLockClosure1 implements IgniteBiClosure implements IgniteBiClosure postLock() throws IgniteCheckedException; } - /** - * Post-lock closure. - * - * @param Return type. - */ - protected abstract class PostMissClosure implements IgniteBiClosure> { - /** */ - private static final long serialVersionUID = 0L; - - /** {@inheritDoc} */ - @Override public final IgniteInternalFuture apply(T t, Exception e) { - boolean rollback = true; - - try { - if (e != null) - throw new GridClosureException(e); - - IgniteInternalFuture fut = postMiss(t); - - rollback = false; - - return fut; - } - catch (IgniteCheckedException ex) { - throw new GridClosureException(ex); - } - finally { - if (rollback) - setRollbackOnly(); - } - } - - /** - * Post lock callback. - * - * @param t Post-miss parameter. - * @return Future return value. - * @throws IgniteCheckedException If operation failed. - */ - protected abstract IgniteInternalFuture postMiss(T t) throws IgniteCheckedException; - } - /** * Clojure to perform operations with near cache entries. */