Class GridDhtTxLocalAdapter
- java.lang.Object
-
- org.apache.ignite.internal.util.lang.GridMetadataAwareAdapter
-
- org.apache.ignite.internal.processors.cache.transactions.IgniteTxAdapter
-
- org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter
-
- org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocalAdapter
-
- All Implemented Interfaces:
IgniteInternalTx,IgniteTxLocalEx
- Direct Known Subclasses:
GridDhtTxLocal,GridNearTxLocal
public abstract class GridDhtTxLocalAdapter extends IgniteTxLocalAdapter
Replicated user transaction.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter
IgniteTxLocalAdapter.PLC1<T>, IgniteTxLocalAdapter.PLC2<T>, IgniteTxLocalAdapter.PostLockClosure1<T>, IgniteTxLocalAdapter.PostLockClosure2<T>
-
Nested classes/interfaces inherited from class org.apache.ignite.internal.util.lang.GridMetadataAwareAdapter
GridMetadataAwareAdapter.EntryKey
-
Nested classes/interfaces inherited from interface org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx
IgniteInternalTx.FinalizationStatus
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<UUID,GridDistributedTxMapping>dhtMapDHT mappings.protected booleanexplicitLockprotected IgniteInternalFuture<?>lockFutEnlist or lock future what is currently in progress.protected booleanmappedMapped flag.protected Map<UUID,GridDistributedTxMapping>nearMapNear mappings.static IgniteInternalFuture<Boolean>ROLLBACK_FUTAsynchronous rollback marker for lock futures.-
Fields inherited from class org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter
COMMIT_ERR_UPD, DONE_FLAG_UPD, implicitRes, minVer, txState
-
Fields inherited from class org.apache.ignite.internal.processors.cache.transactions.IgniteTxAdapter
cctx, concurrency, consistentIdMapper, deploymentLdrId, implicit, invalidate, isDone, isolation, log, nodeId, onePhaseCommit, startTime, taskName, threadId, topVer, txNodes, txSize, xidVer
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedGridDhtTxLocalAdapter(GridCacheSharedContext cctx, GridCacheVersion xidVer, boolean implicit, boolean implicitSingle, boolean sys, boolean explicitLock, byte plc, TransactionConcurrency concurrency, TransactionIsolation isolation, long timeout, boolean invalidate, boolean storeEnabled, boolean onePhaseCommit, int txSize, @Nullable UUID subjId, int taskNameHash)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description @Nullable IgniteInternalFuture<Boolean>addEntry(long msgId, IgniteTxEntry e)voidaddInvalidPartition(int cacheId, int part)protected abstract @Nullable IgniteInternalFuture<Boolean>addReader(long msgId, GridDhtCacheEntry cached, IgniteTxEntry entry, AffinityTopologyVersion topVer)Adds reader to cached entry.protected IgniteInternalFuture<GridNearTxPrepareResponse>chainOnePhasePrepare(GridDhtTxPrepareFuture prepFut)voidclearLockFuture(@Nullable IgniteInternalFuture cond)Clears lock future.protected abstract voidclearPrepareFuture(GridDhtTxPrepareFuture fut)Removes previously created prepare future from atomic reference.booleancommitOnPrepare()booleanexplicitLock()voidexplicitLock(boolean explicitLock)<T> GridFutureAdapter<T>finishFuture(GridFutureAdapter<T> f, Throwable err, boolean clearLockFut)booleanlocalFinish(boolean commit, boolean clearThreadMap)Finishes transaction (either commit or rollback).protected voidmapExplicitLocks()Map explicit locks.protected abstract IgniteUuidnearFutureId()protected abstract UUIDnearNodeId()voidnearOnOriginatingNode(boolean hasNear)Sets flag that indicates that originating node has a near cache that participates in this transaction.booleanneedsCompletedVersions()voidpendingVersions(Collection<GridCacheVersion> pendingVers)booleanremoveMapping(UUID nodeId)protected abstract voidsendFinishReply(@Nullable Throwable err)StringtoString()@Nullable IgniteInternalFuture<?>tryRollbackAsync()Prepare async rollback.booleanupdateLockFuture(IgniteInternalFuture<?> oldFut, IgniteInternalFuture<?> newFut)Atomically updates lock future.-
Methods inherited from class org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter
accessPolicy, accessPolicy, activeCachesDeploymentEnabled, activeCachesDeploymentEnabled, addActiveCache, addEntry, addInvokeResult, allEntries, alternateVersions, calculatePartitionUpdateCounters, checkValid, checkValid, commitAfterLock, commitError, commitError, committedVersions, completedBase, completedVersions, empty, entry, entryEx, entryExpireTime, entryTtl, eventNodeId, hasInterceptor, hasWriteKey, implicitSingleResult, init, initResult, isStarted, masterNodeIds, minVersion, onOwnerChanged, originatingNodeId, peek, postLockWrite, readEntries, readMap, readSet, rolledbackVersions, seal, syncMode, syncMode, tmFinish, txState, updateExplicitVersion, userCommit, userPrepare, userRollback, writeEntries, writeMap, writeSet
-
Methods inherited from class org.apache.ignite.internal.processors.cache.transactions.IgniteTxAdapter
applyTransformClosures, applyTxSizes, batchStoreCommit, chainState, checkInternal, colocated, commitVersion, commitVersion, concurrency, conflictResolve, context, currentPrepareFuture, dht, done, equals, errorWhenCommitting, evictNearEntry, finalizationStatus, finishFuture, hashCode, heuristicException, implicit, implicitSingle, incrementalSnapshotId, incrementalSnapshotId, internal, invalidate, invalidPartitions, ioPolicy, isInvalidate, isNearLocallyMapped, isolation, isRollbackOnly, isSystemInvalidate, isWriteToStoreFromDhtValid, local, localResult, log, logTxFinishErrorSafe, markFinalizing, near, nearXidVersion, needReturnValue, needReturnValue, nodeId, onePhaseCommit, onePhaseCommit, optimistic, optimisticLockEntries, otherNodeId, ownedVersion, ownsLock, ownsLockUnsafe, pessimistic, readCommitted, recordStateChangedEvent, remainingTime, remote, repeatableRead, resolveTaskName, rollbackException, serializable, sessionEnd, setParentTx, setRollbackOnly, size, skipCompletedVersions, skipCompletedVersions, startTime, startTimeNanos, state, state, state, storeEnabled, storeEnabled, storeWriteThrough, subjectId, system, systemInvalidate, taskNameHash, threadId, timedOut, timeout, timeout, timeoutException, timeoutException, topologyVersion, topologyVersion, topologyVersionSnapshot, transactionNodes, transactionNodes, txCounters, uncommit, updateNearCache, user, writeVersion, writeVersion, xid, xidVersion
-
Methods inherited from class org.apache.ignite.internal.util.lang.GridMetadataAwareAdapter
addMeta, addMetaIfAbsent, addMetaIfAbsent, allMeta, clone, copyMeta, copyMeta, hasMeta, hasMeta, meta, putMetaIfAbsent, removeAllMeta, removeMeta, removeMeta, replaceMeta
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx
addMeta, colocated, commitAsync, commitVersion, commitVersion, concurrency, currentPrepareFuture, dht, done, errorWhenCommitting, finalizationStatus, finishFuture, implicit, implicitSingle, incrementalSnapshotId, incrementalSnapshotId, internal, invalidate, invalidPartitions, ioPolicy, isInvalidate, isolation, isRollbackOnly, isSystemInvalidate, label, local, localResult, markFinalizing, meta, near, nearXidVersion, nodeId, onePhaseCommit, optimistic, optimisticLockEntries, otherNodeId, ownedVersion, ownsLock, ownsLockUnsafe, pessimistic, readCommitted, remainingTime, removeMeta, repeatableRead, rollbackAsync, salvageTx, serializable, setRollbackOnly, size, startTime, startTimeNanos, state, state, storeEnabled, storeWriteThrough, subjectId, system, systemInvalidate, taskNameHash, threadId, timedOut, timeout, timeout, topologyVersion, topologyVersion, topologyVersionSnapshot, transactionNodes, txCounters, user, writeVersion, writeVersion, xid, xidVersion
-
-
-
-
Field Detail
-
ROLLBACK_FUT
public static final IgniteInternalFuture<Boolean> ROLLBACK_FUT
Asynchronous rollback marker for lock futures.
-
nearMap
protected final Map<UUID,GridDistributedTxMapping> nearMap
Near mappings.
-
dhtMap
protected final Map<UUID,GridDistributedTxMapping> dhtMap
DHT mappings.
-
mapped
protected volatile boolean mapped
Mapped flag.
-
explicitLock
protected boolean explicitLock
-
lockFut
@GridToStringExclude protected volatile IgniteInternalFuture<?> lockFut
Enlist or lock future what is currently in progress.
-
-
Constructor Detail
-
GridDhtTxLocalAdapter
protected GridDhtTxLocalAdapter(GridCacheSharedContext cctx, GridCacheVersion xidVer, boolean implicit, boolean implicitSingle, boolean sys, boolean explicitLock, byte plc, TransactionConcurrency concurrency, TransactionIsolation isolation, long timeout, boolean invalidate, boolean storeEnabled, boolean onePhaseCommit, int txSize, @Nullable @Nullable UUID subjId, int taskNameHash)
- Parameters:
xidVer- Transaction version.implicit- Implicit flag.implicitSingle- Implicit-with-single-key flag.cctx- Cache context.sys- System flag.concurrency- Concurrency.isolation- Isolation.timeout- Timeout.txSize- Expected transaction size.
-
-
Method Detail
-
nearOnOriginatingNode
public void nearOnOriginatingNode(boolean hasNear)
Sets flag that indicates that originating node has a near cache that participates in this transaction.- Parameters:
hasNear- Has near cache flag.
-
explicitLock
public boolean explicitLock()
- Returns:
Trueif explicit lock transaction.
-
explicitLock
public void explicitLock(boolean explicitLock)
- Parameters:
explicitLock- Explicit lock flag.
-
nearNodeId
protected abstract UUID nearNodeId()
- Returns:
- Near node id.
-
nearFutureId
protected abstract IgniteUuid nearFutureId()
- Returns:
- Near future ID.
-
addReader
@Nullable protected abstract @Nullable IgniteInternalFuture<Boolean> addReader(long msgId, GridDhtCacheEntry cached, IgniteTxEntry entry, AffinityTopologyVersion topVer)
Adds reader to cached entry.- Parameters:
msgId- Message ID.cached- Cached entry.entry- Transaction entry.topVer- Topology version.- Returns:
Trueif reader was added as a result of this call.
-
sendFinishReply
protected abstract void sendFinishReply(@Nullable @Nullable Throwable err)- Parameters:
err- Error, if any.
-
needsCompletedVersions
public boolean needsCompletedVersions()
- Specified by:
needsCompletedVersionsin interfaceIgniteInternalTx- Overrides:
needsCompletedVersionsin classIgniteTxAdapter- Returns:
Trueif transaction needs completed versions for processing.
-
pendingVersions
public void pendingVersions(Collection<GridCacheVersion> pendingVers)
- Parameters:
pendingVers- Versions for all pending locks that were in queue before tx locsk were released.
-
mapExplicitLocks
protected void mapExplicitLocks()
Map explicit locks.
-
removeMapping
public boolean removeMapping(UUID nodeId)
- Parameters:
nodeId- Node ID.- Returns:
Trueif mapping was removed.
-
addInvalidPartition
public void addInvalidPartition(int cacheId, int part)- Specified by:
addInvalidPartitionin interfaceIgniteInternalTx- Overrides:
addInvalidPartitionin classIgniteTxAdapter- Parameters:
cacheId- Cache id.part- Invalid partition.
-
addEntry
@Nullable public @Nullable IgniteInternalFuture<Boolean> addEntry(long msgId, IgniteTxEntry e) throws IgniteCheckedException
- Parameters:
msgId- Message ID.e- Entry to add.- Returns:
- Future for active transactions for the time when reader was added.
- Throws:
IgniteCheckedException- If failed.
-
localFinish
public boolean localFinish(boolean commit, boolean clearThreadMap) throws IgniteCheckedExceptionFinishes transaction (either commit or rollback).- Parameters:
commit-Trueif commit,falseif rollback.clearThreadMap- IftrueremovesGridNearTxLocalfrom thread map.- Returns:
Trueif state has been changed.- Throws:
IgniteCheckedException- If finish failed.
-
clearPrepareFuture
protected abstract void clearPrepareFuture(GridDhtTxPrepareFuture fut)
Removes previously created prepare future from atomic reference.- Parameters:
fut- Expected future.
-
commitOnPrepare
public final boolean commitOnPrepare()
- Returns:
Trueif transaction is finished on prepare step.
-
updateLockFuture
public boolean updateLockFuture(IgniteInternalFuture<?> oldFut, IgniteInternalFuture<?> newFut)
Atomically updates lock future.- Parameters:
oldFut- Old future.newFut- New future.- Returns:
trueIf future was changed.
-
clearLockFuture
public void clearLockFuture(@Nullable @Nullable IgniteInternalFuture cond)Clears lock future.- Parameters:
cond- Clear lock condition.
-
finishFuture
public <T> GridFutureAdapter<T> finishFuture(GridFutureAdapter<T> f, Throwable err, boolean clearLockFut)
- Parameters:
f- Future to finish.err- Error.clearLockFut-Trueif need to clear lock future.- Returns:
- Finished future.
-
tryRollbackAsync
@Nullable public @Nullable IgniteInternalFuture<?> tryRollbackAsync()
Prepare async rollback.- Returns:
- Current lock future or null if it's safe to roll back.
-
chainOnePhasePrepare
protected final IgniteInternalFuture<GridNearTxPrepareResponse> chainOnePhasePrepare(GridDhtTxPrepareFuture prepFut)
- Parameters:
prepFut- Prepare future.- Returns:
- If transaction is finished on prepare step returns future which is completed after transaction finish.
-
toString
public String toString()
- Overrides:
toStringin classIgniteTxLocalAdapter
-
-