IGNITE-45 - Removed distribution mode.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/52e4a96c Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/52e4a96c Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/52e4a96c Branch: refs/heads/ignite-421 Commit: 52e4a96c5c1dea0a6afb482400a2a79f3817c6d3 Parents: b6876f3 Author: Alexey Goncharuk <agoncha...@gridgain.com> Authored: Tue Mar 10 18:23:10 2015 -0700 Committer: Alexey Goncharuk <agoncha...@gridgain.com> Committed: Tue Mar 10 18:23:13 2015 -0700 ---------------------------------------------------------------------- .../ClientAbstractMultiThreadedSelfTest.java | 1 - .../ClientAbstractMultiNodeSelfTest.java | 1 - .../ignite/jdbc/JdbcComplexQuerySelfTest.java | 1 - .../src/main/java/org/apache/ignite/Ignite.java | 4 +- .../java/org/apache/ignite/cache/GridCache.java | 5 + .../org/apache/ignite/cluster/ClusterGroup.java | 22 +- .../configuration/CacheConfiguration.java | 139 +------ .../configuration/NearCacheConfiguration.java | 65 +--- .../org/apache/ignite/internal/IgnitionEx.java | 130 +++---- .../internal/cluster/ClusterGroupAdapter.java | 53 ++- .../ignite/internal/cluster/ClusterGroupEx.java | 6 +- .../discovery/GridDiscoveryManager.java | 71 +++- .../cache/DynamicCacheChangeRequest.java | 26 +- .../processors/cache/GridCacheAdapter.java | 13 +- .../processors/cache/GridCacheAttributes.java | 42 +-- .../processors/cache/GridCacheContext.java | 14 +- .../cache/GridCacheEvictionManager.java | 8 +- .../processors/cache/GridCacheProcessor.java | 198 +++++----- .../processors/cache/GridCacheProxyImpl.java | 12 + .../processors/cache/GridCacheUtils.java | 33 +- .../distributed/dht/GridDhtCacheAdapter.java | 6 +- .../dht/GridDhtTransactionalCacheAdapter.java | 4 +- .../distributed/near/GridNearCacheAdapter.java | 35 +- .../distributed/near/GridNearGetFuture.java | 3 +- .../local/atomic/GridLocalAtomicCache.java | 2 +- .../cache/query/GridCacheQueryAdapter.java | 5 +- .../continuous/CacheContinuousQueryManager.java | 9 +- .../cache/transactions/IgniteTxAdapter.java | 2 +- .../processors/igfs/IgfsDataManager.java | 2 +- .../ignite/internal/visor/cache/VisorCache.java | 4 +- .../visor/cache/VisorCacheConfiguration.java | 2 +- .../cache/VisorCacheEvictionConfiguration.java | 2 +- .../cache/VisorCacheNearConfiguration.java | 6 +- .../ignite/startup/BasicWarmupClosure.java | 8 +- .../ignite/IgniteCacheAffinitySelfTest.java | 8 +- ...CachePartitionFairAffinityNodesSelfTest.java | 2 +- ...CacheJdbcBlobStoreMultithreadedSelfTest.java | 3 +- .../ignite/igfs/IgfsEventsAbstractSelfTest.java | 3 +- .../igfs/IgfsFragmentizerAbstractSelfTest.java | 2 +- .../GridProjectionForCachesSelfTest.java | 23 +- .../GridDiscoveryManagerAliveCacheSelfTest.java | 3 +- .../discovery/GridDiscoveryManagerSelfTest.java | 5 +- .../cache/GridCacheAbstractFullApiSelfTest.java | 6 +- .../GridCacheAbstractLocalStoreSelfTest.java | 4 +- .../cache/GridCacheAbstractSelfTest.java | 8 +- ...acheAbstractUsersAffinityMapperSelfTest.java | 6 +- .../GridCacheAtomicMessageCountSelfTest.java | 11 +- ...dCacheAtomicUsersAffinityMapperSelfTest.java | 12 +- .../cache/GridCacheBasicStoreAbstractTest.java | 8 - .../cache/GridCacheClearAllSelfTest.java | 2 - .../cache/GridCacheClearLocalySelfTest.java | 7 +- ...dCacheColocatedTxStoreExceptionSelfTest.java | 6 +- .../GridCacheConcurrentTxMultiNodeTest.java | 3 - ...idCacheConfigurationConsistencySelfTest.java | 70 ++-- .../GridCacheDaemonNodeAbstractSelfTest.java | 3 +- .../GridCacheDeploymentOffHeapSelfTest.java | 3 +- .../cache/GridCacheDeploymentSelfTest.java | 3 +- .../cache/GridCacheEntryMemorySizeSelfTest.java | 3 +- .../GridCacheEvictionEventAbstractTest.java | 8 - .../GridCacheExAbstractFullApiSelfTest.java | 6 +- .../GridCacheFinishPartitionsSelfTest.java | 3 +- ...idCacheGetAndTransformStoreAbstractTest.java | 9 - .../cache/GridCacheIncrementTransformTest.java | 2 - ...cheInterceptorAtomicNearEnabledSelfTest.java | 11 +- ...erceptorAtomicPrimaryWriteOrderSelfTest.java | 8 +- .../GridCacheInterceptorAtomicSelfTest.java | 8 +- ...GridCacheInterceptorNearEnabledSelfTest.java | 7 +- .../cache/GridCacheInterceptorSelfTest.java | 8 +- .../GridCacheKeyCheckNearEnabledSelfTest.java | 6 +- .../cache/GridCacheKeyCheckSelfTest.java | 7 +- .../processors/cache/GridCacheLeakTest.java | 3 +- .../cache/GridCacheLifecycleAwareSelfTest.java | 22 +- ...GridCacheMixedPartitionExchangeSelfTest.java | 3 +- .../cache/GridCacheMultiUpdateLockSelfTest.java | 5 +- ...ultinodeUpdateAtomicNearEnabledSelfTest.java | 6 +- .../GridCacheMultinodeUpdateAtomicSelfTest.java | 6 +- ...CacheMultinodeUpdateNearEnabledSelfTest.java | 6 +- .../cache/GridCacheMultinodeUpdateSelfTest.java | 6 +- .../cache/GridCacheMvccPartitionedSelfTest.java | 1 - .../cache/GridCacheObjectToStringSelfTest.java | 3 +- .../processors/cache/GridCacheOffHeapTest.java | 3 +- .../GridCacheOffHeapTieredAbstractSelfTest.java | 4 +- .../cache/GridCacheOffheapUpdateSelfTest.java | 2 +- .../cache/GridCacheP2PUndeploySelfTest.java | 3 - .../cache/GridCachePartitionedGetSelfTest.java | 4 +- .../GridCachePartitionedLocalStoreSelfTest.java | 13 +- ...chePartitionedOffHeapLocalStoreSelfTest.java | 13 +- ...hePartitionedProjectionAffinitySelfTest.java | 1 - .../cache/GridCachePartitionedWritesTest.java | 4 +- .../GridCachePreloadingEvictionsSelfTest.java | 5 +- .../cache/GridCachePutAllFailoverSelfTest.java | 2 +- .../GridCacheReferenceCleanupSelfTest.java | 3 +- .../cache/GridCacheReloadSelfTest.java | 3 +- .../GridCacheReplicatedLocalStoreSelfTest.java | 13 +- ...CacheReplicatedTxStoreExceptionSelfTest.java | 6 +- ...heReplicatedUsersAffinityMapperSelfTest.java | 12 +- .../GridCacheReturnValueTransferSelfTest.java | 22 +- .../cache/GridCacheSwapPreloadSelfTest.java | 1 - ...ridCacheTxPartitionedLocalStoreSelfTest.java | 13 +- .../GridCacheTxUsersAffinityMapperSelfTest.java | 12 +- .../GridCacheValueBytesPreloadingSelfTest.java | 3 +- ...idCacheValueConsistencyAbstractSelfTest.java | 10 +- ...istencyTransactionalNearEnabledSelfTest.java | 6 +- .../cache/GridCacheVersionMultinodeTest.java | 13 +- .../GridCacheWriteBehindStoreAbstractTest.java | 2 - ...BehindStorePartitionedMultiNodeSelfTest.java | 3 +- .../IgniteCacheAbstractStopBusySelfTest.java | 14 +- .../cache/IgniteCacheAbstractTest.java | 4 +- .../cache/IgniteCacheAtomicInvokeTest.java | 6 +- .../cache/IgniteCacheAtomicLocalInvokeTest.java | 6 +- .../IgniteCacheAtomicNearEnabledInvokeTest.java | 8 +- ...eCacheAtomicPrimaryWriteOrderInvokeTest.java | 6 +- ...IgniteCacheEntryListenerAtomicLocalTest.java | 6 +- .../IgniteCacheEntryListenerAtomicTest.java | 6 +- .../IgniteCacheEntryListenerTxLocalTest.java | 6 +- .../cache/IgniteCacheEntryListenerTxTest.java | 6 +- .../cache/IgniteCacheInvokeReadThroughTest.java | 6 +- .../cache/IgniteCachePeekModesAbstractTest.java | 6 +- .../cache/IgniteCacheTxInvokeTest.java | 6 +- .../cache/IgniteCacheTxLocalInvokeTest.java | 6 +- .../IgniteCacheTxNearEnabledInvokeTest.java | 8 +- .../cache/IgniteCachingProviderSelfTest.java | 4 +- .../IgniteClientAffinityAssignmentSelfTest.java | 7 +- .../cache/IgnitePutAllLargeBatchSelfTest.java | 3 +- ...tAllUpdateNonPreloadedPartitionSelfTest.java | 2 +- .../cache/IgniteTxReentryAbstractSelfTest.java | 4 +- .../IgniteCacheAtomicExecutionContextTest.java | 6 +- ...iteCachePartitionedExecutionContextTest.java | 6 +- ...niteCacheReplicatedExecutionContextTest.java | 6 +- .../IgniteCacheTxExecutionContextTest.java | 6 +- .../IgniteCollectionAbstractTest.java | 1 - ...idCachePartitionedNodeRestartTxSelfTest.java | 2 - ...tractPartitionedByteArrayValuesSelfTest.java | 9 +- .../GridCacheAbstractPrimarySyncSelfTest.java | 5 +- .../GridCacheAtomicTimeoutSelfTest.java | 5 +- .../GridCacheClientModesAbstractSelfTest.java | 3 +- ...acheEntrySetIterationPreloadingSelfTest.java | 4 +- .../distributed/GridCacheLockAbstractTest.java | 1 - .../distributed/GridCacheMixedModeSelfTest.java | 2 +- ...dCacheMultithreadedFailoverAbstractTest.java | 19 +- ...dCachePartitionedAffinityFilterSelfTest.java | 1 - ...chePartitionedReloadAllAbstractSelfTest.java | 4 +- .../GridCachePreloadEventsAbstractSelfTest.java | 3 +- ...GridCachePreloadRestartAbstractSelfTest.java | 4 +- .../GridCacheTransformEventSelfTest.java | 1 - .../IgniteCrossCacheTxStoreSelfTest.java | 3 +- ...iteTxConsistencyRestartAbstractSelfTest.java | 4 +- ...tPartitionedOnlyByteArrayValuesSelfTest.java | 4 +- ...heAbstractTransformWriteThroughSelfTest.java | 3 +- ...acheAtomicExpiredEntriesPreloadSelfTest.java | 6 +- .../dht/GridCacheAtomicFullApiSelfTest.java | 5 +- .../dht/GridCacheAtomicNearCacheSelfTest.java | 3 +- ...idCacheAtomicNearEnabledFullApiSelfTest.java | 8 +- ...EnabledPrimaryWriteOrderFullApiSelfTest.java | 8 +- .../dht/GridCacheClientOnlySelfTest.java | 8 +- .../dht/GridCacheColocatedDebugTest.java | 3 +- .../dht/GridCacheColocatedFailoverSelfTest.java | 6 +- ...eColocatedOptimisticTransactionSelfTest.java | 4 +- .../GridCacheColocatedPrimarySyncSelfTest.java | 8 +- .../GridCacheColocatedTxExceptionSelfTest.java | 6 +- ...ssimisticOriginatingNodeFailureSelfTest.java | 6 +- ...dCacheColocatedTxSingleThreadedSelfTest.java | 2 +- .../GridCacheDhtAtomicRemoveFailureTest.java | 3 +- .../dht/GridCacheDhtEntrySelfTest.java | 1 - .../dht/GridCacheDhtEntrySetSelfTest.java | 3 +- ...GridCacheDhtEvictionNearReadersSelfTest.java | 10 +- .../dht/GridCacheDhtEvictionSelfTest.java | 9 +- .../GridCacheDhtEvictionsDisabledSelfTest.java | 3 +- ...idCacheDhtExpiredEntriesPreloadSelfTest.java | 6 +- .../dht/GridCacheDhtInternalEntrySelfTest.java | 7 +- .../dht/GridCacheDhtMappingSelfTest.java | 1 - .../dht/GridCacheDhtPreloadDelayedSelfTest.java | 1 - .../GridCacheDhtPreloadDisabledSelfTest.java | 2 - .../dht/GridCacheDhtRemoveFailureTest.java | 3 +- .../dht/GridCacheDhtTxPreloadSelfTest.java | 3 +- .../dht/GridCacheGlobalLoadTest.java | 6 +- ...ePartitionedNearDisabledFullApiSelfTest.java | 8 +- ...ePartitionedNearDisabledMetricsSelfTest.java | 3 +- ...nedNearDisabledMultiNodeFullApiSelfTest.java | 8 +- ...bledMultiNodeP2PDisabledFullApiSelfTest.java | 8 +- ...isabledTxOriginatingNodeFailureSelfTest.java | 6 +- ...dCachePartitionedTopologyChangeSelfTest.java | 3 +- ...itionedTxOriginatingNodeFailureSelfTest.java | 5 - ...IgniteCacheContainsKeyColocatedSelfTest.java | 5 +- ...teTxConsistencyColocatedRestartSelfTest.java | 5 +- .../atomic/GridCacheAtomicPreloadSelfTest.java | 3 +- ...lueConsistencyAtomicNearEnabledSelfTest.java | 14 +- ...micPrimaryWriteOrderNearEnabledSelfTest.java | 6 +- ...CacheContainsKeyColocatedAtomicSelfTest.java | 5 +- ...tNearPartitionedByteArrayValuesSelfTest.java | 5 +- ...tomicClientOnlyMultiNodeFullApiSelfTest.java | 14 +- ...GridCacheAtomicMultiNodeFullApiSelfTest.java | 5 +- ...omicMultiNodeP2PDisabledFullApiSelfTest.java | 5 +- ...omicNearEnabledMultiNodeFullApiSelfTest.java | 8 +- ...imaryWriteOrderMultiNodeFullApiSelfTest.java | 8 +- ...eAtomicNearOnlyMultiNodeFullApiSelfTest.java | 10 +- .../GridCacheAtomicNearRemoveFailureTest.java | 3 +- .../GridCacheAtomicOffHeapFullApiSelfTest.java | 5 +- ...heAtomicOffHeapMultiNodeFullApiSelfTest.java | 5 +- ...cPrimaryWriteOrderNearRemoveFailureTest.java | 3 +- .../near/GridCacheExNearFullApiSelfTest.java | 6 +- .../near/GridCacheGetStoreErrorSelfTest.java | 6 +- .../GridCacheNearEvictionEventSelfTest.java | 5 - .../near/GridCacheNearEvictionSelfTest.java | 10 +- ...dCacheNearExpiredEntriesPreloadSelfTest.java | 6 +- .../near/GridCacheNearJobExecutionSelfTest.java | 3 +- .../near/GridCacheNearMultiGetSelfTest.java | 2 - .../near/GridCacheNearMultiNodeSelfTest.java | 3 +- .../near/GridCacheNearOneNodeSelfTest.java | 2 - ...idCacheNearOnlyMultiNodeFullApiSelfTest.java | 6 +- .../near/GridCacheNearOnlySelfTest.java | 7 - .../near/GridCacheNearOnlyTopologySelfTest.java | 6 +- .../GridCacheNearPartitionedClearSelfTest.java | 3 +- .../near/GridCacheNearPrimarySyncSelfTest.java | 8 +- .../GridCacheNearReaderPreloadSelfTest.java | 5 +- .../near/GridCacheNearReadersSelfTest.java | 7 +- .../near/GridCacheNearRemoveFailureTest.java | 3 +- .../near/GridCacheNearTxMultiNodeSelfTest.java | 3 +- ...ssimisticOriginatingNodeFailureSelfTest.java | 6 - .../near/GridCacheNearTxPreloadSelfTest.java | 2 +- .../GridCachePartitionedAffinitySelfTest.java | 2 - .../near/GridCachePartitionedBasicApiTest.java | 3 +- ...ionedClientOnlyNoPrimaryFullApiSelfTest.java | 7 +- .../near/GridCachePartitionedEventSelfTest.java | 3 +- .../GridCachePartitionedEvictionSelfTest.java | 2 +- ...titionedExplicitLockNodeFailureSelfTest.java | 2 +- ...GridCachePartitionedFilteredPutSelfTest.java | 3 +- .../GridCachePartitionedFullApiSelfTest.java | 1 - ...idCachePartitionedHitsAndMissesSelfTest.java | 3 +- ...achePartitionedMultiNodeCounterSelfTest.java | 3 +- ...idCachePartitionedMultiNodeLockSelfTest.java | 3 +- .../GridCachePartitionedMultiNodeSelfTest.java | 2 - ...ePartitionedMultiThreadedPutGetSelfTest.java | 9 +- ...itionedNearOnlyNoPrimaryFullApiSelfTest.java | 6 +- ...GridCachePartitionedNodeFailureSelfTest.java | 2 - .../GridCachePartitionedNodeRestartTest.java | 3 +- ...achePartitionedPreloadLifecycleSelfTest.java | 1 - ...hePartitionedQueryMultiThreadedSelfTest.java | 2 - ...achePartitionedTxSingleThreadedSelfTest.java | 1 - ...idCacheRendezvousAffinityClientSelfTest.java | 5 +- .../near/IgniteCacheNearReadCommittedTest.java | 5 +- ...stractReplicatedByteArrayValuesSelfTest.java | 1 - .../GridCacheReplicatedEvictionSelfTest.java | 5 +- .../GridCacheReplicatedFullApiSelfTest.java | 5 +- .../GridCacheReplicatedTxExceptionSelfTest.java | 6 +- ...ssimisticOriginatingNodeFailureSelfTest.java | 7 +- .../GridCacheSyncReplicatedPreloadSelfTest.java | 3 +- .../GridCacheBatchEvictUnswapSelfTest.java | 4 +- ...heConcurrentEvictionConsistencySelfTest.java | 3 +- .../GridCacheConcurrentEvictionsSelfTest.java | 9 +- .../GridCacheDistributedEvictionsSelfTest.java | 8 +- .../GridCacheEmptyEntriesAbstractSelfTest.java | 3 - .../eviction/GridCacheEvictionAbstractTest.java | 18 +- .../GridCacheEvictionFilterSelfTest.java | 14 +- .../GridCacheEvictionLockUnlockSelfTest.java | 9 +- ...cheSynchronousEvictionsFailoverSelfTest.java | 5 +- .../GridCacheLruNearEvictionPolicySelfTest.java | 6 +- ...heNearOnlyLruNearEvictionPolicySelfTest.java | 7 +- .../IgniteCacheAtomicExpiryPolicyTest.java | 6 +- .../IgniteCacheAtomicLocalExpiryPolicyTest.java | 6 +- .../IgniteCacheExpiryPolicyAbstractTest.java | 5 +- ...eCacheExpiryPolicyWithStoreAbstractTest.java | 6 +- .../expiry/IgniteCacheTxExpiryPolicyTest.java | 6 +- .../IgniteCacheTxLocalExpiryPolicyTest.java | 6 +- .../IgniteCacheAtomicLoadAllTest.java | 6 +- .../IgniteCacheAtomicLoaderWriterTest.java | 6 +- .../IgniteCacheAtomicLocalLoadAllTest.java | 6 +- ...CacheAtomicLocalNoLoadPreviousValueTest.java | 6 +- ...IgniteCacheAtomicLocalNoReadThroughTest.java | 6 +- ...gniteCacheAtomicLocalNoWriteThroughTest.java | 6 +- ...tomicNearEnabledNoLoadPreviousValueTest.java | 8 +- ...CacheAtomicNearEnabledNoReadThroughTest.java | 8 +- ...acheAtomicNearEnabledNoWriteThroughTest.java | 8 +- ...gniteCacheAtomicNoLoadPreviousValueTest.java | 6 +- .../IgniteCacheAtomicNoReadThroughTest.java | 6 +- .../IgniteCacheAtomicNoWriteThroughTest.java | 6 +- .../IgniteCacheAtomicStoreSessionTest.java | 6 +- .../integration/IgniteCacheTxLoadAllTest.java | 6 +- .../IgniteCacheTxLoaderWriterTest.java | 6 +- .../IgniteCacheTxLocalLoadAllTest.java | 5 +- ...niteCacheTxLocalNoLoadPreviousValueTest.java | 6 +- .../IgniteCacheTxLocalNoReadThroughTest.java | 6 +- .../IgniteCacheTxLocalNoWriteThroughTest.java | 6 +- ...cheTxNearEnabledNoLoadPreviousValueTest.java | 8 +- ...niteCacheTxNearEnabledNoReadThroughTest.java | 8 +- ...iteCacheTxNearEnabledNoWriteThroughTest.java | 8 +- .../IgniteCacheTxNoLoadPreviousValueTest.java | 6 +- .../IgniteCacheTxNoReadThroughTest.java | 6 +- .../IgniteCacheTxNoWriteThroughTest.java | 6 +- .../IgniteCacheTxStoreSessionTest.java | 6 +- .../GridCacheLocalByteArrayValuesSelfTest.java | 1 - ...ridCacheContinuousQueryAbstractSelfTest.java | 7 +- ...ontinuousQueryAtomicNearEnabledSelfTest.java | 8 +- .../GridCacheContinuousQueryAtomicSelfTest.java | 6 +- ...eContinuousQueryPartitionedOnlySelfTest.java | 6 +- ...dCacheAbstractReduceFieldsQuerySelfTest.java | 7 +- ...ridCacheReduceFieldsQueryAtomicSelfTest.java | 6 +- .../dataload/GridDataLoaderPerformanceTest.java | 3 +- .../GridDataLoaderProcessorSelfTest.java | 10 +- .../processors/igfs/IgfsAbstractSelfTest.java | 2 +- ...sCachePerBlockLruEvictionPolicySelfTest.java | 8 +- .../processors/igfs/IgfsCacheSelfTest.java | 2 +- .../igfs/IgfsDataManagerSelfTest.java | 2 +- .../igfs/IgfsMetaManagerSelfTest.java | 3 +- .../processors/igfs/IgfsMetricsSelfTest.java | 8 +- .../processors/igfs/IgfsModesSelfTest.java | 4 +- .../processors/igfs/IgfsProcessorSelfTest.java | 2 +- .../processors/igfs/IgfsSizeSelfTest.java | 4 +- .../processors/igfs/IgfsStreamsSelfTest.java | 2 +- .../processors/igfs/IgfsTaskSelfTest.java | 4 +- .../IgfsAbstractRecordResolverSelfTest.java | 3 +- .../ipc/shmem/IpcSharedMemoryNodeStartup.java | 3 +- .../loadtests/GridCacheMultiNodeLoadTest.java | 3 +- .../cache/GridCachePutRemoveLoadTest.java | 373 ------------------- .../cache/GridCacheSingleNodeLoadTest.java | 182 --------- .../GridCachePartitionedAtomicLongLoadTest.java | 1 - .../loadtests/hashmap/GridCacheTestContext.java | 1 + .../GridCacheStoreValueBytesNode.java | 13 +- .../testframework/junits/GridAbstractTest.java | 3 +- .../HadoopIgfs20FileSystemAbstractSelfTest.java | 4 +- .../igfs/HadoopIgfsDualAbstractSelfTest.java | 2 +- ...oopSecondaryFileSystemConfigurationTest.java | 4 +- .../igfs/IgfsNearOnlyMultiNodeSelfTest.java | 4 +- .../IgniteHadoopFileSystemAbstractSelfTest.java | 6 +- .../IgniteHadoopFileSystemClientSelfTest.java | 3 +- ...IgniteHadoopFileSystemHandshakeSelfTest.java | 5 +- .../IgniteHadoopFileSystemIpcCacheSelfTest.java | 2 +- ...niteHadoopFileSystemLoggerStateSelfTest.java | 2 +- ...teHadoopFileSystemSecondaryModeSelfTest.java | 4 +- .../HibernateL2CacheTransactionalSelfTest.java | 3 +- .../cache/GridCacheAbstractQuerySelfTest.java | 4 +- .../cache/GridCacheCrossCacheQuerySelfTest.java | 2 - .../GridCacheCrossCacheQuerySelfTestNewApi.java | 3 - .../cache/GridCacheOffHeapAndSwapSelfTest.java | 4 +- .../GridCacheQueryMultiThreadedSelfTest.java | 1 - .../GridCacheSqlQueryMultiThreadedSelfTest.java | 5 +- .../cache/GridIndexingWithNoopSwapSelfTest.java | 3 +- .../GridCacheAtomicFieldsQuerySelfTest.java | 8 +- ...cheAtomicNearEnabledFieldsQuerySelfTest.java | 8 +- ...GridCachePartitionedFieldsQuerySelfTest.java | 7 +- .../near/GridCacheQueryNodeRestartSelfTest.java | 1 - .../query/h2/sql/GridQueryParsingTest.java | 4 +- .../GridTmLookupLifecycleAwareSelfTest.java | 12 +- .../org/apache/ignite/IgniteSpringBean.java | 29 ++ .../org/apache/ignite/yardstick/IgniteNode.java | 3 +- 345 files changed, 1147 insertions(+), 2106 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52e4a96c/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientAbstractMultiThreadedSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientAbstractMultiThreadedSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientAbstractMultiThreadedSelfTest.java index 079b3ec..bb5b246 100644 --- a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientAbstractMultiThreadedSelfTest.java +++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientAbstractMultiThreadedSelfTest.java @@ -195,7 +195,6 @@ public abstract class ClientAbstractMultiThreadedSelfTest extends GridCommonAbst cfg.setAffinity(new CacheRendezvousAffinityFunction()); - cfg.setDistributionMode(NEAR_PARTITIONED); cfg.setAtomicityMode(TRANSACTIONAL); if (cacheName == null) http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52e4a96c/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractMultiNodeSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractMultiNodeSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractMultiNodeSelfTest.java index 9257b71..0e2310f 100644 --- a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractMultiNodeSelfTest.java +++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractMultiNodeSelfTest.java @@ -180,7 +180,6 @@ public abstract class ClientAbstractMultiNodeSelfTest extends GridCommonAbstract CacheConfiguration cfg = defaultCacheConfiguration(); cfg.setAtomicityMode(TRANSACTIONAL); - cfg.setDistributionMode(NEAR_PARTITIONED); if (cacheName == null) cfg.setCacheMode(LOCAL); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52e4a96c/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcComplexQuerySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcComplexQuerySelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcComplexQuerySelfTest.java index 7e734b6..dfd23d4 100644 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcComplexQuerySelfTest.java +++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcComplexQuerySelfTest.java @@ -57,7 +57,6 @@ public class JdbcComplexQuerySelfTest extends GridCommonAbstractTest { cache.setCacheMode(PARTITIONED); cache.setBackups(1); cache.setWriteSynchronizationMode(FULL_SYNC); - cache.setDistributionMode(NEAR_PARTITIONED); cache.setAtomicityMode(TRANSACTIONAL); cfg.setCacheConfiguration(cache); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52e4a96c/modules/core/src/main/java/org/apache/ignite/Ignite.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/Ignite.java b/modules/core/src/main/java/org/apache/ignite/Ignite.java index 09991d9..5d94125 100644 --- a/modules/core/src/main/java/org/apache/ignite/Ignite.java +++ b/modules/core/src/main/java/org/apache/ignite/Ignite.java @@ -194,9 +194,9 @@ public interface Ignite extends AutoCloseable { public <K, V> IgniteCache<K, V> createCache(CacheConfiguration<K, V> cacheCfg); public <K, V> IgniteCache<K, V> createCache(CacheConfiguration<K, V> cacheCfg, - @Nullable NearCacheConfiguration<K, V> nearCfg); + NearCacheConfiguration<K, V> nearCfg); - public <K, V> IgniteCache<K, V> createCache(@Nullable NearCacheConfiguration<K, V> nearCfg); + public <K, V> IgniteCache<K, V> createCache(NearCacheConfiguration<K, V> nearCfg); /** * Stops dynamically started cache. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52e4a96c/modules/core/src/main/java/org/apache/ignite/cache/GridCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cache/GridCache.java b/modules/core/src/main/java/org/apache/ignite/cache/GridCache.java index 1b4be2d..8d6e5fc 100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/GridCache.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/GridCache.java @@ -220,4 +220,9 @@ public interface GridCache<K, V> extends CacheProjection<K, V> { * @return Future that will be completed when preloading is finished. */ public IgniteInternalFuture<?> forceRepartition(); + + /** + * @return {@code True} if local node is affinity node. + */ + public boolean affinityNode(); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52e4a96c/modules/core/src/main/java/org/apache/ignite/cluster/ClusterGroup.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterGroup.java b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterGroup.java index 983a962..ef6a162 100644 --- a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterGroup.java +++ b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterGroup.java @@ -18,7 +18,7 @@ package org.apache.ignite.cluster; import org.apache.ignite.*; -import org.apache.ignite.cache.*; +import org.apache.ignite.configuration.*; import org.apache.ignite.lang.*; import org.jetbrains.annotations.*; @@ -26,8 +26,8 @@ import java.util.*; /** * Defines grid projection which represents a common functionality over a group of nodes. - * The {@link org.apache.ignite.Ignite} interface itself also extends {@code GridProjection} which makes - * an instance of {@link org.apache.ignite.Ignite} a projection over all grid nodes. + * The {@link Ignite} interface itself also extends {@code GridProjection} which makes + * an instance of {@link Ignite} a projection over all grid nodes. * <h1 class="header">Clustering</h1> * Grid projection allows to group grid nodes into various subgroups to perform distributed * operations on them. All {@code 'forXXX(...)'} methods will create a child grid projection @@ -52,9 +52,9 @@ import java.util.*; * <h1 class="header">Features</h1> * Grid projection provides the following functionality over the underlying group of nodes: * <ul> - * <li>{@link org.apache.ignite.IgniteCompute} - functionality for executing tasks and closures over nodes in this projection.</li> - * <li>{@link org.apache.ignite.IgniteMessaging} - functionality for topic-based message exchange over nodes in this projection.</li> - * <li>{@link org.apache.ignite.IgniteEvents} - functionality for querying and listening to events on nodes in this projection.</li> + * <li>{@link IgniteCompute} - functionality for executing tasks and closures over nodes in this projection.</li> + * <li>{@link IgniteMessaging} - functionality for topic-based message exchange over nodes in this projection.</li> + * <li>{@link IgniteEvents} - functionality for querying and listening to events on nodes in this projection.</li> * </ul> */ public interface ClusterGroup { @@ -130,7 +130,7 @@ public interface ClusterGroup { * specified in user attributes. * <p> * User attributes for every node are optional and can be specified in - * grid node configuration. See {@link org.apache.ignite.configuration.IgniteConfiguration#getUserAttributes()} + * grid node configuration. See {@link IgniteConfiguration#getUserAttributes()} * for more information. * * @param name Name of the attribute. @@ -148,22 +148,18 @@ public interface ClusterGroup { public ClusterGroup forCacheNodes(String cacheName); /** - * Creates projection for all nodes that have cache with specified name running and cache distribution mode is - * {@link CacheDistributionMode#PARTITIONED_ONLY} or {@link CacheDistributionMode#NEAR_PARTITIONED}. + * Creates projection for all affinity nodes that have cache with specified name running. * * @param cacheName Cache name. * @return Projection over nodes that have specified cache running. - * @see org.apache.ignite.configuration.CacheConfiguration#getDistributionMode() */ public ClusterGroup forDataNodes(String cacheName); /** - * Creates projection for all nodes that have cache with specified name running and cache distribution mode is - * {@link CacheDistributionMode#CLIENT_ONLY} or {@link CacheDistributionMode#NEAR_ONLY}. + * Creates projection for all non-affinity nodes that have cache with specified name running. * * @param cacheName Cache name. * @return Projection over nodes that have specified cache running. - * @see org.apache.ignite.configuration.CacheConfiguration#getDistributionMode() */ public ClusterGroup forClientNodes(String cacheName); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52e4a96c/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java index 723d327..02942d5 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java @@ -74,9 +74,6 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> { /** Default atomicity mode. */ public static final CacheAtomicityMode DFLT_CACHE_ATOMICITY_MODE = CacheAtomicityMode.ATOMIC; - /** Default value for cache distribution mode. */ - public static final CacheDistributionMode DFLT_DISTRIBUTION_MODE = CacheDistributionMode.PARTITIONED_ONLY; - /** Default query timeout. */ public static final long DFLT_QUERY_TIMEOUT = 0; @@ -110,9 +107,6 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> { /** Default eviction synchronized flag. */ public static final boolean DFLT_EVICT_SYNCHRONIZED = false; - /** Default near nodes eviction synchronized flag. */ - public static final boolean DFLT_EVICT_NEAR_SYNCHRONIZED = true; - /** Default eviction key buffer size for batching synchronized evicts. */ public static final int DFLT_EVICT_KEY_BUFFER_SIZE = 1024; @@ -194,15 +188,9 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> { /** Cache expiration policy. */ private CacheEvictionPolicy evictPlc; - /** Near cache eviction policy. */ - private CacheEvictionPolicy nearEvictPlc; - /** Flag indicating whether eviction is synchronized. */ private boolean evictSync = DFLT_EVICT_SYNCHRONIZED; - /** Flag indicating whether eviction is synchronized with near nodes. */ - private boolean evictNearSync = DFLT_EVICT_NEAR_SYNCHRONIZED; - /** Eviction key buffer size. */ private int evictKeyBufSize = DFLT_EVICT_KEY_BUFFER_SIZE; @@ -230,11 +218,8 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> { /** Default cache start size. */ private int startSize = DFLT_START_SIZE; - /** Default near cache start size. */ - private int nearStartSize = DFLT_NEAR_START_SIZE; - - /** Cache distribution mode. */ - private CacheDistributionMode distro = DFLT_DISTRIBUTION_MODE; + /** Near cache configuration. */ + private NearCacheConfiguration<K, V> nearCfg; /** Write synchronization mode. */ private CacheWriteSynchronizationMode writeSync; @@ -373,12 +358,10 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> { cacheWriterFactory = cc.getCacheWriterFactory(); dfltLockTimeout = cc.getDefaultLockTimeout(); dfltQryTimeout = cc.getDefaultQueryTimeout(); - distro = cc.getDistributionMode(); eagerTtl = cc.isEagerTtl(); evictFilter = cc.getEvictionFilter(); evictKeyBufSize = cc.getEvictSynchronizedKeyBufferSize(); evictMaxOverflowRatio = cc.getEvictMaxOverflowRatio(); - evictNearSync = cc.isEvictNearSynchronized(); evictPlc = cc.getEvictionPolicy(); evictSync = cc.isEvictSynchronized(); evictSyncConcurrencyLvl = cc.getEvictSynchronizedConcurrencyLevel(); @@ -396,8 +379,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> { maxQryIterCnt = cc.getMaximumQueryIteratorCount(); memMode = cc.getMemoryMode(); name = cc.getName(); - nearStartSize = cc.getNearStartSize(); - nearEvictPlc = cc.getNearEvictionPolicy(); + nearCfg = cc.getNearConfiguration(); nodeFilter = cc.getNodeFilter(); preloadMode = cc.getPreloadMode(); preloadBatchSize = cc.getPreloadBatchSize(); @@ -486,38 +468,17 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> { } /** - * Gets cache distribution mode. This parameter is taken into account only if - * {@link #getCacheMode()} is set to {@link CacheMode#PARTITIONED} or {@link CacheMode#REPLICATED} mode. - * <p> - * If not set, default value is {@link #DFLT_DISTRIBUTION_MODE}. - * - * @return Cache distribution mode. - */ - public CacheDistributionMode getDistributionMode() { - return distro; - } - - /** - * Sets cache distribution mode. - * - * @param distro Distribution mode. - */ - public void setDistributionMode(CacheDistributionMode distro) { - this.distro = distro; - } - - /** * @return Near enabled flag. */ - public boolean isNearEnabled() { - return distro == CacheDistributionMode.NEAR_ONLY || distro == CacheDistributionMode.NEAR_PARTITIONED; + public NearCacheConfiguration<K, V> getNearConfiguration() { + return nearCfg; } /** - * @param nearEnabled Near enabled flag. + * @param nearCfg Near cache configuration. */ - public void setNearEnabled(boolean nearEnabled) { - distro = nearEnabled ? CacheDistributionMode.NEAR_PARTITIONED : CacheDistributionMode.PARTITIONED_ONLY; + public void setNearConfiguration(NearCacheConfiguration<K, V> nearCfg) { + this.nearCfg = nearCfg; } /** @@ -540,28 +501,6 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> { } /** - * Gets eviction policy for {@code near} cache which is different from the one used for - * {@code partitioned} cache. By default, returns {@code null} - * which means that evictions are disabled for near cache. - * - * @return Cache eviction policy or {@code null} if evictions should be disabled. - */ - @SuppressWarnings({"unchecked"}) - @Nullable public CacheEvictionPolicy<K, V> getNearEvictionPolicy() { - return nearEvictPlc; - } - - /** - * Sets eviction policy for near cache. This property is only used for {@link CacheMode#PARTITIONED} caching - * mode. - * - * @param nearEvictPlc Eviction policy for near cache. - */ - public void setNearEvictionPolicy(@Nullable CacheEvictionPolicy nearEvictPlc) { - this.nearEvictPlc = nearEvictPlc; - } - - /** * Gets filter which determines on what nodes the cache should be started. * * @return Predicate specifying on which nodes the cache should be started. @@ -580,13 +519,10 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> { } /** - * Gets flag indicating whether eviction is synchronized between primary and - * backup nodes on partitioned cache. If this parameter is {@code true} and - * swap is disabled then {@link CacheProjection#evict(Object)} - * and all its variations will involve all nodes where an entry is kept - - * this is a group of nodes responsible for partition to which - * corresponding key belongs. If this property is set to {@code false} then - * eviction is done independently on cache nodes. + * Gets flag indicating whether eviction is synchronized between primary, backup and near nodes. + * If this parameter is {@code true} and swap is disabled then {@link IgniteCache#localEvict(Collection)} + * will involve all nodes where an entry is kept. If this property is set to {@code false} then + * eviction is done independently on different cache nodes. * <p> * Default value is defined by {@link #DFLT_EVICT_SYNCHRONIZED}. * <p> @@ -602,8 +538,8 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> { } /** - * Sets flag indicating whether eviction is synchronized with backup nodes (or the rest of the nodes for replicated - * cache). + * Sets flag indicating whether eviction is synchronized with backup nodes or near caches + * (or the rest of the nodes for replicated cache). * * @param evictSync {@code true} if synchronized, {@code false} if not. */ @@ -612,32 +548,6 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> { } /** - * Sets flag indicating whether eviction is synchronized with near nodes. - * - * @param evictNearSync {@code true} if synchronized, {@code false} if not. - */ - public void setEvictNearSynchronized(boolean evictNearSync) { - this.evictNearSync = evictNearSync; - } - - /** - * Gets flag indicating whether eviction on primary node is synchronized with - * near nodes where entry is kept. Default value is {@code true} and - * is defined by {@link #DFLT_EVICT_NEAR_SYNCHRONIZED}. - * <p> - * Note that in most cases this property should be set to {@code true} to keep - * cache consistency. But there may be the cases when user may use some - * special near eviction policy to have desired control over near cache - * entry set. - * - * @return {@code true} If eviction is synchronized with near nodes in - * partitioned cache, {@code false} if not. - */ - public boolean isEvictNearSynchronized() { - return evictNearSync; - } - - /** * Gets size of the key buffer for synchronized evictions. * <p> * Default value is defined by {@link #DFLT_EVICT_KEY_BUFFER_SIZE}. @@ -659,7 +569,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> { /** * Gets concurrency level for synchronized evictions. This flag only makes sense - * with {@link #isEvictNearSynchronized()} or {@link #isEvictSynchronized()} set + * with {@link #isEvictSynchronized()} set * to {@code true}. When synchronized evictions are enabled, it is possible that * local eviction policy will try to evict entries faster than evictions can be * synchronized with backup or near nodes. This value specifies how many concurrent @@ -812,25 +722,6 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> { } /** - * Gets initial cache size for near cache which will be used to pre-create internal - * hash table after start. Default value is defined by {@link #DFLT_NEAR_START_SIZE}. - * - * @return Initial near cache size. - */ - public int getNearStartSize() { - return nearStartSize; - } - - /** - * Start size for near cache. This property is only used for {@link CacheMode#PARTITIONED} caching mode. - * - * @param nearStartSize Start size for near cache. - */ - public void setNearStartSize(int nearStartSize) { - this.nearStartSize = nearStartSize; - } - - /** * Gets flag indicating whether value should be loaded from store if it is not in the cache * for following cache operations: * <ul> http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52e4a96c/modules/core/src/main/java/org/apache/ignite/configuration/NearCacheConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/NearCacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/NearCacheConfiguration.java index e729b9d..7d83d41 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/NearCacheConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/configuration/NearCacheConfiguration.java @@ -36,10 +36,7 @@ public class NearCacheConfiguration<K, V> extends MutableConfiguration<K, V> { private boolean nearEnabled; /** Near cache eviction policy. */ - private CacheEvictionPolicy nearEvictPlc; - - /** Flag indicating whether eviction is synchronized with near nodes. */ - private boolean evictNearSync = DFLT_EVICT_NEAR_SYNCHRONIZED; + private CacheEvictionPolicy<K, V> nearEvictPlc; /** Default near cache start size. */ private int nearStartSize = DFLT_NEAR_START_SIZE; @@ -52,30 +49,15 @@ public class NearCacheConfiguration<K, V> extends MutableConfiguration<K, V> { } /** - * @param cfg Configuration to copy. + * @param ccfg Configuration to copy. */ - public NearCacheConfiguration(CompleteConfiguration<K, V> cfg) { - super(cfg); - - // Preserve alphabetic order. - if (cfg instanceof CacheConfiguration) { - CacheConfiguration ccfg = (CacheConfiguration)cfg; - - evictNearSync = ccfg.isEvictNearSynchronized(); - name = ccfg.getName(); - nearEnabled = ccfg.isNearEnabled(); - nearEvictPlc = ccfg.getNearEvictionPolicy(); - nearStartSize = ccfg.getNearStartSize(); - } - else if (cfg instanceof NearCacheConfiguration) { - NearCacheConfiguration ccfg = (NearCacheConfiguration)cfg; - - evictNearSync = ccfg.isEvictNearSynchronized(); - name = ccfg.getName(); - nearEnabled = ccfg.isNearEnabled(); - nearEvictPlc = ccfg.getNearEvictionPolicy(); - nearStartSize = ccfg.getNearStartSize(); - } + public NearCacheConfiguration(NearCacheConfiguration<K, V> ccfg) { + super(ccfg); + + name = ccfg.getName(); + nearEnabled = ccfg.isNearEnabled(); + nearEvictPlc = ccfg.getNearEvictionPolicy(); + nearStartSize = ccfg.getNearStartSize(); } /** @@ -117,43 +99,18 @@ public class NearCacheConfiguration<K, V> extends MutableConfiguration<K, V> { /** * @return Near eviction policy. */ - public CacheEvictionPolicy getNearEvictionPolicy() { + public CacheEvictionPolicy<K, V> getNearEvictionPolicy() { return nearEvictPlc; } /** * @param nearEvictPlc Near eviction policy. */ - public void setNearEvictionPolicy(CacheEvictionPolicy nearEvictPlc) { + public void setNearEvictionPolicy(CacheEvictionPolicy<K, V> nearEvictPlc) { this.nearEvictPlc = nearEvictPlc; } /** - * Gets flag indicating whether eviction on primary node is synchronized with - * near nodes where entry is kept. Default value is {@code true}. - * <p> - * Note that in most cases this property should be set to {@code true} to keep - * cache consistency. But there may be the cases when user may use some - * special near eviction policy to have desired control over near cache - * entry set. - * - * @return {@code true} If eviction is synchronized with near nodes in - * partitioned cache, {@code false} if not. - */ - public boolean isEvictNearSynchronized() { - return evictNearSync; - } - - /** - * Sets flag indicating whether eviction is synchronized with near nodes. - * - * @param evictNearSync {@code true} if synchronized, {@code false} if not. - */ - public void setEvictNearSynchronized(boolean evictNearSync) { - this.evictNearSync = evictNearSync; - } - - /** * Gets initial cache size for near cache which will be used to pre-create internal * hash table after start. Default value is defined by {@link CacheConfiguration#DFLT_NEAR_START_SIZE}. * http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52e4a96c/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java index 6562bbd..bea0bd8 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java @@ -19,6 +19,7 @@ package org.apache.ignite.internal; import org.apache.ignite.*; import org.apache.ignite.cache.affinity.rendezvous.*; +import org.apache.ignite.compute.ComputeJob; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.processors.resource.*; import org.apache.ignite.internal.processors.spring.*; @@ -33,8 +34,8 @@ import org.apache.ignite.marshaller.jdk.*; import org.apache.ignite.marshaller.optimized.*; import org.apache.ignite.mxbean.*; import org.apache.ignite.plugin.segmentation.*; +import org.apache.ignite.resources.SpringApplicationContextResource; import org.apache.ignite.spi.*; -import org.apache.ignite.spi.checkpoint.*; import org.apache.ignite.spi.checkpoint.noop.*; import org.apache.ignite.spi.collision.noop.*; import org.apache.ignite.spi.communication.tcp.*; @@ -42,10 +43,8 @@ import org.apache.ignite.spi.deployment.local.*; import org.apache.ignite.spi.discovery.tcp.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.*; import org.apache.ignite.spi.eventstorage.memory.*; -import org.apache.ignite.spi.failover.*; import org.apache.ignite.spi.failover.always.*; import org.apache.ignite.spi.indexing.noop.*; -import org.apache.ignite.spi.loadbalancing.*; import org.apache.ignite.spi.loadbalancing.roundrobin.*; import org.apache.ignite.spi.swapspace.file.*; import org.apache.ignite.spi.swapspace.noop.*; @@ -68,7 +67,6 @@ import java.util.logging.*; import static org.apache.ignite.IgniteState.*; import static org.apache.ignite.IgniteSystemProperties.*; import static org.apache.ignite.cache.CacheAtomicityMode.*; -import static org.apache.ignite.cache.CacheDistributionMode.*; import static org.apache.ignite.cache.CacheMode.*; import static org.apache.ignite.cache.CachePreloadMode.*; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*; @@ -89,7 +87,7 @@ import static org.apache.ignite.plugin.segmentation.GridSegmentationPolicy.*; * </ul> * <h1 class="header">Examples</h1> * Use {@link #start()} method to start grid with default configuration. You can also use - * {@link org.apache.ignite.configuration.IgniteConfiguration} to override some default configuration. Below is an + * {@link IgniteConfiguration} to override some default configuration. Below is an * example on how to start grid with <strong>URI deployment</strong>. * <pre name="code" class="java"> * GridConfiguration cfg = new GridConfiguration(); @@ -161,7 +159,7 @@ public class IgnitionEx { * <p> * If daemon flag is set then all grid instances created by the factory will be * daemon, i.e. the local node for these instances will be a daemon node. Note that - * if daemon flag is set - it will override the same settings in {@link org.apache.ignite.configuration.IgniteConfiguration#isDaemon()}. + * if daemon flag is set - it will override the same settings in {@link IgniteConfiguration#isDaemon()}. * Note that you can set on and off daemon flag at will. * * @param daemon Daemon flag to set. @@ -175,7 +173,7 @@ public class IgnitionEx { * <p> * If daemon flag it set then all grid instances created by the factory will be * daemon, i.e. the local node for these instances will be a daemon node. Note that - * if daemon flag is set - it will override the same settings in {@link org.apache.ignite.configuration.IgniteConfiguration#isDaemon()}. + * if daemon flag is set - it will override the same settings in {@link IgniteConfiguration#isDaemon()}. * Note that you can set on and off daemon flag at will. * * @return Daemon flag. @@ -236,7 +234,7 @@ public class IgnitionEx { * Note that method does not wait for all tasks to be completed. * * @param cancel If {@code true} then all jobs currently executing on - * default grid will be cancelled by calling {@link org.apache.ignite.compute.ComputeJob#cancel()} + * default grid will be cancelled by calling {@link ComputeJob#cancel()} * method. Note that just like with {@link Thread#interrupt()}, it is * up to the actual job to exit from execution * @return {@code true} if default grid instance was indeed stopped, @@ -256,7 +254,7 @@ public class IgnitionEx { * @param name Grid name. If {@code null}, then default no-name grid will * be stopped. * @param cancel If {@code true} then all jobs currently will be cancelled - * by calling {@link org.apache.ignite.compute.ComputeJob#cancel()} method. Note that just like with + * by calling {@link ComputeJob#cancel()} method. Note that just like with * {@link Thread#interrupt()}, it is up to the actual job to exit from * execution. If {@code false}, then jobs currently running will not be * canceled. In either case, grid node will wait for completion of all @@ -307,7 +305,7 @@ public class IgnitionEx { * should be responsible for stopping it. * * @param cancel If {@code true} then all jobs currently executing on - * all grids will be cancelled by calling {@link org.apache.ignite.compute.ComputeJob#cancel()} + * all grids will be cancelled by calling {@link ComputeJob#cancel()} * method. Note that just like with {@link Thread#interrupt()}, it is * up to the actual job to exit from execution */ @@ -356,10 +354,10 @@ public class IgnitionEx { * scripts support restarting of JVM Ignite's process. * * @param cancel If {@code true} then all jobs currently executing on - * all grids will be cancelled by calling {@link org.apache.ignite.compute.ComputeJob#cancel()} + * all grids will be cancelled by calling {@link ComputeJob#cancel()} * method. Note that just like with {@link Thread#interrupt()}, it is * up to the actual job to exit from execution. - * @see org.apache.ignite.Ignition#RESTART_EXIT_CODE + * @see Ignition#RESTART_EXIT_CODE */ public static void restart(boolean cancel) { String file = System.getProperty(IGNITE_SUCCESS_FILE); @@ -400,13 +398,13 @@ public class IgnitionEx { * should be responsible for stopping it. * <p> * Note that upon completion of this method, the JVM with forcefully exist with - * exit code {@link org.apache.ignite.Ignition#KILL_EXIT_CODE}. + * exit code {@link Ignition#KILL_EXIT_CODE}. * * @param cancel If {@code true} then all jobs currently executing on - * all grids will be cancelled by calling {@link org.apache.ignite.compute.ComputeJob#cancel()} + * all grids will be cancelled by calling {@link ComputeJob#cancel()} * method. Note that just like with {@link Thread#interrupt()}, it is * up to the actual job to exit from execution. - * @see org.apache.ignite.Ignition#KILL_EXIT_CODE + * @see Ignition#KILL_EXIT_CODE */ public static void kill(boolean cancel) { stopAll(cancel); @@ -436,7 +434,7 @@ public class IgnitionEx { * @param springCtx Optional Spring application context, possibly {@code null}. * Spring bean definitions for bean injection are taken from this context. * If provided, this context can be injected into grid tasks and grid jobs using - * {@link org.apache.ignite.resources.SpringApplicationContextResource @IgniteSpringApplicationContextResource} annotation. + * {@link SpringApplicationContextResource @IgniteSpringApplicationContextResource} annotation. * @return Started grid. * @throws IgniteCheckedException If default grid could not be started. This exception will be thrown * also if default grid has already been started. @@ -473,7 +471,7 @@ public class IgnitionEx { * @param springCtx Optional Spring application context, possibly {@code null}. * Spring bean definitions for bean injection are taken from this context. * If provided, this context can be injected into grid tasks and grid jobs using - * {@link org.apache.ignite.resources.SpringApplicationContextResource @IgniteSpringApplicationContextResource} annotation. + * {@link SpringApplicationContextResource @IgniteSpringApplicationContextResource} annotation. * @return Started grid. * @throws IgniteCheckedException If grid could not be started. This exception will be thrown * also if named grid has already been started. @@ -659,7 +657,7 @@ public class IgnitionEx { * @param springCtx Optional Spring application context, possibly {@code null}. * Spring bean definitions for bean injection are taken from this context. * If provided, this context can be injected into grid tasks and grid jobs using - * {@link org.apache.ignite.resources.SpringApplicationContextResource @IgniteSpringApplicationContextResource} annotation. + * {@link SpringApplicationContextResource @IgniteSpringApplicationContextResource} annotation. * @return Started grid. If Spring configuration contains multiple grid instances, * then the 1st found instance is returned. * @throws IgniteCheckedException If grid could not be started or configuration @@ -707,7 +705,7 @@ public class IgnitionEx { * @param springCtx Optional Spring application context, possibly {@code null}. * Spring bean definitions for bean injection are taken from this context. * If provided, this context can be injected into grid tasks and grid jobs using - * {@link org.apache.ignite.resources.SpringApplicationContextResource @IgniteSpringApplicationContextResource} annotation. + * {@link SpringApplicationContextResource @IgniteSpringApplicationContextResource} annotation. * @return Started grid. If Spring configuration contains multiple grid instances, * then the 1st found instance is returned. * @throws IgniteCheckedException If grid could not be started or configuration @@ -739,17 +737,17 @@ public class IgnitionEx { IgniteBiTuple<Object, Object> t = null; - Collection<Handler> savedHnds = null; - if (isLog4jUsed) { try { t = U.addLog4jNoOpLogger(); } - catch (IgniteCheckedException e) { + catch (IgniteCheckedException ignore) { isLog4jUsed = false; } } + Collection<Handler> savedHnds = null; + if (!isLog4jUsed) savedHnds = U.addJavaNoOpLogger(); @@ -918,7 +916,7 @@ public class IgnitionEx { * * @return An instance of default no-name grid. This method never returns * {@code null}. - * @throws org.apache.ignite.IgniteIllegalStateException Thrown if default grid was not properly + * @throws IgniteIllegalStateException Thrown if default grid was not properly * initialized or grid instance was stopped or was not started. */ public static Ignite grid() throws IgniteIllegalStateException { @@ -961,7 +959,7 @@ public class IgnitionEx { * @param locNodeId ID of local node the requested grid instance is managing. * @return An instance of named grid. This method never returns * {@code null}. - * @throws org.apache.ignite.IgniteIllegalStateException Thrown if grid was not properly + * @throws IgniteIllegalStateException Thrown if grid was not properly * initialized or grid instance was stopped or was not started. */ public static Ignite grid(UUID locNodeId) throws IgniteIllegalStateException { @@ -1000,7 +998,7 @@ public class IgnitionEx { * then grid instance belonging to a default no-name grid will be returned. * @return An instance of named grid. This method never returns * {@code null}. - * @throws org.apache.ignite.IgniteIllegalStateException Thrown if default grid was not properly + * @throws IgniteIllegalStateException Thrown if default grid was not properly * initialized or grid instance was stopped or was not started. */ public static Ignite grid(@Nullable String name) throws IgniteIllegalStateException { @@ -1051,7 +1049,7 @@ public class IgnitionEx { } /** - * Removes lsnr added by {@link #addListener(org.apache.ignite.IgnitionListener)} method. + * Removes lsnr added by {@link #addListener(IgnitionListener)} method. * * @param lsnr Listener to remove. * @return {@code true} if lsnr was added before, {@code false} otherwise. @@ -1679,6 +1677,7 @@ public class IgnitionEx { * @param cfg Ignite configuration. * @throws IgniteCheckedException If failed. */ + @SuppressWarnings("unchecked") public void initializeDefaultCacheConfiguration(IgniteConfiguration cfg) throws IgniteCheckedException { CacheConfiguration[] cacheCfgs = cfg.getCacheConfiguration(); @@ -1783,16 +1782,16 @@ public class IgnitionEx { cfg.setEventStorageSpi(new MemoryEventStorageSpi()); if (cfg.getCheckpointSpi() == null) - cfg.setCheckpointSpi(new CheckpointSpi[] {new NoopCheckpointSpi()}); + cfg.setCheckpointSpi(new NoopCheckpointSpi()); if (cfg.getCollisionSpi() == null) cfg.setCollisionSpi(new NoopCollisionSpi()); if (cfg.getFailoverSpi() == null) - cfg.setFailoverSpi(new FailoverSpi[] {new AlwaysFailoverSpi()}); + cfg.setFailoverSpi(new AlwaysFailoverSpi()); if (cfg.getLoadBalancingSpi() == null) - cfg.setLoadBalancingSpi(new LoadBalancingSpi[] {new RoundRobinLoadBalancingSpi()}); + cfg.setLoadBalancingSpi(new RoundRobinLoadBalancingSpi()); if (cfg.getIndexingSpi() == null) cfg.setIndexingSpi(new NoopIndexingSpi()); @@ -1820,6 +1819,7 @@ public class IgnitionEx { * @return Initialized logger. * @throws IgniteCheckedException If failed. */ + @SuppressWarnings("ErrorNotRethrown") private IgniteLogger initLogger(@Nullable IgniteLogger cfgLog, UUID nodeId) throws IgniteCheckedException { try { Exception log4jInitErr = null; @@ -1900,22 +1900,23 @@ public class IgnitionEx { * @return Utility system cache configuration. */ private static CacheConfiguration utilitySystemCache(boolean client) { - CacheConfiguration cache = new CacheConfiguration(); - - cache.setName(CU.UTILITY_CACHE_NAME); - cache.setCacheMode(REPLICATED); - cache.setAtomicityMode(TRANSACTIONAL); - cache.setSwapEnabled(false); - cache.setQueryIndexEnabled(false); - cache.setPreloadMode(SYNC); - cache.setWriteSynchronizationMode(FULL_SYNC); - cache.setAffinity(new CacheRendezvousAffinityFunction(false, 100)); - cache.setNodeFilter(CacheConfiguration.ALL_NODES); - - if (client) - cache.setDistributionMode(CLIENT_ONLY); - - return cache; + if (!client) { + CacheConfiguration cache = new CacheConfiguration(); + + cache.setName(CU.UTILITY_CACHE_NAME); + cache.setCacheMode(REPLICATED); + cache.setAtomicityMode(TRANSACTIONAL); + cache.setSwapEnabled(false); + cache.setQueryIndexEnabled(false); + cache.setPreloadMode(SYNC); + cache.setWriteSynchronizationMode(FULL_SYNC); + cache.setAffinity(new CacheRendezvousAffinityFunction(false, 100)); + cache.setNodeFilter(CacheConfiguration.ALL_NODES); + + return cache; + } + + return null; } /** @@ -1926,26 +1927,25 @@ public class IgnitionEx { * @return Cache configuration for atomic data structures. */ private static CacheConfiguration atomicsSystemCache(AtomicConfiguration cfg, boolean client) { - CacheConfiguration ccfg = new CacheConfiguration(); - - ccfg.setName(CU.ATOMICS_CACHE_NAME); - ccfg.setAtomicityMode(TRANSACTIONAL); - ccfg.setSwapEnabled(false); - ccfg.setQueryIndexEnabled(false); - ccfg.setPreloadMode(SYNC); - ccfg.setWriteSynchronizationMode(FULL_SYNC); - ccfg.setCacheMode(cfg.getCacheMode()); - ccfg.setNodeFilter(CacheConfiguration.ALL_NODES); - - if (cfg.getCacheMode() == PARTITIONED) { - ccfg.setBackups(cfg.getBackups()); - - ccfg.setDistributionMode(client ? NEAR_ONLY : NEAR_PARTITIONED); + if (!client) { + CacheConfiguration ccfg = new CacheConfiguration(); + + ccfg.setName(CU.ATOMICS_CACHE_NAME); + ccfg.setAtomicityMode(TRANSACTIONAL); + ccfg.setSwapEnabled(false); + ccfg.setQueryIndexEnabled(false); + ccfg.setPreloadMode(SYNC); + ccfg.setWriteSynchronizationMode(FULL_SYNC); + ccfg.setCacheMode(cfg.getCacheMode()); + ccfg.setNodeFilter(CacheConfiguration.ALL_NODES); + + if (cfg.getCacheMode() == PARTITIONED) + ccfg.setBackups(cfg.getBackups()); + + return ccfg; } - else - ccfg.setDistributionMode(client ? NEAR_ONLY : PARTITIONED_ONLY); - return ccfg; + return null; } /** @@ -2071,7 +2071,7 @@ public class IgnitionEx { } /** - * Registers delegate Mbean instance for {@link org.apache.ignite.Ignition}. + * Registers delegate Mbean instance for {@link Ignition}. * * @param srv MBeanServer where mbean should be registered. * @throws IgniteCheckedException If registration failed. @@ -2124,7 +2124,7 @@ public class IgnitionEx { } /** - * Unregister delegate Mbean instance for {@link org.apache.ignite.Ignition}. + * Unregister delegate Mbean instance for {@link Ignition}. */ private void unregisterFactoryMBean() { synchronized (mbeans) { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52e4a96c/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java index 178c604..e955d81 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java @@ -22,10 +22,12 @@ import org.apache.ignite.cache.*; import org.apache.ignite.cluster.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.executor.*; +import org.apache.ignite.internal.managers.discovery.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; +import org.apache.ignite.resources.*; import org.jetbrains.annotations.*; import java.io.*; @@ -514,17 +516,17 @@ public class ClusterGroupAdapter implements ClusterGroupEx, Externalizable { /** {@inheritDoc} */ @Override public final ClusterGroup forCacheNodes(@Nullable String cacheName) { - return forPredicate(new CachesFilter(cacheName, null)); + return forPredicate(new CachesFilter(cacheName, true, true, true)); } /** {@inheritDoc} */ @Override public final ClusterGroup forDataNodes(@Nullable String cacheName) { - return forPredicate(new CachesFilter(cacheName, CachesFilter.DATA_MODES)); + return forPredicate(new CachesFilter(cacheName, true, false, false)); } /** {@inheritDoc} */ @Override public final ClusterGroup forClientNodes(@Nullable String cacheName) { - return forPredicate(new CachesFilter(cacheName, CachesFilter.CLIENT_MODES)); + return forPredicate(new CachesFilter(cacheName, false, true, true)); } /** {@inheritDoc} */ @@ -533,9 +535,9 @@ public class ClusterGroupAdapter implements ClusterGroupEx, Externalizable { } /** {@inheritDoc} */ - @Override public ClusterGroup forCacheNodes(@Nullable String cacheName, - Set<CacheDistributionMode> distributionModes) { - return forPredicate(new CachesFilter(cacheName, distributionModes)); + @Override public ClusterGroup forCacheNodes(@Nullable String cacheName, boolean affNodes, boolean nearNodes, + boolean clientNodes) { + return forPredicate(new CachesFilter(cacheName, affNodes, nearNodes, clientNodes)); } /** {@inheritDoc} */ @@ -670,29 +672,42 @@ public class ClusterGroupAdapter implements ClusterGroupEx, Externalizable { /** Cache name. */ private final String cacheName; - /** */ - private final Set<CacheDistributionMode> distributionMode; + /** Affinity nodes. */ + private boolean affNodes; + + /** Near nodes. */ + private boolean nearNodes; + + /** Client nodes. */ + private boolean clients; + + /** Injected Ignite instance. */ + @IgniteInstanceResource + private transient Ignite ignite; /** * @param cacheName Cache name. - * @param distributionMode Filter by {@link org.apache.ignite.configuration.CacheConfiguration#getDistributionMode()}. */ - private CachesFilter(@Nullable String cacheName, @Nullable Set<CacheDistributionMode> distributionMode) { + private CachesFilter(@Nullable String cacheName, boolean affNodes, boolean nearNodes, boolean clients) { this.cacheName = cacheName; - this.distributionMode = distributionMode; + this.affNodes = affNodes; + this.nearNodes = nearNodes; + this.clients = clients; } /** {@inheritDoc} */ + @SuppressWarnings("RedundantIfStatement") @Override public boolean apply(ClusterNode n) { - GridCacheAttributes[] caches = n.attribute(ATTR_CACHE); + GridDiscoveryManager disco = ((IgniteKernal)ignite).context().discovery(); - if (caches != null) { - for (GridCacheAttributes attrs : caches) { - if (Objects.equals(cacheName, attrs.cacheName()) - && (distributionMode == null || distributionMode.contains(attrs.partitionedTaxonomy()))) - return true; - } - } + if (affNodes && disco.cacheAffinityNode(n, cacheName)) + return true; + + if (nearNodes && disco.cacheNearNode(n, cacheName)) + return true; + + if (clients && disco.cacheClientNode(n, cacheName)) + return true; return false; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52e4a96c/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupEx.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupEx.java b/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupEx.java index f11b781..fcd8611 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupEx.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupEx.java @@ -37,8 +37,10 @@ public interface ClusterGroupEx extends ClusterGroup { /** * @param cacheName Cache name. - * @param distributionModes Cache distribution modes. + * @param affNodes Flag to include affinity nodes. + * @param nearNodes Flag to include near nodes. + * @param clientNodes Flag to include client nodes. * @return Cluster group. */ - public ClusterGroup forCacheNodes(@Nullable String cacheName, Set<CacheDistributionMode> distributionModes); + public ClusterGroup forCacheNodes(@Nullable String cacheName, boolean affNodes, boolean nearNodes, boolean clientNodes); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52e4a96c/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java index 8de3d1a..7bce528 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java @@ -168,7 +168,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> { private GridPlainInClosure<Serializable> customEvtLsnr; /** Map of dynamic cache filters. */ - private Map<String, CachePredicate> dynamicCacheFilters = new HashMap<>(); + private Map<String, CachePredicate> registeredCaches = new HashMap<>(); /** @param ctx Context. */ public GridDiscoveryManager(GridKernalContext ctx) { @@ -210,13 +210,13 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> { * @param filter Cache filter. * @param loc {@code True} if cache is local. */ - public void addDynamicCacheFilter( + public void setCacheFilter( String cacheName, IgnitePredicate<ClusterNode> filter, boolean nearEnabled, boolean loc ) { - dynamicCacheFilters.put(cacheName, new CachePredicate(filter, nearEnabled, loc)); + registeredCaches.put(cacheName, new CachePredicate(filter, nearEnabled, loc)); } /** @@ -224,8 +224,21 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> { * * @param cacheName Cache name. */ - public void removeDynamicCacheFilter(String cacheName) { - dynamicCacheFilters.remove(cacheName); + public void removeCacheFilter(String cacheName) { + registeredCaches.remove(cacheName); + } + + /** + * Adds near node ID to cache filter. + * + * @param cacheName Cache name. + * @param nearNodeId Near node ID. + */ + public void addNearNode(String cacheName, UUID nearNodeId) { + CachePredicate predicate = registeredCaches.get(cacheName); + + if (predicate != null) + predicate.addNearNode(nearNodeId); } /** {@inheritDoc} */ @@ -1131,7 +1144,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> { * @return {@code True} if node is a cache data node. */ public boolean cacheAffinityNode(ClusterNode node, String cacheName) { - CachePredicate predicate = dynamicCacheFilters.get(cacheName); + CachePredicate predicate = registeredCaches.get(cacheName); return predicate != null && predicate.dataNode(node); } @@ -1142,18 +1155,24 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> { * @return {@code True} if node has near cache enabled. */ public boolean cacheNearNode(ClusterNode node, String cacheName) { - CachePredicate predicate = dynamicCacheFilters.get(cacheName); + CachePredicate predicate = registeredCaches.get(cacheName); return predicate != null && predicate.nearNode(node); } + public boolean cacheClientNode(ClusterNode node, String cacheName) { + CachePredicate predicate = registeredCaches.get(cacheName); + + return predicate != null && predicate.clientNode(node); + } + /** * @param node Node to check. * @param cacheName Cache name. * @return If cache with the given name is accessible on the given node. */ public boolean cacheNode(ClusterNode node, String cacheName) { - CachePredicate predicate = dynamicCacheFilters.get(cacheName); + CachePredicate predicate = registeredCaches.get(cacheName); return predicate != null && predicate.cacheNode(node); } @@ -1896,7 +1915,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> { boolean hasCaches = false; - for (Map.Entry<String, CachePredicate> entry : dynamicCacheFilters.entrySet()) { + for (Map.Entry<String, CachePredicate> entry : registeredCaches.entrySet()) { String cacheName = entry.getKey(); CachePredicate filter = entry.getValue(); @@ -2177,7 +2196,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> { * @param exclNode Node to exclude. */ private void filterNodeMap(ConcurrentMap<String, Collection<ClusterNode>> map, final ClusterNode exclNode) { - for (String cacheName : dynamicCacheFilters.keySet()) { + for (String cacheName : registeredCaches.keySet()) { String maskedName = maskNull(cacheName); while (true) { @@ -2259,7 +2278,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> { private boolean loc; /** Collection of client near nodes. */ - private Collection<UUID> nearNodes; + private Map<UUID, Boolean> clientNodes; /** * @param cacheFilter Cache filter. @@ -2272,21 +2291,28 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> { this.nearEnabled = nearEnabled; this.loc = loc; - nearNodes = new GridConcurrentHashSet<>(); + clientNodes = new ConcurrentHashMap<>(); } /** * @param nodeId Near node ID to add. */ public void addNearNode(UUID nodeId) { - nearNodes.add(nodeId); + clientNodes.put(nodeId, true); + } + + /** + * @param nodeId Near node ID to add. + */ + public void addClientNode(UUID nodeId) { + clientNodes.put(nodeId, false); } /** * @param nodeId Near node ID to remove. */ public void removeNearNode(UUID nodeId) { - nearNodes.remove(nodeId); + clientNodes.remove(nodeId); } /** @@ -2310,7 +2336,22 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> { * @return {@code True} if near cache is present on the given nodes. */ public boolean nearNode(ClusterNode node) { - return (nearEnabled && cacheFilter.apply(node)) || nearNodes.contains(node.id()); + if (nearEnabled && cacheFilter.apply(node)) + return true; + + Boolean near = clientNodes.get(node.id()); + + return near != null && near; + } + + /** + * @param node Node to check. + * @return {@code True} if near cache is present on the given nodes. + */ + public boolean clientNode(ClusterNode node) { + Boolean near = clientNodes.get(node.id()); + + return near != null && !near; } } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52e4a96c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java index b6776a4..f56a700 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java @@ -34,13 +34,13 @@ public class DynamicCacheChangeRequest implements Serializable { /** Stop cache name. */ @GridToStringExclude - private String stopName; + private String cacheName; /** Cache start configuration. */ private CacheConfiguration startCfg; /** Near node ID in case if near cache is being started. */ - private UUID nearNodeId; + private UUID clientNodeId; /** Near cache configuration. */ private NearCacheConfiguration nearCacheCfg; @@ -61,20 +61,20 @@ public class DynamicCacheChangeRequest implements Serializable { /** * Constructor creates cache stop request. * - * @param stopName Cache stop name. + * @param cacheName Cache stop name. */ - public DynamicCacheChangeRequest(String stopName) { - this.stopName = stopName; + public DynamicCacheChangeRequest(String cacheName) { + this.cacheName = cacheName; } /** * Constructor creates near cache start request. * - * @param nearNodeId Near node ID. + * @param clientNodeId Client node ID. * @param nearCacheCfg Near cache configuration. */ - public DynamicCacheChangeRequest(UUID nearNodeId, NearCacheConfiguration nearCacheCfg) { - this.nearNodeId = nearNodeId; + public DynamicCacheChangeRequest(UUID clientNodeId, NearCacheConfiguration nearCacheCfg) { + this.clientNodeId = clientNodeId; this.nearCacheCfg = nearCacheCfg; } @@ -102,22 +102,22 @@ public class DynamicCacheChangeRequest implements Serializable { /** * @return If this is a near cache start request. */ - public boolean isNearStart() { - return nearNodeId != null; + public boolean isClientStart() { + return clientNodeId != null; } /** * @return Cache name. */ public String cacheName() { - return stopName != null ? stopName : startCfg.getName(); + return cacheName != null ? cacheName : startCfg.getName(); } /** * @return Near node ID. */ - public UUID nearNodeId() { - return nearNodeId; + public UUID clientNodeId() { + return clientNodeId; } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52e4a96c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java index 50586da..a6d2b04 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java @@ -82,12 +82,6 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, /** clearLocally() split threshold. */ public static final int CLEAR_ALL_SPLIT_THRESHOLD = 10000; - /** Distribution modes to include into global size calculation. */ - private static final Set<CacheDistributionMode> SIZE_NODES = EnumSet.of( - CacheDistributionMode.NEAR_PARTITIONED, - CacheDistributionMode.PARTITIONED_ONLY, - CacheDistributionMode.NEAR_ONLY); - /** Deserialization stash. */ private static final ThreadLocal<IgniteBiTuple<String, String>> stash = new ThreadLocal<IgniteBiTuple<String, String>>() { @@ -4182,7 +4176,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, IgniteClusterEx cluster = ctx.grid().cluster(); - ClusterGroup grp = modes.near ? cluster.forCacheNodes(name(), SIZE_NODES) : cluster.forDataNodes(name()); + ClusterGroup grp = modes.near ? cluster.forCacheNodes(name(), true, true, false) : cluster.forDataNodes(name()); Collection<ClusterNode> nodes = grp.nodes(); @@ -4838,6 +4832,11 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, } /** {@inheritDoc} */ + @Override public boolean affinityNode() { + return ctx.affinityNode(); + } + + /** {@inheritDoc} */ @Override public boolean isIgfsDataCache() { return igfsDataCache; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52e4a96c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAttributes.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAttributes.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAttributes.java index 5f715f0..8880678 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAttributes.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAttributes.java @@ -27,9 +27,8 @@ import org.jetbrains.annotations.*; import java.io.*; -import static org.apache.ignite.configuration.CacheConfiguration.*; -import static org.apache.ignite.cache.CacheDistributionMode.*; import static org.apache.ignite.cache.CacheMode.*; +import static org.apache.ignite.configuration.CacheConfiguration.*; /** * Cache attributes. @@ -99,23 +98,7 @@ public class GridCacheAttributes implements Serializable { * @return {@code True} if near cache is enabled. */ public boolean nearCacheEnabled() { - return cacheMode() != LOCAL && ccfg.isNearEnabled(); - } - - /** - * @return {@code True} if the local node will not contribute any local storage to this - * cache, {@code false} otherwise. - */ - @SuppressWarnings("SimplifiableIfStatement") - public boolean isAffinityNode() { - if (cacheMode() == LOCAL) - return true; - - // TODO IGNITE-45 affinity node detection. - - CacheDistributionMode partDistro = ccfg.getDistributionMode(); - - return partDistro == PARTITIONED_ONLY || partDistro == NEAR_PARTITIONED; + return cacheMode() != LOCAL && ccfg.getNearConfiguration() != null; } /** @@ -193,7 +176,12 @@ public class GridCacheAttributes implements Serializable { * @return Near eviction policy class name. */ public String nearEvictionPolicyClassName() { - return className(ccfg.getNearEvictionPolicy()); + NearCacheConfiguration nearCfg = ccfg.getNearConfiguration(); + + if (nearCfg == null) + return null; + + return className(nearCfg.getNearEvictionPolicy()); } /** @@ -233,13 +221,6 @@ public class GridCacheAttributes implements Serializable { } /** - * @return Flag indicating whether eviction is synchronized with near nodes. - */ - public boolean evictNearSynchronized() { - return ccfg.isEvictNearSynchronized(); - } - - /** * @return Maximum eviction overflow ratio. */ public float evictMaxOverflowRatio() { @@ -247,13 +228,6 @@ public class GridCacheAttributes implements Serializable { } /** - * @return Partitioned cache mode. - */ - public CacheDistributionMode partitionedTaxonomy() { - return ccfg.getDistributionMode(); - } - - /** * @return Default query timeout. */ public long defaultQueryTimeout() { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52e4a96c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java index 557b6e3..d58f28f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java @@ -202,6 +202,9 @@ public class GridCacheContext<K, V> implements Externalizable { /** Cache weak query iterator holder. */ private CacheWeakQueryIteratorsHolder<Map.Entry<K, V>> itHolder; + /** Affinity node. */ + private boolean affNode; + /** Conflict resolver. */ private GridCacheVersionAbstractConflictResolver conflictRslvr; @@ -236,6 +239,7 @@ public class GridCacheContext<K, V> implements Externalizable { GridKernalContext ctx, GridCacheSharedContext sharedCtx, CacheConfiguration cacheCfg, + boolean affNode, /* * Managers in starting order! @@ -271,6 +275,7 @@ public class GridCacheContext<K, V> implements Externalizable { this.ctx = ctx; this.sharedCtx = sharedCtx; this.cacheCfg = cacheCfg; + this.affNode = affNode; /* * Managers in starting order! @@ -358,6 +363,13 @@ public class GridCacheContext<K, V> implements Externalizable { } /** + * @return {@code True} if local node is affinity node. + */ + public boolean affinityNode() { + return affNode; + } + + /** * @return Cache default {@link ExpiryPolicy}. */ @Nullable public ExpiryPolicy expiry() { @@ -848,7 +860,7 @@ public class GridCacheContext<K, V> implements Externalizable { /** * @return Cache configuration for given cache instance. */ - public CacheConfiguration config() { + public CacheConfiguration<K, V> config() { return cacheCfg; }