Class GridDhtTxLocal
- 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
-
- org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocal
-
- All Implemented Interfaces:
GridCacheMappedVersion,IgniteInternalTx,IgniteTxLocalEx
public class GridDhtTxLocal extends GridDhtTxLocalAdapter implements GridCacheMappedVersion
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 inherited from class org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocalAdapter
dhtMap, explicitLock, lockFut, mapped, nearMap, ROLLBACK_FUT
-
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 Constructor Description GridDhtTxLocal(GridCacheSharedContext cctx, AffinityTopologyVersion topVer, UUID nearNodeId, GridCacheVersion nearXidVer, IgniteUuid nearFutId, int nearMiniId, long nearThreadId, boolean implicit, boolean implicitSingle, boolean sys, boolean explicitLock, byte plc, TransactionConcurrency concurrency, TransactionIsolation isolation, long timeout, boolean invalidate, boolean storeEnabled, boolean onePhaseCommit, int txSize, Map<UUID,Collection<UUID>> txNodes, UUID subjId, int taskNameHash, @Nullable String lb, GridNearTxLocal parentTx)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected @Nullable IgniteInternalFuture<Boolean>addReader(long msgId, GridDhtCacheEntry cached, IgniteTxEntry entry, AffinityTopologyVersion topVer)Adds reader to cached entry.protected voidclearPrepareFuture(GridDhtTxPrepareFuture fut)Removes previously created prepare future from atomic reference.IgniteInternalFuture<IgniteInternalTx>commitAsync()Asynchronously commits this transaction by initiatingtwo-phase-commitprocess.IgniteInternalFuture<IgniteInternalTx>commitDhtLocalAsync()@Nullable IgniteInternalFuture<?>currentPrepareFuture()booleandht()UUIDeventNodeId()@Nullable Stringlabel()Returns label of transactions.booleanlocalFinish(boolean commit, boolean clearThreadMap)Finishes transaction (either commit or rollback).GridCacheVersionmappedVersion()Mapping should occur only if this interface returns a non-null value.Collection<UUID>masterNodeIds()voidnearFinishFutureId(IgniteUuid nearFinFutId)voidnearFinishMiniId(int nearFinMiniId)protected IgniteUuidnearFutureId()voidnearFutureId(IgniteUuid nearFutId)protected UUIDnearNodeId()GridCacheVersionnearXidVersion()UUIDoriginatingNodeId()Gets node ID which directly started this transaction.UUIDotherNodeId()Gets ID of additional node involved.IgniteInternalFuture<GridNearTxPrepareResponse>prepareAsync(GridNearTxPrepareRequest req)Prepares next batch of entries in dht transaction.IgniteInternalFuture<IgniteInternalTx>rollbackAsync()Asynchronously rollback this transaction.voidrollbackDhtLocal()IgniteInternalFuture<IgniteInternalTx>rollbackDhtLocalAsync()IgniteInternalFuture<?>salvageTx()protected voidsendFinishReply(@Nullable Throwable err)StringtoString()protected voidupdateExplicitVersion(IgniteTxEntry txEntry, GridCacheEntryEx entry)Updates explicit version for tx entry based on current entry lock owner.protected booleanupdateNearCache(GridCacheContext cacheCtx, KeyCacheObject key, AffinityTopologyVersion topVer)Checks whether near cache should be updated.-
Methods inherited from class org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocalAdapter
addEntry, addInvalidPartition, chainOnePhasePrepare, clearLockFuture, commitOnPrepare, explicitLock, explicitLock, finishFuture, mapExplicitLocks, nearOnOriginatingNode, needsCompletedVersions, pendingVersions, removeMapping, tryRollbackAsync, updateLockFuture
-
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, hasInterceptor, hasWriteKey, implicitSingleResult, init, initResult, isStarted, minVersion, onOwnerChanged, peek, postLockWrite, readEntries, readMap, readSet, rolledbackVersions, seal, syncMode, syncMode, tmFinish, txState, 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, 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, needReturnValue, needReturnValue, nodeId, onePhaseCommit, onePhaseCommit, optimistic, optimisticLockEntries, 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, 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, commitVersion, commitVersion, concurrency, done, errorWhenCommitting, finalizationStatus, finishFuture, implicit, implicitSingle, incrementalSnapshotId, incrementalSnapshotId, internal, invalidate, invalidPartitions, ioPolicy, isInvalidate, isolation, isRollbackOnly, isSystemInvalidate, local, localResult, markFinalizing, meta, near, nodeId, onePhaseCommit, optimistic, optimisticLockEntries, ownedVersion, ownsLock, ownsLockUnsafe, pessimistic, readCommitted, remainingTime, removeMeta, repeatableRead, 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
-
-
-
-
Constructor Detail
-
GridDhtTxLocal
public GridDhtTxLocal(GridCacheSharedContext cctx, AffinityTopologyVersion topVer, UUID nearNodeId, GridCacheVersion nearXidVer, IgniteUuid nearFutId, int nearMiniId, long nearThreadId, boolean implicit, boolean implicitSingle, boolean sys, boolean explicitLock, byte plc, TransactionConcurrency concurrency, TransactionIsolation isolation, long timeout, boolean invalidate, boolean storeEnabled, boolean onePhaseCommit, int txSize, Map<UUID,Collection<UUID>> txNodes, UUID subjId, int taskNameHash, @Nullable @Nullable String lb, GridNearTxLocal parentTx)
- Parameters:
nearNodeId- Near node ID that initiated transaction.nearXidVer- Near transaction ID.nearFutId- Near future ID.nearMiniId- Near mini future ID.nearThreadId- Near thread ID.implicit- Implicit flag.implicitSingle- Implicit-with-single-key flag.cctx- Cache context.concurrency- Concurrency.isolation- Isolation.timeout- Timeout.storeEnabled- Store enabled flag.txSize- Expected transaction size.txNodes- Transaction nodes mapping.lb- Transaction label.parentTx- Transaction from which this transaction was copied by(if it was).
-
-
Method Detail
-
eventNodeId
public UUID eventNodeId()
- Specified by:
eventNodeIdin interfaceIgniteInternalTx- Overrides:
eventNodeIdin classIgniteTxLocalAdapter- Returns:
- Event node ID.
-
masterNodeIds
public Collection<UUID> masterNodeIds()
- Specified by:
masterNodeIdsin interfaceIgniteInternalTx- Overrides:
masterNodeIdsin classIgniteTxLocalAdapter- Returns:
- Master node IDs.
-
otherNodeId
public UUID otherNodeId()
Gets ID of additional node involved. For example, in DHT case, other node is near node ID.- Specified by:
otherNodeIdin interfaceIgniteInternalTx- Overrides:
otherNodeIdin classIgniteTxAdapter- Returns:
- Parent node IDs.
-
originatingNodeId
public UUID originatingNodeId()
Gets node ID which directly started this transaction. In case of DHT local transaction it will be near node ID, in case of DHT remote transaction it will be primary node ID.- Specified by:
originatingNodeIdin interfaceIgniteInternalTx- Overrides:
originatingNodeIdin classIgniteTxLocalAdapter- Returns:
- Originating node ID.
-
nearNodeId
protected UUID nearNodeId()
- Specified by:
nearNodeIdin classGridDhtTxLocalAdapter- Returns:
- Near node id.
-
nearXidVersion
public GridCacheVersion nearXidVersion()
- Specified by:
nearXidVersionin interfaceIgniteInternalTx- Overrides:
nearXidVersionin classIgniteTxAdapter- Returns:
- Near transaction ID.
-
mappedVersion
public GridCacheVersion mappedVersion()
Mapping should occur only if this interface returns a non-null value.- Specified by:
mappedVersionin interfaceGridCacheMappedVersion- Returns:
- Mapped version.
-
nearFutureId
protected IgniteUuid nearFutureId()
- Specified by:
nearFutureIdin classGridDhtTxLocalAdapter- Returns:
- Near future ID.
-
nearFutureId
public void nearFutureId(IgniteUuid nearFutId)
- Parameters:
nearFutId- Near future ID.
-
dht
public boolean dht()
- Specified by:
dhtin interfaceIgniteInternalTx- Overrides:
dhtin classIgniteTxAdapter- Returns:
Trueif DHT transaction.
-
updateNearCache
protected boolean updateNearCache(GridCacheContext cacheCtx, KeyCacheObject key, AffinityTopologyVersion topVer)
Checks whether near cache should be updated.- Overrides:
updateNearCachein classIgniteTxAdapter- Returns:
- Flag indicating whether near cache should be updated.
-
nearFinishFutureId
public void nearFinishFutureId(IgniteUuid nearFinFutId)
- Parameters:
nearFinFutId- Near future ID.
-
nearFinishMiniId
public void nearFinishMiniId(int nearFinMiniId)
- Parameters:
nearFinMiniId- Near future mini ID.
-
addReader
@Nullable protected @Nullable IgniteInternalFuture<Boolean> addReader(long msgId, GridDhtCacheEntry cached, IgniteTxEntry entry, AffinityTopologyVersion topVer)
Adds reader to cached entry.- Specified by:
addReaderin classGridDhtTxLocalAdapter- Parameters:
msgId- Message ID.cached- Cached entry.entry- Transaction entry.topVer- Topology version.- Returns:
Trueif reader was added as a result of this call.
-
updateExplicitVersion
protected void updateExplicitVersion(IgniteTxEntry txEntry, GridCacheEntryEx entry)
Updates explicit version for tx entry based on current entry lock owner.- Overrides:
updateExplicitVersionin classIgniteTxLocalAdapter- Parameters:
txEntry- Tx entry to update.entry- Entry.
-
salvageTx
public IgniteInternalFuture<?> salvageTx()
- Specified by:
salvageTxin interfaceIgniteInternalTx- Returns:
- Future.
-
prepareAsync
public final IgniteInternalFuture<GridNearTxPrepareResponse> prepareAsync(GridNearTxPrepareRequest req)
Prepares next batch of entries in dht transaction.- Parameters:
req- Prepare request.- Returns:
- Future that will be completed when locks are acquired.
-
commitDhtLocalAsync
public IgniteInternalFuture<IgniteInternalTx> commitDhtLocalAsync()
- Returns:
- Commit future.
-
commitAsync
public IgniteInternalFuture<IgniteInternalTx> commitAsync()
Asynchronously commits this transaction by initiatingtwo-phase-commitprocess.- Specified by:
commitAsyncin interfaceIgniteInternalTx- Returns:
- Future for commit operation.
-
label
@Nullable public @Nullable String label()
Returns label of transactions.- Specified by:
labelin interfaceIgniteInternalTx- Returns:
- Label of transaction or
nullif there was not set.
-
clearPrepareFuture
protected void clearPrepareFuture(GridDhtTxPrepareFuture fut)
Removes previously created prepare future from atomic reference.- Specified by:
clearPrepareFuturein classGridDhtTxLocalAdapter- Parameters:
fut- Expected future.
-
rollbackDhtLocal
public void rollbackDhtLocal() throws IgniteCheckedException- Throws:
IgniteCheckedException- If failed.
-
rollbackDhtLocalAsync
public IgniteInternalFuture<IgniteInternalTx> rollbackDhtLocalAsync()
- Returns:
- Rollback future.
-
rollbackAsync
public IgniteInternalFuture<IgniteInternalTx> rollbackAsync()
Asynchronously rollback this transaction.- Specified by:
rollbackAsyncin interfaceIgniteInternalTx- Returns:
- Rollback future.
-
localFinish
public boolean localFinish(boolean commit, boolean clearThreadMap) throws IgniteCheckedExceptionFinishes transaction (either commit or rollback).- Specified by:
localFinishin interfaceIgniteTxLocalEx- Overrides:
localFinishin classGridDhtTxLocalAdapter- Parameters:
commit-Trueif commit,falseif rollback.clearThreadMap- IftrueremovesGridNearTxLocalfrom thread map.- Returns:
Trueif state has been changed.- Throws:
IgniteCheckedException- If finish failed.
-
sendFinishReply
protected void sendFinishReply(@Nullable @Nullable Throwable err)- Specified by:
sendFinishReplyin classGridDhtTxLocalAdapter- Parameters:
err- Error, if any.
-
currentPrepareFuture
@Nullable public @Nullable IgniteInternalFuture<?> currentPrepareFuture()
- Specified by:
currentPrepareFuturein interfaceIgniteInternalTx- Overrides:
currentPrepareFuturein classIgniteTxAdapter- Returns:
- Future for transaction prepare if prepare is in progress.
-
toString
public String toString()
- Overrides:
toStringin classGridDhtTxLocalAdapter
-
-