# ignite-63
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/b89b472d Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/b89b472d Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/b89b472d Branch: refs/heads/ignite-63 Commit: b89b472d3df61a2bb23c73e11d19af9bec364738 Parents: b77f2a5 Author: sboikov <semen.boi...@inria.fr> Authored: Fri Jan 23 00:52:11 2015 +0300 Committer: sboikov <semen.boi...@inria.fr> Committed: Fri Jan 23 00:52:32 2015 +0300 ---------------------------------------------------------------------- .../GridClientAbstractMultiNodeSelfTest.java | 1 - .../distributed/GridCacheCommittedTxInfo.java | 112 + .../distributed/GridCacheMappedVersion.java | 33 + ...ridCacheOptimisticCheckPreparedTxFuture.java | 388 ++++ ...idCacheOptimisticCheckPreparedTxRequest.java | 227 ++ ...dCacheOptimisticCheckPreparedTxResponse.java | 198 ++ .../GridCachePerThreadTxCommitBuffer.java | 185 ++ ...dCachePessimisticCheckCommittedTxFuture.java | 380 ++++ ...CachePessimisticCheckCommittedTxRequest.java | 292 +++ ...achePessimisticCheckCommittedTxResponse.java | 231 ++ .../distributed/GridCacheTtlUpdateRequest.java | 500 +++++ .../distributed/GridCacheTxCommitBuffer.java | 60 + .../distributed/GridCacheTxFinishSync.java | 292 +++ .../distributed/GridDistributedBaseMessage.java | 456 ++++ .../GridDistributedCacheAdapter.java | 127 ++ .../distributed/GridDistributedCacheEntry.java | 850 ++++++++ .../GridDistributedLockCancelledException.java | 40 + .../distributed/GridDistributedLockRequest.java | 833 ++++++++ .../GridDistributedLockResponse.java | 436 ++++ .../GridDistributedTxFinishRequest.java | 695 ++++++ .../GridDistributedTxFinishResponse.java | 172 ++ .../distributed/GridDistributedTxMapping.java | 302 +++ .../GridDistributedTxPrepareRequest.java | 776 +++++++ .../GridDistributedTxPrepareResponse.java | 250 +++ .../GridDistributedTxRemoteAdapter.java | 775 +++++++ .../GridDistributedUnlockRequest.java | 239 +++ .../GridPartitionedCacheEntryImpl.java | 423 ++++ .../IgniteExternalizableExpiryPolicy.java | 174 ++ .../distributed/dht/GridDhtCacheAdapter.java | 1 - .../distributed/dht/GridDhtCacheEntry.java | 1 - .../distributed/dht/GridDhtLockFuture.java | 1 - .../distributed/dht/GridDhtLockRequest.java | 1 - .../distributed/dht/GridDhtLockResponse.java | 1 - .../dht/GridDhtTransactionalCacheAdapter.java | 1 - .../distributed/dht/GridDhtTxFinishFuture.java | 1 - .../distributed/dht/GridDhtTxFinishRequest.java | 1 - .../dht/GridDhtTxFinishResponse.java | 1 - .../cache/distributed/dht/GridDhtTxLocal.java | 1 - .../distributed/dht/GridDhtTxLocalAdapter.java | 1 - .../cache/distributed/dht/GridDhtTxMapping.java | 1 - .../distributed/dht/GridDhtTxPrepareFuture.java | 1 - .../dht/GridDhtTxPrepareRequest.java | 1 - .../dht/GridDhtTxPrepareResponse.java | 1 - .../cache/distributed/dht/GridDhtTxRemote.java | 1 - .../distributed/dht/GridDhtUnlockRequest.java | 1 - .../dht/atomic/GridDhtAtomicCacheEntry.java | 1 - .../dht/atomic/GridNearAtomicUpdateRequest.java | 1 - .../dht/colocated/GridDhtColocatedCache.java | 1 - .../colocated/GridDhtColocatedCacheEntry.java | 1 - .../colocated/GridDhtColocatedLockFuture.java | 1 - .../colocated/GridDhtDetachedCacheEntry.java | 1 - .../distributed/near/GridNearCacheAdapter.java | 1 - .../distributed/near/GridNearCacheEntry.java | 1 - .../distributed/near/GridNearLockFuture.java | 1 - .../distributed/near/GridNearLockRequest.java | 1 - .../distributed/near/GridNearLockResponse.java | 1 - .../near/GridNearTransactionalCache.java | 1 - .../near/GridNearTxFinishFuture.java | 1 - .../near/GridNearTxFinishRequest.java | 1 - .../near/GridNearTxFinishResponse.java | 1 - .../cache/distributed/near/GridNearTxLocal.java | 1 - .../near/GridNearTxPrepareFuture.java | 1 - .../near/GridNearTxPrepareRequest.java | 1 - .../near/GridNearTxPrepareResponse.java | 1 - .../distributed/near/GridNearTxRemote.java | 1 - .../distributed/near/GridNearUnlockRequest.java | 1 - .../cache/transactions/IgniteTxEntry.java | 1 - .../cache/transactions/IgniteTxHandler.java | 1 - .../cache/transactions/IgniteTxManager.java | 1 - .../GridTcpCommunicationMessageFactory.java | 1 - .../processors/cache/GridCacheEntryEx.java | 1 - .../processors/cache/GridCacheMvccCallback.java | 2 - .../processors/cache/GridCacheMvccManager.java | 1 - .../kernal/processors/cache/GridCacheUtils.java | 1 - .../distributed/GridCacheCommittedTxInfo.java | 112 - .../distributed/GridCacheMappedVersion.java | 33 - ...ridCacheOptimisticCheckPreparedTxFuture.java | 388 ---- ...idCacheOptimisticCheckPreparedTxRequest.java | 227 -- ...dCacheOptimisticCheckPreparedTxResponse.java | 198 -- .../GridCachePerThreadTxCommitBuffer.java | 185 -- ...dCachePessimisticCheckCommittedTxFuture.java | 380 ---- ...CachePessimisticCheckCommittedTxRequest.java | 292 --- ...achePessimisticCheckCommittedTxResponse.java | 231 -- .../distributed/GridCacheTtlUpdateRequest.java | 500 ----- .../distributed/GridCacheTxCommitBuffer.java | 60 - .../distributed/GridCacheTxFinishSync.java | 292 --- .../distributed/GridDistributedBaseMessage.java | 456 ---- .../GridDistributedCacheAdapter.java | 127 -- .../distributed/GridDistributedCacheEntry.java | 850 -------- .../GridDistributedLockCancelledException.java | 40 - .../distributed/GridDistributedLockRequest.java | 833 -------- .../GridDistributedLockResponse.java | 436 ---- .../GridDistributedTxFinishRequest.java | 695 ------ .../GridDistributedTxFinishResponse.java | 172 -- .../distributed/GridDistributedTxMapping.java | 302 --- .../GridDistributedTxPrepareRequest.java | 776 ------- .../GridDistributedTxPrepareResponse.java | 250 --- .../GridDistributedTxRemoteAdapter.java | 775 ------- .../GridDistributedUnlockRequest.java | 239 --- .../GridPartitionedCacheEntryImpl.java | 423 ---- .../IgniteExternalizableExpiryPolicy.java | 174 -- ...tractDistributedByteArrayValuesSelfTest.java | 389 ++++ .../GridCacheAbstractJobExecutionTest.java | 183 ++ .../GridCacheAbstractNodeRestartSelfTest.java | 886 ++++++++ ...tractPartitionedByteArrayValuesSelfTest.java | 100 + .../GridCacheAbstractPrimarySyncSelfTest.java | 108 + .../GridCacheAtomicTimeoutSelfTest.java | 296 +++ .../GridCacheBasicOpAbstractTest.java | 388 ++++ .../GridCacheClientModesAbstractSelfTest.java | 209 ++ .../GridCacheEntrySetAbstractSelfTest.java | 117 ++ ...acheEntrySetIterationPreloadingSelfTest.java | 90 + .../distributed/GridCacheEventAbstractTest.java | 964 +++++++++ ...heExpiredEntriesPreloadAbstractSelfTest.java | 118 ++ .../distributed/GridCacheLockAbstractTest.java | 462 ++++ .../distributed/GridCacheMixedModeSelfTest.java | 81 + .../GridCacheModuloAffinityFunction.java | 200 ++ .../GridCacheMultiNodeAbstractTest.java | 490 +++++ .../GridCacheMultiNodeLockAbstractTest.java | 634 ++++++ ...dCacheMultithreadedFailoverAbstractTest.java | 606 ++++++ .../GridCacheNodeFailureAbstractTest.java | 296 +++ ...dCachePartitionedAffinityFilterSelfTest.java | 144 ++ ...chePartitionedReloadAllAbstractSelfTest.java | 248 +++ .../GridCachePreloadEventsAbstractSelfTest.java | 131 ++ .../GridCachePreloadLifecycleAbstractTest.java | 231 ++ ...GridCachePreloadRestartAbstractSelfTest.java | 322 +++ .../GridCacheTransformEventSelfTest.java | 609 ++++++ ...iteTxConsistencyRestartAbstractSelfTest.java | 202 ++ ...xOriginatingNodeFailureAbstractSelfTest.java | 305 +++ ...cOriginatingNodeFailureAbstractSelfTest.java | 503 +++++ .../IgniteTxPreloadAbstractTest.java | 220 ++ .../IgniteTxTimeoutAbstractTest.java | 155 ++ ...tPartitionedOnlyByteArrayValuesSelfTest.java | 1 - ...acheAtomicExpiredEntriesPreloadSelfTest.java | 1 - .../dht/GridCacheAtomicReloadAllSelfTest.java | 1 - .../dht/GridCacheClientOnlySelfTest.java | 1 - ...ridCacheColocatedPreloadRestartSelfTest.java | 2 - .../GridCacheColocatedPrimarySyncSelfTest.java | 1 - .../GridCacheColocatedReloadAllSelfTest.java | 2 - ...ssimisticOriginatingNodeFailureSelfTest.java | 1 - .../dht/GridCacheDhtEntrySetSelfTest.java | 1 - ...idCacheDhtExpiredEntriesPreloadSelfTest.java | 1 - .../dht/GridCacheDhtTxPreloadSelfTest.java | 1 - ...idCachePartitionedPreloadEventsSelfTest.java | 1 - ...itionedTxOriginatingNodeFailureSelfTest.java | 1 - ...teTxConsistencyColocatedRestartSelfTest.java | 1 - ...tNearPartitionedByteArrayValuesSelfTest.java | 1 - ...dCacheNearExpiredEntriesPreloadSelfTest.java | 1 - .../near/GridCacheNearJobExecutionSelfTest.java | 1 - .../near/GridCacheNearMultiNodeSelfTest.java | 1 - .../near/GridCacheNearOnlySelfTest.java | 1 - .../GridCacheNearPreloadRestartSelfTest.java | 2 - .../near/GridCacheNearPrimarySyncSelfTest.java | 1 - .../near/GridCacheNearReadersSelfTest.java | 1 - .../near/GridCacheNearReloadAllSelfTest.java | 2 - ...ssimisticOriginatingNodeFailureSelfTest.java | 1 - .../near/GridCacheNearTxPreloadSelfTest.java | 1 - .../GridCachePartitionedBasicOpSelfTest.java | 1 - .../near/GridCachePartitionedEventSelfTest.java | 1 - .../near/GridCachePartitionedLockSelfTest.java | 1 - ...idCachePartitionedMultiNodeLockSelfTest.java | 1 - .../GridCachePartitionedMultiNodeSelfTest.java | 1 - ...GridCachePartitionedNodeFailureSelfTest.java | 1 - .../GridCachePartitionedNodeRestartTest.java | 1 - ...ePartitionedOptimisticTxNodeRestartTest.java | 1 - ...achePartitionedPreloadLifecycleSelfTest.java | 1 - .../GridCachePartitionedStorePutSelfTest.java | 2 - .../GridCachePartitionedTxTimeoutSelfTest.java | 1 - ...stractReplicatedByteArrayValuesSelfTest.java | 83 + ...ridCacheAtomicReplicatedMetricsSelfTest.java | 59 + .../GridCacheDaemonNodeReplicatedSelfTest.java | 31 + .../GridCacheExReplicatedFullApiSelfTest.java | 33 + ...cheGroupLockMultiNodeReplicatedSelfTest.java | 45 + .../GridCacheGroupLockReplicatedSelfTest.java | 39 + ...ridCacheReplicatedAtomicFullApiSelfTest.java | 42 + ...catedAtomicGetAndTransformStoreSelfTest.java | 33 + ...eplicatedAtomicMultiNodeFullApiSelfTest.java | 59 + ...imaryWriteOrderMultiNodeFullApiSelfTest.java | 33 + .../GridCacheReplicatedBasicApiTest.java | 42 + .../GridCacheReplicatedBasicOpSelfTest.java | 41 + .../GridCacheReplicatedBasicStoreSelfTest.java | 33 + .../GridCacheReplicatedClientOnlySelfTest.java | 42 + .../GridCacheReplicatedEntrySetSelfTest.java | 32 + .../GridCacheReplicatedEventSelfTest.java | 37 + ...ridCacheReplicatedEvictionEventSelfTest.java | 38 + .../GridCacheReplicatedEvictionSelfTest.java | 130 ++ .../GridCacheReplicatedFailoverSelfTest.java | 33 + .../GridCacheReplicatedFlagsTest.java | 28 + ...eReplicatedFullApiMultithreadedSelfTest.java | 38 + ...ReplicatedFullApiMultithreadedSelfTest1.java | 1980 ++++++++++++++++++ .../GridCacheReplicatedFullApiSelfTest.java | 57 + ...eReplicatedGetAndTransformStoreSelfTest.java | 39 + .../GridCacheReplicatedInvalidateSelfTest.java | 244 +++ .../GridCacheReplicatedIteratorsSelfTest.java | 43 + .../GridCacheReplicatedJobExecutionTest.java | 44 + .../GridCacheReplicatedLockSelfTest.java | 32 + .../GridCacheReplicatedMarshallerTxTest.java | 47 + .../GridCacheReplicatedMetricsSelfTest.java | 54 + ...CacheReplicatedMultiNodeFullApiSelfTest.java | 28 + ...ridCacheReplicatedMultiNodeLockSelfTest.java | 41 + ...atedMultiNodeP2PDisabledFullApiSelfTest.java | 35 + .../GridCacheReplicatedMultiNodeSelfTest.java | 41 + ...licatedNearOnlyMultiNodeFullApiSelfTest.java | 39 + .../GridCacheReplicatedNearOnlySelfTest.java | 42 + .../GridCacheReplicatedNodeFailureSelfTest.java | 45 + .../GridCacheReplicatedNodeRestartSelfTest.java | 53 + ...idCacheReplicatedOffHeapFullApiSelfTest.java | 28 + ...plicatedOffHeapMultiNodeFullApiSelfTest.java | 28 + ...catedP2PDisabledByteArrayValuesSelfTest.java | 29 + ...icatedP2PEnabledByteArrayValuesSelfTest.java | 29 + ...ridCacheReplicatedPreloadEventsSelfTest.java | 31 + .../GridCacheReplicatedProjectionSelfTest.java | 66 + ...dezvousAffinityMultiNodeFullApiSelfTest.java | 35 + .../GridCacheReplicatedTxConcurrentGetTest.java | 45 + .../GridCacheReplicatedTxExceptionSelfTest.java | 39 + ...GridCacheReplicatedTxMultiNodeBasicTest.java | 81 + ...dCacheReplicatedTxMultiThreadedSelfTest.java | 111 + ...licatedTxOriginatingNodeFailureSelfTest.java | 36 + ...ssimisticOriginatingNodeFailureSelfTest.java | 46 + .../GridCacheReplicatedTxReadTest.java | 33 + ...CacheReplicatedTxSingleThreadedSelfTest.java | 102 + .../GridCacheReplicatedTxTimeoutSelfTest.java | 59 + ...idCacheReplicatedUnswapAdvancedSelfTest.java | 171 ++ .../GridCacheSyncReplicatedPreloadSelfTest.java | 166 ++ .../replicated/GridReplicatedTxPreloadTest.java | 32 + ...CacheReplicatedPreloadLifecycleSelfTest.java | 292 +++ ...idCacheReplicatedPreloadOffHeapSelfTest.java | 39 + .../GridCacheReplicatedPreloadSelfTest.java | 582 +++++ ...eplicatedPreloadStartStopEventsSelfTest.java | 95 + ...GridCacheReplicatedPreloadUndeploysTest.java | 87 + .../local/GridCacheLocalEventSelfTest.java | 1 - .../grid/kernal/GridAffinityMappedTest.java | 1 - .../grid/kernal/GridAffinityP2PSelfTest.java | 1 - .../cache/GridCacheP2PUndeploySelfTest.java | 1 - .../GridCachePreloadingEvictionsSelfTest.java | 1 - ...ridCacheReplicatedSynchronousCommitTest.java | 1 - .../cache/IgniteTxReentryAbstractSelfTest.java | 1 - ...tractDistributedByteArrayValuesSelfTest.java | 390 ---- .../GridCacheAbstractJobExecutionTest.java | 183 -- .../GridCacheAbstractNodeRestartSelfTest.java | 886 -------- ...tractPartitionedByteArrayValuesSelfTest.java | 101 - .../GridCacheAbstractPrimarySyncSelfTest.java | 109 - .../GridCacheAtomicTimeoutSelfTest.java | 296 --- .../GridCacheBasicOpAbstractTest.java | 388 ---- .../GridCacheClientModesAbstractSelfTest.java | 209 -- .../GridCacheEntrySetAbstractSelfTest.java | 117 -- ...acheEntrySetIterationPreloadingSelfTest.java | 91 - .../distributed/GridCacheEventAbstractTest.java | 964 --------- ...heExpiredEntriesPreloadAbstractSelfTest.java | 118 -- .../distributed/GridCacheLockAbstractTest.java | 463 ---- .../distributed/GridCacheMixedModeSelfTest.java | 81 - .../GridCacheModuloAffinityFunction.java | 200 -- .../GridCacheMultiNodeAbstractTest.java | 490 ----- .../GridCacheMultiNodeLockAbstractTest.java | 634 ------ ...dCacheMultithreadedFailoverAbstractTest.java | 606 ------ .../GridCacheNodeFailureAbstractTest.java | 296 --- ...dCachePartitionedAffinityFilterSelfTest.java | 144 -- ...chePartitionedReloadAllAbstractSelfTest.java | 248 --- .../GridCachePreloadEventsAbstractSelfTest.java | 131 -- .../GridCachePreloadLifecycleAbstractTest.java | 231 -- ...GridCachePreloadRestartAbstractSelfTest.java | 322 --- .../GridCacheTransformEventSelfTest.java | 609 ------ ...iteTxConsistencyRestartAbstractSelfTest.java | 202 -- ...xOriginatingNodeFailureAbstractSelfTest.java | 305 --- ...cOriginatingNodeFailureAbstractSelfTest.java | 503 ----- .../IgniteTxPreloadAbstractTest.java | 220 -- .../IgniteTxTimeoutAbstractTest.java | 155 -- ...stractReplicatedByteArrayValuesSelfTest.java | 84 - ...ridCacheAtomicReplicatedMetricsSelfTest.java | 59 - .../GridCacheDaemonNodeReplicatedSelfTest.java | 31 - .../GridCacheExReplicatedFullApiSelfTest.java | 33 - ...cheGroupLockMultiNodeReplicatedSelfTest.java | 45 - .../GridCacheGroupLockReplicatedSelfTest.java | 39 - ...ridCacheReplicatedAtomicFullApiSelfTest.java | 42 - ...catedAtomicGetAndTransformStoreSelfTest.java | 33 - ...eplicatedAtomicMultiNodeFullApiSelfTest.java | 60 - ...imaryWriteOrderMultiNodeFullApiSelfTest.java | 33 - .../GridCacheReplicatedBasicApiTest.java | 42 - .../GridCacheReplicatedBasicOpSelfTest.java | 42 - .../GridCacheReplicatedBasicStoreSelfTest.java | 33 - .../GridCacheReplicatedClientOnlySelfTest.java | 42 - .../GridCacheReplicatedEntrySetSelfTest.java | 33 - .../GridCacheReplicatedEventSelfTest.java | 38 - ...ridCacheReplicatedEvictionEventSelfTest.java | 38 - .../GridCacheReplicatedEvictionSelfTest.java | 130 -- .../GridCacheReplicatedFailoverSelfTest.java | 33 - .../GridCacheReplicatedFlagsTest.java | 28 - ...eReplicatedFullApiMultithreadedSelfTest.java | 38 - ...ReplicatedFullApiMultithreadedSelfTest1.java | 1980 ------------------ .../GridCacheReplicatedFullApiSelfTest.java | 57 - ...eReplicatedGetAndTransformStoreSelfTest.java | 39 - .../GridCacheReplicatedInvalidateSelfTest.java | 244 --- .../GridCacheReplicatedIteratorsSelfTest.java | 43 - .../GridCacheReplicatedJobExecutionTest.java | 45 - .../GridCacheReplicatedLockSelfTest.java | 33 - .../GridCacheReplicatedMarshallerTxTest.java | 47 - .../GridCacheReplicatedMetricsSelfTest.java | 54 - ...CacheReplicatedMultiNodeFullApiSelfTest.java | 28 - ...ridCacheReplicatedMultiNodeLockSelfTest.java | 42 - ...atedMultiNodeP2PDisabledFullApiSelfTest.java | 35 - .../GridCacheReplicatedMultiNodeSelfTest.java | 42 - ...licatedNearOnlyMultiNodeFullApiSelfTest.java | 39 - .../GridCacheReplicatedNearOnlySelfTest.java | 42 - .../GridCacheReplicatedNodeFailureSelfTest.java | 46 - .../GridCacheReplicatedNodeRestartSelfTest.java | 54 - ...idCacheReplicatedOffHeapFullApiSelfTest.java | 28 - ...plicatedOffHeapMultiNodeFullApiSelfTest.java | 28 - ...catedP2PDisabledByteArrayValuesSelfTest.java | 29 - ...icatedP2PEnabledByteArrayValuesSelfTest.java | 29 - ...ridCacheReplicatedPreloadEventsSelfTest.java | 32 - .../GridCacheReplicatedProjectionSelfTest.java | 66 - ...dezvousAffinityMultiNodeFullApiSelfTest.java | 35 - .../GridCacheReplicatedTxConcurrentGetTest.java | 45 - .../GridCacheReplicatedTxExceptionSelfTest.java | 39 - ...GridCacheReplicatedTxMultiNodeBasicTest.java | 81 - ...dCacheReplicatedTxMultiThreadedSelfTest.java | 111 - ...licatedTxOriginatingNodeFailureSelfTest.java | 37 - ...ssimisticOriginatingNodeFailureSelfTest.java | 47 - .../GridCacheReplicatedTxReadTest.java | 33 - ...CacheReplicatedTxSingleThreadedSelfTest.java | 102 - .../GridCacheReplicatedTxTimeoutSelfTest.java | 60 - ...idCacheReplicatedUnswapAdvancedSelfTest.java | 171 -- .../GridCacheSyncReplicatedPreloadSelfTest.java | 166 -- .../replicated/GridReplicatedTxPreloadTest.java | 33 - ...CacheReplicatedPreloadLifecycleSelfTest.java | 293 --- ...idCacheReplicatedPreloadOffHeapSelfTest.java | 39 - .../GridCacheReplicatedPreloadSelfTest.java | 582 ----- ...eplicatedPreloadStartStopEventsSelfTest.java | 95 - ...GridCacheReplicatedPreloadUndeploysTest.java | 87 - .../GridCacheDistributedEvictionsSelfTest.java | 1 - .../GridCacheFullApiSelfTestSuite.java | 1 - .../GridCacheGroupLockSelfTestSuite.java | 1 - .../GridCacheIteratorsSelfTestSuite.java | 1 - .../GridCacheMetricsSelfTestSuite.java | 1 - .../GridCacheNearOnlySelfTestSuite.java | 1 - .../GridCacheTxRecoverySelfTestSuite.java | 1 - .../bamboo/GridDataGridTestSuite.java | 4 +- ...eplicatedFieldsQueryP2PDisabledSelfTest.java | 34 + .../GridCacheReplicatedFieldsQuerySelfTest.java | 157 ++ ...CacheReplicatedQueryP2PDisabledSelfTest.java | 34 + .../GridCacheReplicatedQuerySelfTest.java | 683 ++++++ ...eplicatedFieldsQueryP2PDisabledSelfTest.java | 34 - .../GridCacheReplicatedFieldsQuerySelfTest.java | 157 -- ...CacheReplicatedQueryP2PDisabledSelfTest.java | 34 - .../GridCacheReplicatedQuerySelfTest.java | 683 ------ .../testsuites/GridCacheQuerySelfTestSuite.java | 1 - 345 files changed, 26119 insertions(+), 26247 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b89b472d/modules/clients/src/test/java/org/apache/ignite/client/integration/GridClientAbstractMultiNodeSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/clients/src/test/java/org/apache/ignite/client/integration/GridClientAbstractMultiNodeSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/client/integration/GridClientAbstractMultiNodeSelfTest.java index 4aad390..5e0ac1e 100644 --- a/modules/clients/src/test/java/org/apache/ignite/client/integration/GridClientAbstractMultiNodeSelfTest.java +++ b/modules/clients/src/test/java/org/apache/ignite/client/integration/GridClientAbstractMultiNodeSelfTest.java @@ -35,7 +35,6 @@ import org.apache.ignite.client.balancer.*; import org.apache.ignite.client.ssl.*; import org.apache.ignite.internal.managers.communication.*; import org.gridgain.grid.kernal.processors.cache.*; -import org.gridgain.grid.kernal.processors.cache.distributed.*; import org.apache.ignite.internal.processors.cache.transactions.*; import org.apache.ignite.internal.util.direct.*; import org.apache.ignite.internal.util.typedef.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b89b472d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheCommittedTxInfo.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheCommittedTxInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheCommittedTxInfo.java new file mode 100644 index 0000000..6438e31 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheCommittedTxInfo.java @@ -0,0 +1,112 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.cache.distributed; + +import org.gridgain.grid.kernal.processors.cache.*; +import org.apache.ignite.internal.processors.cache.transactions.*; +import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.internal.util.tostring.*; + +import java.io.*; +import java.util.*; + +/** + * Committed transaction information. Contains recovery writes that will be used to set commit values + * in case if originating node crashes. + */ +public class GridCacheCommittedTxInfo<K, V> implements Externalizable { + /** */ + private static final long serialVersionUID = 0L; + + /** Originating transaction ID. */ + private GridCacheVersion originatingTxId; + + /** Originating node ID. */ + private UUID originatingNodeId; + + /** Recovery writes, i.e. values that have never been sent to remote nodes. */ + @GridToStringInclude + private Collection<IgniteTxEntry<K, V>> recoveryWrites; + + /** + * Empty constructor required by {@link Externalizable}. + */ + public GridCacheCommittedTxInfo() { + // No-op. + } + + /** + * @param tx Committed cache transaction. + */ + public GridCacheCommittedTxInfo(IgniteTxEx<K, V> tx) { + assert !tx.local() || !tx.replicated(); + + originatingTxId = tx.nearXidVersion(); + originatingNodeId = tx.eventNodeId(); + + recoveryWrites = tx.recoveryWrites(); + } + + /** + * @return Originating transaction ID (the transaction ID for replicated cache and near transaction ID + * for partitioned cache). + */ + public GridCacheVersion originatingTxId() { + return originatingTxId; + } + + /** + * @return Originating node ID (the local transaction node ID for replicated cache and near node ID + * for partitioned cache). + */ + public UUID originatingNodeId() { + return originatingNodeId; + } + + /** + * @return Collection of recovery writes. + */ + public Collection<IgniteTxEntry<K, V>> recoveryWrites() { + return recoveryWrites == null ? Collections.<IgniteTxEntry<K, V>>emptyList() : recoveryWrites; + } + + /** {@inheritDoc} */ + @Override public void writeExternal(ObjectOutput out) throws IOException { + originatingTxId.writeExternal(out); + + U.writeUuid(out, originatingNodeId); + + U.writeCollection(out, recoveryWrites); + } + + /** {@inheritDoc} */ + @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { + originatingTxId = new GridCacheVersion(); + + originatingTxId.readExternal(in); + + originatingNodeId = U.readUuid(in); + + recoveryWrites = U.readCollection(in); + } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(GridCacheCommittedTxInfo.class, this, "recoveryWrites", recoveryWrites); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b89b472d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMappedVersion.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMappedVersion.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMappedVersion.java new file mode 100644 index 0000000..885bc90 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMappedVersion.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.cache.distributed; + +import org.gridgain.grid.kernal.processors.cache.*; +import org.jetbrains.annotations.*; + +/** + * Interface mostly for Near to DHT version mapping. + */ +public interface GridCacheMappedVersion { + /** + * Mapping should occur only if this interface returns a non-null value. + * + * @return Mapped version. + */ + @Nullable public GridCacheVersion mappedVersion(); +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b89b472d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxFuture.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxFuture.java new file mode 100644 index 0000000..dcaabdd --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxFuture.java @@ -0,0 +1,388 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.cache.distributed; + +import org.apache.ignite.*; +import org.apache.ignite.cluster.*; +import org.apache.ignite.internal.util.*; +import org.apache.ignite.lang.*; +import org.gridgain.grid.kernal.processors.cache.*; +import org.apache.ignite.internal.processors.cache.transactions.*; +import org.apache.ignite.internal.util.future.*; +import org.apache.ignite.internal.util.typedef.internal.*; +import org.jetbrains.annotations.*; + +import java.io.*; +import java.util.*; +import java.util.concurrent.atomic.*; + +/** + * Future verifying that all remote transactions related to some + * optimistic transaction were prepared. + */ +public class GridCacheOptimisticCheckPreparedTxFuture<K, V> extends GridCompoundIdentityFuture<Boolean> + implements GridCacheFuture<Boolean> { + /** */ + private static final long serialVersionUID = 0L; + + /** Logger reference. */ + private static final AtomicReference<IgniteLogger> logRef = new AtomicReference<>(); + + /** Trackable flag. */ + private boolean trackable = true; + + /** Context. */ + private final GridCacheSharedContext<K, V> cctx; + + /** Future ID. */ + private final IgniteUuid futId = IgniteUuid.randomUuid(); + + /** Transaction. */ + private final IgniteTxEx<K, V> tx; + + /** All involved nodes. */ + private final Map<UUID, ClusterNode> nodes; + + /** ID of failed node started transaction. */ + private final UUID failedNodeId; + + /** Logger. */ + private final IgniteLogger log; + + /** Transaction nodes mapping. */ + private final Map<UUID, Collection<UUID>> txNodes; + + /** + * @param cctx Context. + * @param tx Transaction. + * @param failedNodeId ID of failed node started transaction. + * @param txNodes Transaction mapping. + */ + @SuppressWarnings("ConstantConditions") + public GridCacheOptimisticCheckPreparedTxFuture(GridCacheSharedContext<K, V> cctx, IgniteTxEx<K, V> tx, + UUID failedNodeId, Map<UUID, Collection<UUID>> txNodes) { + super(cctx.kernalContext(), CU.boolReducer()); + + this.cctx = cctx; + this.tx = tx; + this.txNodes = txNodes; + this.failedNodeId = failedNodeId; + + log = U.logger(ctx, logRef, GridCacheOptimisticCheckPreparedTxFuture.class); + + nodes = new GridLeanMap<>(); + + UUID locNodeId = cctx.localNodeId(); + + for (Map.Entry<UUID, Collection<UUID>> e : tx.transactionNodes().entrySet()) { + if (!locNodeId.equals(e.getKey()) && !failedNodeId.equals(e.getKey()) && !nodes.containsKey(e.getKey())) { + ClusterNode node = cctx.discovery().node(e.getKey()); + + if (node != null) + nodes.put(node.id(), node); + else if (log.isDebugEnabled()) + log.debug("Transaction node left (will ignore) " + e.getKey()); + } + + for (UUID nodeId : e.getValue()) { + if (!locNodeId.equals(nodeId) && !failedNodeId.equals(nodeId) && !nodes.containsKey(nodeId)) { + ClusterNode node = cctx.discovery().node(nodeId); + + if (node != null) + nodes.put(node.id(), node); + else if (log.isDebugEnabled()) + log.debug("Transaction node left (will ignore) " + e.getKey()); + } + } + } + } + + /** + * Initializes future. + */ + @SuppressWarnings("ConstantConditions") + public void prepare() { + // First check transactions on local node. + int locTxNum = nodeTransactions(cctx.localNodeId()); + + if (locTxNum > 1 && !cctx.tm().txsPreparedOrCommitted(tx.nearXidVersion(), locTxNum)) { + onDone(false); + + markInitialized(); + + return; + } + + for (Map.Entry<UUID, Collection<UUID>> entry : txNodes.entrySet()) { + UUID nodeId = entry.getKey(); + + // Skip left nodes and local node. + if (!nodes.containsKey(nodeId) && nodeId.equals(cctx.localNodeId())) + continue; + + /* + * If primary node failed then send message to all backups, otherwise + * send message only to primary node. + */ + + if (nodeId.equals(failedNodeId)) { + for (UUID id : entry.getValue()) { + // Skip backup node if it is local node or if it is also was mapped as primary. + if (txNodes.containsKey(id) || id.equals(cctx.localNodeId())) + continue; + + MiniFuture fut = new MiniFuture(id); + + add(fut); + + GridCacheOptimisticCheckPreparedTxRequest<K, V> + req = new GridCacheOptimisticCheckPreparedTxRequest<>(tx, + nodeTransactions(id), futureId(), fut.futureId()); + + try { + cctx.io().send(id, req); + } + catch (ClusterTopologyException ignored) { + fut.onNodeLeft(); + } + catch (IgniteCheckedException e) { + fut.onError(e); + + break; + } + } + } + else { + MiniFuture fut = new MiniFuture(nodeId); + + add(fut); + + GridCacheOptimisticCheckPreparedTxRequest<K, V> req = new GridCacheOptimisticCheckPreparedTxRequest<>(tx, + nodeTransactions(nodeId), futureId(), fut.futureId()); + + try { + cctx.io().send(nodeId, req); + } + catch (ClusterTopologyException ignored) { + fut.onNodeLeft(); + } + catch (IgniteCheckedException e) { + fut.onError(e); + + break; + } + } + } + + markInitialized(); + } + + /** + * @param nodeId Node ID. + * @return Number of transactions on node. + */ + private int nodeTransactions(UUID nodeId) { + int cnt = txNodes.containsKey(nodeId) ? 1 : 0; // +1 if node is primary. + + for (Collection<UUID> backups : txNodes.values()) { + for (UUID backup : backups) { + if (backup.equals(nodeId)) { + cnt++; // +1 if node is backup. + + break; + } + } + } + + return cnt; + } + + /** + * @param nodeId Node ID. + * @param res Response. + */ + public void onResult(UUID nodeId, GridCacheOptimisticCheckPreparedTxResponse<K, V> res) { + if (!isDone()) { + for (IgniteFuture<Boolean> fut : pending()) { + if (isMini(fut)) { + MiniFuture f = (MiniFuture)fut; + + if (f.futureId().equals(res.miniId())) { + assert f.nodeId().equals(nodeId); + + f.onResult(res); + + break; + } + } + } + } + } + + /** {@inheritDoc} */ + @Override public IgniteUuid futureId() { + return futId; + } + + /** {@inheritDoc} */ + @Override public GridCacheVersion version() { + return tx.xidVersion(); + } + + /** {@inheritDoc} */ + @Override public Collection<? extends ClusterNode> nodes() { + return nodes.values(); + } + + /** {@inheritDoc} */ + @Override public boolean onNodeLeft(UUID nodeId) { + for (IgniteFuture<?> fut : futures()) + if (isMini(fut)) { + MiniFuture f = (MiniFuture)fut; + + if (f.nodeId().equals(nodeId)) { + f.onNodeLeft(); + + return true; + } + } + + return false; + } + + /** {@inheritDoc} */ + @Override public boolean trackable() { + return trackable; + } + + /** {@inheritDoc} */ + @Override public void markNotTrackable() { + trackable = false; + } + + /** {@inheritDoc} */ + @Override public boolean onDone(@Nullable Boolean res, @Nullable Throwable err) { + if (super.onDone(res, err)) { + cctx.mvcc().removeFuture(this); + + if (err == null) { + assert res != null; + + cctx.tm().finishOptimisticTxOnRecovery(tx, res); + } + else { + if (log.isDebugEnabled()) + log.debug("Failed to check prepared transactions, " + + "invalidating transaction [err=" + err + ", tx=" + tx + ']'); + + cctx.tm().salvageTx(tx); + } + } + + return false; + } + + /** + * @param f Future. + * @return {@code True} if mini-future. + */ + private boolean isMini(IgniteFuture<?> f) { + return f.getClass().equals(MiniFuture.class); + } + + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(GridCacheOptimisticCheckPreparedTxFuture.class, this, "super", super.toString()); + } + + /** + * + */ + private class MiniFuture extends GridFutureAdapter<Boolean> { + /** */ + private static final long serialVersionUID = 0L; + + /** Mini future ID. */ + private final IgniteUuid futId = IgniteUuid.randomUuid(); + + /** Node ID. */ + private UUID nodeId; + + /** + * Empty constructor required by {@link Externalizable} + */ + public MiniFuture() { + // No-op. + } + + /** + * @param nodeId Node ID. + */ + private MiniFuture(UUID nodeId) { + super(cctx.kernalContext()); + + this.nodeId = nodeId; + } + + /** + * @return Node ID. + */ + private UUID nodeId() { + return nodeId; + } + + /** + * @return Future ID. + */ + private IgniteUuid futureId() { + return futId; + } + + /** + * @param e Error. + */ + private void onError(Throwable e) { + if (log.isDebugEnabled()) + log.debug("Failed to get future result [fut=" + this + ", err=" + e + ']'); + + onDone(e); + } + + /** + */ + private void onNodeLeft() { + if (log.isDebugEnabled()) + log.debug("Transaction node left grid (will ignore) [fut=" + this + ']'); + + onDone(true); + } + + /** + * @param res Result callback. + */ + private void onResult(GridCacheOptimisticCheckPreparedTxResponse<K, V> res) { + onDone(res.success()); + } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(MiniFuture.class, this, "done", isDone(), "err", error()); + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b89b472d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java new file mode 100644 index 0000000..edeae7f --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java @@ -0,0 +1,227 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.cache.distributed; + +import org.apache.ignite.lang.*; +import org.gridgain.grid.kernal.processors.cache.*; +import org.apache.ignite.internal.processors.cache.transactions.*; +import org.apache.ignite.internal.util.direct.*; +import org.apache.ignite.internal.util.typedef.internal.*; + +import java.io.*; +import java.nio.*; + +/** + * Message sent to check that transactions related to some optimistic transaction + * were prepared on remote node. + */ +public class GridCacheOptimisticCheckPreparedTxRequest<K, V> extends GridDistributedBaseMessage<K, V> { + /** */ + private static final long serialVersionUID = 0L; + + /** Future ID. */ + private IgniteUuid futId; + + /** Mini future ID. */ + private IgniteUuid miniId; + + /** Near transaction ID. */ + private GridCacheVersion nearXidVer; + + /** Expected number of transactions on node. */ + private int txNum; + + /** + * Empty constructor required by {@link Externalizable} + */ + public GridCacheOptimisticCheckPreparedTxRequest() { + // No-op. + } + + /** + * @param tx Transaction. + * @param txNum Expected number of transactions on remote node. + * @param futId Future ID. + * @param miniId Mini future ID. + */ + public GridCacheOptimisticCheckPreparedTxRequest(IgniteTxEx<K, V> tx, int txNum, IgniteUuid futId, IgniteUuid miniId) { + super(tx.xidVersion(), 0); + + nearXidVer = tx.nearXidVersion(); + this.futId = futId; + this.miniId = miniId; + this.txNum = txNum; + } + + /** + * @return Near version. + */ + public GridCacheVersion nearXidVersion() { + return nearXidVer; + } + + /** + * @return Future ID. + */ + public IgniteUuid futureId() { + return futId; + } + + /** + * @return Mini future ID. + */ + public IgniteUuid miniId() { + return miniId; + } + + /** + * @return Expected number of transactions on node. + */ + public int transactions() { + return txNum; + } + + /** {@inheritDoc} */ + @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) + @Override public GridTcpCommunicationMessageAdapter clone() { + GridCacheOptimisticCheckPreparedTxRequest _clone = new GridCacheOptimisticCheckPreparedTxRequest(); + + clone0(_clone); + + return _clone; + } + + /** {@inheritDoc} */ + @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + super.clone0(_msg); + + GridCacheOptimisticCheckPreparedTxRequest _clone = (GridCacheOptimisticCheckPreparedTxRequest)_msg; + + _clone.futId = futId; + _clone.miniId = miniId; + _clone.nearXidVer = nearXidVer; + _clone.txNum = txNum; + } + + /** {@inheritDoc} */ + @SuppressWarnings("all") + @Override public boolean writeTo(ByteBuffer buf) { + commState.setBuffer(buf); + + if (!super.writeTo(buf)) + return false; + + if (!commState.typeWritten) { + if (!commState.putByte(directType())) + return false; + + commState.typeWritten = true; + } + + switch (commState.idx) { + case 8: + if (!commState.putGridUuid(futId)) + return false; + + commState.idx++; + + case 9: + if (!commState.putGridUuid(miniId)) + return false; + + commState.idx++; + + case 10: + if (!commState.putCacheVersion(nearXidVer)) + return false; + + commState.idx++; + + case 11: + if (!commState.putInt(txNum)) + return false; + + commState.idx++; + + } + + return true; + } + + /** {@inheritDoc} */ + @SuppressWarnings("all") + @Override public boolean readFrom(ByteBuffer buf) { + commState.setBuffer(buf); + + if (!super.readFrom(buf)) + return false; + + switch (commState.idx) { + case 8: + IgniteUuid futId0 = commState.getGridUuid(); + + if (futId0 == GRID_UUID_NOT_READ) + return false; + + futId = futId0; + + commState.idx++; + + case 9: + IgniteUuid miniId0 = commState.getGridUuid(); + + if (miniId0 == GRID_UUID_NOT_READ) + return false; + + miniId = miniId0; + + commState.idx++; + + case 10: + GridCacheVersion nearXidVer0 = commState.getCacheVersion(); + + if (nearXidVer0 == CACHE_VER_NOT_READ) + return false; + + nearXidVer = nearXidVer0; + + commState.idx++; + + case 11: + if (buf.remaining() < 4) + return false; + + txNum = commState.getInt(); + + commState.idx++; + + } + + return true; + } + + /** {@inheritDoc} */ + @Override public byte directType() { + return 18; + } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(GridCacheOptimisticCheckPreparedTxRequest.class, this, "super", super.toString()); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b89b472d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java new file mode 100644 index 0000000..de7d037 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java @@ -0,0 +1,198 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.cache.distributed; + +import org.apache.ignite.lang.*; +import org.gridgain.grid.kernal.processors.cache.*; +import org.apache.ignite.internal.util.direct.*; +import org.apache.ignite.internal.util.typedef.internal.*; + +import java.io.*; +import java.nio.*; + +/** + * Check prepared transactions response. + */ +public class GridCacheOptimisticCheckPreparedTxResponse<K, V> extends GridDistributedBaseMessage<K, V> { + /** */ + private static final long serialVersionUID = 0L; + + /** Future ID. */ + private IgniteUuid futId; + + /** Mini future ID. */ + private IgniteUuid miniId; + + /** Flag indicating if all remote transactions were prepared. */ + private boolean success; + + /** + * Empty constructor required by {@link Externalizable} + */ + public GridCacheOptimisticCheckPreparedTxResponse() { + // No-op. + } + + /** + * @param txId Transaction ID. + * @param futId Future ID. + * @param miniId Mini future ID. + * @param success {@code True} if all remote transactions were prepared, {@code false} otherwise. + */ + public GridCacheOptimisticCheckPreparedTxResponse(GridCacheVersion txId, IgniteUuid futId, IgniteUuid miniId, + boolean success) { + super(txId, 0); + + this.futId = futId; + this.miniId = miniId; + this.success = success; + } + + /** + * @return Future ID. + */ + public IgniteUuid futureId() { + return futId; + } + + /** + * @return Mini future ID. + */ + public IgniteUuid miniId() { + return miniId; + } + + /** + * @return {@code True} if all remote transactions were prepared. + */ + public boolean success() { + return success; + } + + /** {@inheritDoc} */ + @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) + @Override public GridTcpCommunicationMessageAdapter clone() { + GridCacheOptimisticCheckPreparedTxResponse _clone = new GridCacheOptimisticCheckPreparedTxResponse(); + + clone0(_clone); + + return _clone; + } + + /** {@inheritDoc} */ + @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + super.clone0(_msg); + + GridCacheOptimisticCheckPreparedTxResponse _clone = (GridCacheOptimisticCheckPreparedTxResponse)_msg; + + _clone.futId = futId; + _clone.miniId = miniId; + _clone.success = success; + } + + /** {@inheritDoc} */ + @SuppressWarnings("all") + @Override public boolean writeTo(ByteBuffer buf) { + commState.setBuffer(buf); + + if (!super.writeTo(buf)) + return false; + + if (!commState.typeWritten) { + if (!commState.putByte(directType())) + return false; + + commState.typeWritten = true; + } + + switch (commState.idx) { + case 8: + if (!commState.putGridUuid(futId)) + return false; + + commState.idx++; + + case 9: + if (!commState.putGridUuid(miniId)) + return false; + + commState.idx++; + + case 10: + if (!commState.putBoolean(success)) + return false; + + commState.idx++; + + } + + return true; + } + + /** {@inheritDoc} */ + @SuppressWarnings("all") + @Override public boolean readFrom(ByteBuffer buf) { + commState.setBuffer(buf); + + if (!super.readFrom(buf)) + return false; + + switch (commState.idx) { + case 8: + IgniteUuid futId0 = commState.getGridUuid(); + + if (futId0 == GRID_UUID_NOT_READ) + return false; + + futId = futId0; + + commState.idx++; + + case 9: + IgniteUuid miniId0 = commState.getGridUuid(); + + if (miniId0 == GRID_UUID_NOT_READ) + return false; + + miniId = miniId0; + + commState.idx++; + + case 10: + if (buf.remaining() < 1) + return false; + + success = commState.getBoolean(); + + commState.idx++; + + } + + return true; + } + + /** {@inheritDoc} */ + @Override public byte directType() { + return 19; + } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(GridCacheOptimisticCheckPreparedTxResponse.class, this, "super", super.toString()); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b89b472d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePerThreadTxCommitBuffer.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePerThreadTxCommitBuffer.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePerThreadTxCommitBuffer.java new file mode 100644 index 0000000..80c93bc --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePerThreadTxCommitBuffer.java @@ -0,0 +1,185 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.cache.distributed; + +import org.apache.ignite.*; +import org.apache.ignite.internal.util.*; +import org.gridgain.grid.kernal.processors.cache.*; +import org.apache.ignite.internal.processors.cache.transactions.*; +import org.apache.ignite.internal.processors.timeout.*; +import org.apache.ignite.internal.util.typedef.internal.*; +import org.jdk8.backport.*; +import org.jetbrains.annotations.*; + +import java.util.*; + +/** + * Committed tx buffer which should be used in synchronous commit mode. + */ +public class GridCachePerThreadTxCommitBuffer<K, V> implements GridCacheTxCommitBuffer<K, V> { + /** Logger. */ + private IgniteLogger log; + + /** Cache context. */ + private GridCacheSharedContext<K, V> cctx; + + /** Store map. */ + private Map<StoreKey, GridCacheCommittedTxInfo<K, V>> infoMap; + + /** + * @param cctx Cache context. + */ + public GridCachePerThreadTxCommitBuffer(GridCacheSharedContext<K, V> cctx) { + this.cctx = cctx; + + log = cctx.logger(GridCachePerThreadTxCommitBuffer.class); + + int logSize = cctx.txConfig().getPessimisticTxLogSize(); + + infoMap = logSize > 0 ? + new GridBoundedConcurrentLinkedHashMap<StoreKey, GridCacheCommittedTxInfo<K, V>>(logSize) : + new ConcurrentHashMap8<StoreKey, GridCacheCommittedTxInfo<K, V>>(); + } + + /** {@inheritDoc} */ + @Override public void addCommittedTx(IgniteTxEx<K, V> tx) { + long threadId = tx.threadId(); + + StoreKey key = new StoreKey(tx.eventNodeId(), threadId); + + if (log.isDebugEnabled()) + log.debug("Adding committed transaction [locNodeId=" + cctx.localNodeId() + ", key=" + key + + ", tx=" + tx + ']'); + + infoMap.put(key, new GridCacheCommittedTxInfo<>(tx)); + } + + /** {@inheritDoc} */ + @Nullable @Override public GridCacheCommittedTxInfo<K, V> committedTx(GridCacheVersion originatingTxVer, + UUID nodeId, long threadId) { + assert originatingTxVer != null; + + StoreKey key = new StoreKey(nodeId, threadId); + + GridCacheCommittedTxInfo<K, V> txInfo = infoMap.get(key); + + if (log.isDebugEnabled()) + log.debug("Got committed transaction info by key [locNodeId=" + cctx.localNodeId() + + ", key=" + key + ", originatingTxVer=" + originatingTxVer + ", txInfo=" + txInfo + ']'); + + if (txInfo == null || !originatingTxVer.equals(txInfo.originatingTxId())) + return null; + + return txInfo; + } + + /** + * @param nodeId Left node ID. + */ + @Override public void onNodeLeft(UUID nodeId) { + // Clear all node's records after clear interval. + cctx.kernalContext().timeout().addTimeoutObject( + new NodeLeftTimeoutObject(cctx.txConfig().getPessimisticTxLogLinger(), nodeId)); + } + + /** {@inheritDoc} */ + @Override public int size() { + return infoMap.size(); + } + + /** + * Store key. + */ + private static class StoreKey { + /** Node ID which started transaction. */ + private UUID nodeId; + + /** Thread ID which started transaction. */ + private long threadId; + + /** + * @param nodeId Node ID. + * @param threadId Thread ID. + */ + private StoreKey(UUID nodeId, long threadId) { + this.nodeId = nodeId; + this.threadId = threadId; + } + + /** + * @return Node ID. + */ + public UUID nodeId() { + return nodeId; + } + + /** {@inheritDoc} */ + @Override public boolean equals(Object o) { + if (this == o) + return true; + + StoreKey storeKey = (StoreKey)o; + + return threadId == storeKey.threadId && nodeId.equals(storeKey.nodeId); + } + + /** {@inheritDoc} */ + @Override public int hashCode() { + int res = nodeId.hashCode(); + + res = 31 * res + (int)(threadId ^ (threadId >>> 32)); + + return res; + } + + /** {@inheritDoc} */ + public String toString() { + return S.toString(StoreKey.class, this); + } + } + + /** + * Node left timeout object which will clear all committed records from left node. + */ + private class NodeLeftTimeoutObject extends GridTimeoutObjectAdapter { + /** Left node ID. */ + private UUID leftNodeId; + + /** + * @param timeout Timeout. + * @param leftNodeId Left node ID. + */ + protected NodeLeftTimeoutObject(long timeout, UUID leftNodeId) { + super(timeout); + + this.leftNodeId = leftNodeId; + } + + /** {@inheritDoc} */ + @Override public void onTimeout() { + Iterator<StoreKey> it = infoMap.keySet().iterator(); + + while (it.hasNext()) { + StoreKey key = it.next(); + + if (leftNodeId.equals(key.nodeId())) + it.remove(); + } + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b89b472d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxFuture.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxFuture.java new file mode 100644 index 0000000..c0777f2 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxFuture.java @@ -0,0 +1,380 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.cache.distributed; + +import org.apache.ignite.*; +import org.apache.ignite.cluster.*; +import org.apache.ignite.internal.util.*; +import org.apache.ignite.lang.*; +import org.gridgain.grid.kernal.processors.cache.*; +import org.apache.ignite.internal.processors.cache.distributed.dht.*; +import org.apache.ignite.internal.processors.cache.transactions.*; +import org.apache.ignite.internal.util.future.*; +import org.apache.ignite.internal.util.typedef.internal.*; +import org.jetbrains.annotations.*; + +import java.io.*; +import java.util.*; +import java.util.concurrent.atomic.*; + +/** + * Future verifying that all remote transactions related to some + * optimistic transaction were prepared. + */ +public class GridCachePessimisticCheckCommittedTxFuture<K, V> extends GridCompoundIdentityFuture<GridCacheCommittedTxInfo<K, V>> + implements GridCacheFuture<GridCacheCommittedTxInfo<K, V>> { + /** */ + private static final long serialVersionUID = 0L; + + /** Trackable flag. */ + private boolean trackable = true; + + /** Context. */ + private final GridCacheSharedContext<K, V> cctx; + + /** Future ID. */ + private final IgniteUuid futId = IgniteUuid.randomUuid(); + + /** Transaction. */ + private final IgniteTxEx<K, V> tx; + + /** All involved nodes. */ + private final Map<UUID, ClusterNode> nodes; + + /** ID of failed node started transaction. */ + private final UUID failedNodeId; + + /** Flag indicating that future checks near node instead of checking all topology in case of primary node crash. */ + private boolean nearCheck; + + /** + * @param cctx Context. + * @param tx Transaction. + * @param failedNodeId ID of failed node started transaction. + */ + @SuppressWarnings("ConstantConditions") + public GridCachePessimisticCheckCommittedTxFuture(GridCacheSharedContext<K, V> cctx, IgniteTxEx<K, V> tx, + UUID failedNodeId) { + super(cctx.kernalContext(), new SingleReducer<K, V>()); + + this.cctx = cctx; + this.tx = tx; + this.failedNodeId = failedNodeId; + + nodes = new GridLeanMap<>(); + + for (ClusterNode node : CU.allNodes(cctx, tx.topologyVersion())) + nodes.put(node.id(), node); + } + + /** + * Initializes future. + */ + public void prepare() { + if (log.isDebugEnabled()) + log.debug("Checking if transaction was committed on remote nodes: " + tx); + + // Check local node first (local node can be a backup node for some part of this transaction). + long originatingThreadId = tx.threadId(); + + if (tx instanceof IgniteTxRemoteEx) + originatingThreadId = ((IgniteTxRemoteEx)tx).remoteThreadId(); + + GridCacheCommittedTxInfo<K, V> txInfo = cctx.tm().txCommitted(tx.nearXidVersion(), tx.eventNodeId(), + originatingThreadId); + + if (txInfo != null) { + onDone(txInfo); + + markInitialized(); + + return; + } + + Collection<ClusterNode> checkNodes = CU.remoteNodes(cctx, tx.topologyVersion()); + + if (tx instanceof GridDhtTxRemote) { + // If we got primary node failure and near node has not failed. + if (tx.nodeId().equals(failedNodeId) && !tx.eventNodeId().equals(failedNodeId)) { + nearCheck = true; + + ClusterNode nearNode = cctx.discovery().node(tx.eventNodeId()); + + if (nearNode == null) { + // Near node failed, separate check prepared future will take care of it. + onDone(new ClusterTopologyException("Failed to check near transaction state (near node left grid): " + + tx.eventNodeId())); + + return; + } + + checkNodes = Collections.singletonList(nearNode); + } + } + + for (ClusterNode rmtNode : checkNodes) { + // Skip left nodes and local node. + if (rmtNode.id().equals(failedNodeId)) + continue; + + GridCachePessimisticCheckCommittedTxRequest<K, V> req = new GridCachePessimisticCheckCommittedTxRequest<>( + tx, + originatingThreadId, futureId(), nearCheck); + + if (rmtNode.isLocal()) + add(cctx.tm().checkPessimisticTxCommitted(req)); + else { + MiniFuture fut = new MiniFuture(rmtNode.id()); + + req.miniId(fut.futureId()); + + add(fut); + + try { + cctx.io().send(rmtNode.id(), req); + } + catch (ClusterTopologyException ignored) { + fut.onNodeLeft(); + } + catch (IgniteCheckedException e) { + fut.onError(e); + + break; + } + } + } + + markInitialized(); + } + + /** + * @param nodeId Node ID. + * @param res Response. + */ + public void onResult(UUID nodeId, GridCachePessimisticCheckCommittedTxResponse<K, V> res) { + if (!isDone()) { + for (IgniteFuture<GridCacheCommittedTxInfo<K, V>> fut : pending()) { + if (isMini(fut)) { + MiniFuture f = (MiniFuture)fut; + + if (f.futureId().equals(res.miniId())) { + assert f.nodeId().equals(nodeId); + + f.onResult(res); + + break; + } + } + } + } + } + + /** {@inheritDoc} */ + @Override public IgniteUuid futureId() { + return futId; + } + + /** {@inheritDoc} */ + @Override public GridCacheVersion version() { + return tx.xidVersion(); + } + + /** {@inheritDoc} */ + @Override public Collection<? extends ClusterNode> nodes() { + return nodes.values(); + } + + /** {@inheritDoc} */ + @Override public boolean onNodeLeft(UUID nodeId) { + for (IgniteFuture<?> fut : futures()) + if (isMini(fut)) { + MiniFuture f = (MiniFuture)fut; + + if (f.nodeId().equals(nodeId)) { + f.onNodeLeft(); + + return true; + } + } + + return false; + } + + /** {@inheritDoc} */ + @Override public boolean trackable() { + return trackable; + } + + /** {@inheritDoc} */ + @Override public void markNotTrackable() { + trackable = false; + } + + /** {@inheritDoc} */ + @Override public boolean onDone(@Nullable GridCacheCommittedTxInfo<K, V> res, @Nullable Throwable err) { + if (super.onDone(res, err)) { + cctx.mvcc().removeFuture(this); + + if (log.isDebugEnabled()) + log.debug("Completing check committed tx future for transaction [tx=" + tx + ", res=" + res + + ", err=" + err + ']'); + + if (err == null) + cctx.tm().finishPessimisticTxOnRecovery(tx, res); + else { + if (log.isDebugEnabled()) + log.debug("Failed to check prepared transactions, " + + "invalidating transaction [err=" + err + ", tx=" + tx + ']'); + + if (nearCheck) + return true; + + cctx.tm().salvageTx(tx); + } + + return true; + } + + return false; + } + + /** + * @param f Future. + * @return {@code True} if mini-future. + */ + private boolean isMini(IgniteFuture<?> f) { + return f.getClass().equals(MiniFuture.class); + } + + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(GridCachePessimisticCheckCommittedTxFuture.class, this, "super", super.toString()); + } + + /** + * + */ + private class MiniFuture extends GridFutureAdapter<GridCacheCommittedTxInfo<K, V>> { + /** */ + private static final long serialVersionUID = 0L; + + /** Mini future ID. */ + private final IgniteUuid futId = IgniteUuid.randomUuid(); + + /** Node ID. */ + private UUID nodeId; + + /** + * Empty constructor required by {@link Externalizable} + */ + public MiniFuture() { + // No-op. + } + + /** + * @param nodeId Node ID. + */ + private MiniFuture(UUID nodeId) { + super(cctx.kernalContext()); + + this.nodeId = nodeId; + } + + /** + * @return Node ID. + */ + private UUID nodeId() { + return nodeId; + } + + /** + * @return Future ID. + */ + private IgniteUuid futureId() { + return futId; + } + + /** + * @param e Error. + */ + private void onError(Throwable e) { + if (log.isDebugEnabled()) + log.debug("Failed to get future result [fut=" + this + ", err=" + e + ']'); + + onDone(e); + } + + /** + */ + private void onNodeLeft() { + if (log.isDebugEnabled()) + log.debug("Transaction node left grid (will ignore) [fut=" + this + ']'); + + if (nearCheck) { + onDone(new ClusterTopologyException("Failed to check near transaction state (near node left grid): " + + nodeId)); + + return; + } + + onDone((GridCacheCommittedTxInfo<K, V>)null); + } + + /** + * @param res Result callback. + */ + private void onResult(GridCachePessimisticCheckCommittedTxResponse<K, V> res) { + onDone(res.committedTxInfo()); + } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(MiniFuture.class, this, "done", isDone(), "err", error()); + } + } + + /** + * Single value reducer. + */ + private static class SingleReducer<K, V> implements + IgniteReducer<GridCacheCommittedTxInfo<K, V>, GridCacheCommittedTxInfo<K, V>> { + /** */ + private static final long serialVersionUID = 0L; + + /** */ + private AtomicReference<GridCacheCommittedTxInfo<K, V>> collected = new AtomicReference<>(); + + /** {@inheritDoc} */ + @Override public boolean collect(@Nullable GridCacheCommittedTxInfo<K, V> info) { + if (info != null) { + collected.compareAndSet(null, info); + + // Stop collecting on first collected info. + return false; + } + + return true; + } + + /** {@inheritDoc} */ + @Override public GridCacheCommittedTxInfo<K, V> reduce() { + return collected.get(); + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b89b472d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java new file mode 100644 index 0000000..1fa4c8e --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePessimisticCheckCommittedTxRequest.java @@ -0,0 +1,292 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.cache.distributed; + +import org.apache.ignite.internal.*; +import org.apache.ignite.lang.*; +import org.gridgain.grid.kernal.processors.cache.*; +import org.apache.ignite.internal.processors.cache.transactions.*; +import org.apache.ignite.internal.util.direct.*; +import org.apache.ignite.internal.util.typedef.internal.*; + +import java.io.*; +import java.nio.*; +import java.util.*; + +/** + * Message sent to check that transactions related to some pessimistic transaction + * were prepared on remote node. + */ +public class GridCachePessimisticCheckCommittedTxRequest<K, V> extends GridDistributedBaseMessage<K, V> { + /** */ + private static final long serialVersionUID = 0L; + + /** Future ID. */ + private IgniteUuid futId; + + /** Mini future ID. */ + private IgniteUuid miniId; + + /** Near transaction ID. */ + private GridCacheVersion nearXidVer; + + /** Originating node ID. */ + private UUID originatingNodeId; + + /** Originating thread ID. */ + private long originatingThreadId; + + /** Flag indicating that this is near-only check. */ + @GridDirectVersion(1) + private boolean nearOnlyCheck; + + /** + * Empty constructor required by {@link Externalizable} + */ + public GridCachePessimisticCheckCommittedTxRequest() { + // No-op. + } + + /** + * @param tx Transaction. + * @param originatingThreadId Originating thread ID. + * @param futId Future ID. + */ + public GridCachePessimisticCheckCommittedTxRequest(IgniteTxEx<K, V> tx, long originatingThreadId, IgniteUuid futId, + boolean nearOnlyCheck) { + super(tx.xidVersion(), 0); + + this.futId = futId; + this.nearOnlyCheck = nearOnlyCheck; + + nearXidVer = tx.nearXidVersion(); + originatingNodeId = tx.eventNodeId(); + this.originatingThreadId = originatingThreadId; + } + + /** + * @return Near version. + */ + public GridCacheVersion nearXidVersion() { + return nearXidVer; + } + + /** + * @return Tx originating node ID. + */ + public UUID originatingNodeId() { + return originatingNodeId; + } + + /** + * @return Tx originating thread ID. + */ + public long originatingThreadId() { + return originatingThreadId; + } + + /** + * @return Future ID. + */ + public IgniteUuid futureId() { + return futId; + } + + /** + * @return Mini future ID. + */ + public IgniteUuid miniId() { + return miniId; + } + + /** + * @param miniId Mini ID to set. + */ + public void miniId(IgniteUuid miniId) { + this.miniId = miniId; + } + + /** + * @return Flag indicating that this request was sent only to near node. If this flag is set, no finalizing + * will be executed on receiving (near) node since this is a user node. + */ + public boolean nearOnlyCheck() { + return nearOnlyCheck; + } + + /** {@inheritDoc} */ + @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneCallsConstructors"}) + @Override public GridTcpCommunicationMessageAdapter clone() { + GridCachePessimisticCheckCommittedTxRequest _clone = new GridCachePessimisticCheckCommittedTxRequest(); + + clone0(_clone); + + return _clone; + } + + /** {@inheritDoc} */ + @Override protected void clone0(GridTcpCommunicationMessageAdapter _msg) { + super.clone0(_msg); + + GridCachePessimisticCheckCommittedTxRequest _clone = (GridCachePessimisticCheckCommittedTxRequest)_msg; + + _clone.futId = futId; + _clone.miniId = miniId; + _clone.nearXidVer = nearXidVer; + _clone.originatingNodeId = originatingNodeId; + _clone.originatingThreadId = originatingThreadId; + _clone.nearOnlyCheck = nearOnlyCheck; + } + + /** {@inheritDoc} */ + @SuppressWarnings("all") + @Override public boolean writeTo(ByteBuffer buf) { + commState.setBuffer(buf); + + if (!super.writeTo(buf)) + return false; + + if (!commState.typeWritten) { + if (!commState.putByte(directType())) + return false; + + commState.typeWritten = true; + } + + switch (commState.idx) { + case 8: + if (!commState.putGridUuid(futId)) + return false; + + commState.idx++; + + case 9: + if (!commState.putGridUuid(miniId)) + return false; + + commState.idx++; + + case 10: + if (!commState.putCacheVersion(nearXidVer)) + return false; + + commState.idx++; + + case 11: + if (!commState.putUuid(originatingNodeId)) + return false; + + commState.idx++; + + case 12: + if (!commState.putLong(originatingThreadId)) + return false; + + commState.idx++; + + case 13: + if (!commState.putBoolean(nearOnlyCheck)) + return false; + + commState.idx++; + + } + + return true; + } + + /** {@inheritDoc} */ + @SuppressWarnings("all") + @Override public boolean readFrom(ByteBuffer buf) { + commState.setBuffer(buf); + + if (!super.readFrom(buf)) + return false; + + switch (commState.idx) { + case 8: + IgniteUuid futId0 = commState.getGridUuid(); + + if (futId0 == GRID_UUID_NOT_READ) + return false; + + futId = futId0; + + commState.idx++; + + case 9: + IgniteUuid miniId0 = commState.getGridUuid(); + + if (miniId0 == GRID_UUID_NOT_READ) + return false; + + miniId = miniId0; + + commState.idx++; + + case 10: + GridCacheVersion nearXidVer0 = commState.getCacheVersion(); + + if (nearXidVer0 == CACHE_VER_NOT_READ) + return false; + + nearXidVer = nearXidVer0; + + commState.idx++; + + case 11: + UUID originatingNodeId0 = commState.getUuid(); + + if (originatingNodeId0 == UUID_NOT_READ) + return false; + + originatingNodeId = originatingNodeId0; + + commState.idx++; + + case 12: + if (buf.remaining() < 8) + return false; + + originatingThreadId = commState.getLong(); + + commState.idx++; + + case 13: + if (buf.remaining() < 1) + return false; + + nearOnlyCheck = commState.getBoolean(); + + commState.idx++; + + } + + return true; + } + + /** {@inheritDoc} */ + @Override public byte directType() { + return 20; + } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(GridCachePessimisticCheckCommittedTxRequest.class, this, "super", super.toString()); + } +}