Merge branch 'sprint-1' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-sql-tests
Conflicts: modules/clients/src/test/resources/spring-server-node.xml modules/clients/src/test/resources/spring-server-ssl-node.xml modules/core/src/main/java/org/apache/ignite/IgniteCache.java modules/core/src/main/java/org/apache/ignite/IgnitePortables.java modules/core/src/main/java/org/apache/ignite/cache/query/CacheQuerySqlField.java modules/core/src/main/java/org/apache/ignite/cache/query/QuerySpiPredicate.java modules/core/src/main/java/org/apache/ignite/cache/query/QueryTypeMetadata.java modules/core/src/main/java/org/apache/ignite/configuration/CacheQueryConfiguration.java modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestValue.java modules/core/src/test/java/org/apache/ignite/loadtests/mapper/TestObject.java modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFieldsQuerySelfTest.java modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryTestValue.java Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/2279f4b7 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/2279f4b7 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/2279f4b7 Branch: refs/heads/ignite-sql-tests Commit: 2279f4b73646b7ea6c442f92030785ae08a69b9c Parents: 684b1a7 46160c9 Author: S.Vladykin <svlady...@gridgain.com> Authored: Thu Feb 5 16:00:12 2015 +0300 Committer: S.Vladykin <svlady...@gridgain.com> Committed: Thu Feb 5 16:00:12 2015 +0300 ---------------------------------------------------------------------- .gitignore | 1 + config/hadoop/default-config.xml | 2 +- .../datastructures/CacheAtomicLongExample.java | 78 - .../CacheAtomicReferenceExample.java | 126 -- .../CacheAtomicSequenceExample.java | 112 -- .../CacheAtomicStampedExample.java | 132 -- .../CacheCountDownLatchExample.java | 112 -- .../datastructures/CacheQueueExample.java | 214 --- .../datastructures/CacheSetExample.java | 193 -- .../datastructures/IgniteAtomicLongExample.java | 74 + .../IgniteAtomicReferenceExample.java | 110 ++ .../IgniteAtomicSequenceExample.java | 96 + .../IgniteAtomicStampedExample.java | 117 ++ .../IgniteCountDownLatchExample.java | 96 + .../datastructures/IgniteQueueExample.java | 206 +++ .../datastructures/IgniteSetExample.java | 186 ++ .../client/memcache/MemcacheRestExample.java | 3 +- .../ignite/examples/CacheExamplesSelfTest.java | 14 +- .../ClientTcpUnreachableMultiNodeSelfTest.java | 12 - .../rest/ClientMemcachedProtocolSelfTest.java | 8 +- .../JettyRestProcessorAbstractSelfTest.java | 21 +- .../rest/RestMemcacheProtocolSelfTest.java | 60 +- .../processors/rest/TestMemcacheClient.java | 11 +- .../src/main/java/org/apache/ignite/Ignite.java | 101 ++ .../org/apache/ignite/IgniteAtomicLong.java | 163 ++ .../apache/ignite/IgniteAtomicReference.java | 99 ++ .../org/apache/ignite/IgniteAtomicSequence.java | 136 ++ .../org/apache/ignite/IgniteAtomicStamped.java | 128 ++ .../java/org/apache/ignite/IgniteCache.java | 10 +- .../org/apache/ignite/IgniteCountDownLatch.java | 232 +++ .../java/org/apache/ignite/IgnitePortables.java | 2 +- .../java/org/apache/ignite/IgniteQueue.java | 185 ++ .../main/java/org/apache/ignite/IgniteSet.java | 107 ++ .../apache/ignite/cache/CacheConfiguration.java | 118 +- .../org/apache/ignite/cache/CacheEntry.java | 1 + .../apache/ignite/cache/CacheEntryEvent.java | 75 - .../org/apache/ignite/cache/CachePeekMode.java | 12 +- .../apache/ignite/cache/CacheProjection.java | 7 + .../ignite/cache/CacheTypeFieldMetadata.java | 145 ++ .../apache/ignite/cache/CacheTypeMetadata.java | 330 ++++ .../java/org/apache/ignite/cache/GridCache.java | 14 - .../apache/ignite/cache/GridCachePeekMode.java | 85 - .../ignite/cache/GridCacheVersionedEntry.java | 3 +- .../cache/datastructures/CacheAtomicLong.java | 157 -- .../datastructures/CacheAtomicReference.java | 93 - .../datastructures/CacheAtomicSequence.java | 130 -- .../datastructures/CacheAtomicStamped.java | 121 -- .../datastructures/CacheCountDownLatch.java | 226 --- .../CacheDataStructureInvalidException.java | 66 - ...cheDataStructureInvalidRuntimeException.java | 66 - .../CacheDataStructureRemovedException.java | 61 - ...cheDataStructureRemovedRuntimeException.java | 61 - .../datastructures/CacheDataStructures.java | 220 --- .../ignite/cache/datastructures/CacheQueue.java | 182 -- .../ignite/cache/datastructures/CacheSet.java | 61 - .../ignite/cache/datastructures/package.html | 24 - .../eviction/fifo/CacheFifoEvictionPolicy.java | 1 + .../random/CacheRandomEvictionPolicy.java | 1 + .../cache/query/CacheContinuousQuery.java | 61 +- .../ignite/cache/query/QueryTypeMetadata.java | 196 --- .../ignite/cache/store/CacheLocalStore.java | 31 - .../apache/ignite/cache/store/CacheStore.java | 2 +- .../cache/store/CacheStoreBalancingWrapper.java | 296 ---- .../ignite/cache/store/jdbc/JdbcCacheStore.java | 1560 ++++++++++++++++ .../cache/store/jdbc/JdbcPojoCacheStore.java | 205 +++ .../store/jdbc/dialect/BasicJdbcDialect.java | 274 +++ .../cache/store/jdbc/dialect/DB2Dialect.java | 68 + .../cache/store/jdbc/dialect/H2Dialect.java | 41 + .../cache/store/jdbc/dialect/JdbcDialect.java | 117 ++ .../cache/store/jdbc/dialect/MySQLDialect.java | 48 + .../cache/store/jdbc/dialect/OracleDialect.java | 72 + .../store/jdbc/dialect/SQLServerDialect.java | 67 + .../cache/store/jdbc/dialect/package.html | 24 + .../apache/ignite/client/GridClientNode.java | 24 - .../ignite/client/GridClientProtocol.java | 4 - .../ignite/client/impl/GridClientNodeImpl.java | 15 - .../configuration/CacheQueryConfiguration.java | 2 - .../IgniteAtomicConfiguration.java | 105 ++ .../IgniteCollectionConfiguration.java | 67 + .../configuration/IgniteConfiguration.java | 18 + .../DataStructureRemovedException.java | 61 + .../apache/ignite/events/IgniteEventType.java | 120 -- .../apache/ignite/internal/GridComponent.java | 19 + .../ignite/internal/GridJobExecuteRequest.java | 95 +- .../ignite/internal/GridKernalContext.java | 8 + .../ignite/internal/GridKernalContextImpl.java | 12 + .../ignite/internal/GridNodeAttributes.java | 4 - .../ignite/internal/GridPluginComponent.java | 9 +- .../apache/ignite/internal/IgniteKernal.java | 144 +- .../org/apache/ignite/internal/IgnitionEx.java | 80 +- .../internal/managers/GridManagerAdapter.java | 7 +- .../managers/GridNoopManagerAdapter.java | 5 + .../discovery/GridDiscoveryManager.java | 68 +- .../processors/GridProcessorAdapter.java | 5 + .../processors/cache/CacheEntryEvent.java | 75 + .../processors/cache/CacheInvokeEntry.java | 12 +- .../cache/CacheStoreBalancingWrapper.java | 297 ++++ .../processors/cache/GridCacheAdapter.java | 238 ++- .../processors/cache/GridCacheAttributes.java | 42 +- .../processors/cache/GridCacheContext.java | 6 +- .../processors/cache/GridCacheEntryEx.java | 14 + .../processors/cache/GridCacheEntryImpl.java | 2 +- .../processors/cache/GridCacheEventManager.java | 4 +- .../cache/GridCacheEvictionEntry.java | 2 +- .../cache/GridCacheFilterEvaluationEntry.java | 2 +- .../processors/cache/GridCacheMapEntry.java | 40 +- .../GridCachePartitionExchangeManager.java | 2 +- .../processors/cache/GridCachePeekMode.java | 85 + .../processors/cache/GridCacheProcessor.java | 31 +- .../cache/GridCacheProjectionImpl.java | 5 + .../processors/cache/GridCacheProxyImpl.java | 25 +- .../processors/cache/GridCacheStoreManager.java | 1 + .../processors/cache/GridCacheSwapManager.java | 48 +- .../processors/cache/GridCacheUtils.java | 17 +- .../processors/cache/IgniteCacheProxy.java | 9 +- .../CacheDataStructuresManager.java | 719 ++++++++ .../GridAtomicCacheQueueImpl.java | 255 --- .../GridCacheAnnotationHelper.java | 240 --- .../datastructures/GridCacheAtomicLongEx.java | 32 - .../datastructures/GridCacheAtomicLongImpl.java | 527 ------ .../GridCacheAtomicLongValue.java | 84 - .../GridCacheAtomicReferenceEx.java | 32 - .../GridCacheAtomicReferenceImpl.java | 319 ---- .../GridCacheAtomicReferenceValue.java | 106 -- .../GridCacheAtomicSequenceEx.java | 32 - .../GridCacheAtomicSequenceImpl.java | 517 ------ .../GridCacheAtomicSequenceValue.java | 84 - .../GridCacheAtomicStampedEx.java | 32 - .../GridCacheAtomicStampedImpl.java | 349 ---- .../GridCacheAtomicStampedValue.java | 135 -- .../GridCacheCountDownLatchEx.java | 39 - .../GridCacheCountDownLatchImpl.java | 359 ---- .../GridCacheCountDownLatchValue.java | 115 -- .../GridCacheDataStructuresImpl.java | 119 -- .../GridCacheDataStructuresManager.java | 1592 ----------------- .../GridCacheDataStructuresProxy.java | 267 --- .../datastructures/GridCacheInternalKey.java | 31 - .../GridCacheInternalKeyImpl.java | 89 - .../datastructures/GridCacheQueueAdapter.java | 1022 ----------- .../datastructures/GridCacheQueueHeader.java | 199 --- .../datastructures/GridCacheQueueHeaderKey.java | 88 - .../datastructures/GridCacheQueueItemKey.java | 121 -- .../datastructures/GridCacheQueueProxy.java | 746 -------- .../datastructures/GridCacheRemovable.java | 37 - .../datastructures/GridCacheSetHeader.java | 85 - .../datastructures/GridCacheSetHeaderKey.java | 88 - .../cache/datastructures/GridCacheSetImpl.java | 575 ------ .../datastructures/GridCacheSetItemKey.java | 109 -- .../cache/datastructures/GridCacheSetProxy.java | 537 ------ .../datastructures/GridSetQueryPredicate.java | 115 -- .../GridTransactionalCacheQueueImpl.java | 240 --- .../GridPartitionedCacheEntryImpl.java | 2 +- .../distributed/dht/GridDhtCacheEntryImpl.java | 2 +- .../dht/atomic/GridDhtAtomicCache.java | 5 +- .../dht/colocated/GridDhtColocatedCache.java | 2 +- .../distributed/near/GridNearCacheAdapter.java | 2 +- .../distributed/near/GridNearTxRemote.java | 2 +- .../local/atomic/GridLocalAtomicCache.java | 2 +- .../query/GridCacheDistributedQueryManager.java | 2 - .../cache/query/GridCacheQueriesProxy.java | 2 +- .../cache/query/GridCacheQueryAdapter.java | 2 +- .../cache/query/GridCacheQueryManager.java | 4 +- .../GridCacheContinuousQueryAdapter.java | 80 - .../GridCacheContinuousQueryManager.java | 19 +- .../processors/cache/store/CacheLocalStore.java | 31 + .../cache/transactions/IgniteTxAdapter.java | 2 +- .../cache/transactions/IgniteTxEntry.java | 2 +- .../transactions/IgniteTxLocalAdapter.java | 2 +- .../cache/transactions/IgniteTxManager.java | 3 +- .../continuous/GridContinuousProcessor.java | 5 + .../dataload/IgniteDataLoaderImpl.java | 27 +- .../CacheDataStructuresConfigurationKey.java | 62 + .../datastructures/DataStructuresProcessor.java | 1662 ++++++++++++++++++ .../GridAtomicCacheQueueImpl.java | 255 +++ .../GridCacheAnnotationHelper.java | 240 +++ .../datastructures/GridCacheAtomicLongEx.java | 32 + .../datastructures/GridCacheAtomicLongImpl.java | 554 ++++++ .../GridCacheAtomicLongValue.java | 84 + .../GridCacheAtomicReferenceEx.java | 32 + .../GridCacheAtomicReferenceImpl.java | 340 ++++ .../GridCacheAtomicReferenceValue.java | 106 ++ .../GridCacheAtomicSequenceEx.java | 32 + .../GridCacheAtomicSequenceImpl.java | 556 ++++++ .../GridCacheAtomicSequenceValue.java | 84 + .../GridCacheAtomicStampedEx.java | 32 + .../GridCacheAtomicStampedImpl.java | 380 ++++ .../GridCacheAtomicStampedValue.java | 135 ++ .../GridCacheCountDownLatchEx.java | 39 + .../GridCacheCountDownLatchImpl.java | 394 +++++ .../GridCacheCountDownLatchValue.java | 115 ++ .../datastructures/GridCacheInternalKey.java | 31 + .../GridCacheInternalKeyImpl.java | 89 + .../datastructures/GridCacheQueueAdapter.java | 1038 +++++++++++ .../datastructures/GridCacheQueueHeader.java | 199 +++ .../datastructures/GridCacheQueueHeaderKey.java | 88 + .../datastructures/GridCacheQueueItemKey.java | 121 ++ .../datastructures/GridCacheQueueProxy.java | 771 ++++++++ .../datastructures/GridCacheRemovable.java | 37 + .../datastructures/GridCacheSetHeader.java | 85 + .../datastructures/GridCacheSetHeaderKey.java | 88 + .../datastructures/GridCacheSetImpl.java | 594 +++++++ .../datastructures/GridCacheSetItemKey.java | 109 ++ .../datastructures/GridCacheSetProxy.java | 563 ++++++ .../datastructures/GridSetQueryPredicate.java | 116 ++ .../GridTransactionalCacheQueueImpl.java | 240 +++ .../processors/fs/GridGgfsAttributes.java | 8 +- .../internal/processors/fs/GridGgfsPaths.java | 8 +- .../plugin/IgnitePluginProcessor.java | 40 + .../processors/rest/GridRestCommand.java | 12 +- .../processors/rest/GridRestProcessor.java | 10 +- .../client/message/GridClientCacheRequest.java | 4 +- .../handlers/cache/GridCacheCommandHandler.java | 107 +- .../DataStructuresCommandHandler.java | 110 ++ .../tcp/GridTcpMemcachedNioListener.java | 64 +- .../rest/request/DataStructuresRequest.java | 74 + .../rest/request/GridRestCacheRequest.java | 37 +- .../internal/util/GridConfigurationFinder.java | 2 +- .../ignite/internal/util/IgniteUtils.java | 37 +- .../internal/util/future/IgniteFutureImpl.java | 9 +- .../apache/ignite/internal/util/typedef/X.java | 19 - .../visor/cache/VisorCacheConfiguration.java | 2 - .../org/apache/ignite/lang/IgniteFuture.java | 18 +- .../segmentation/GridSegmentationPolicy.java | 1 - .../apache/ignite/portables/PortableObject.java | 14 - .../ignite/spi/discovery/DiscoverySpi.java | 4 +- .../spi/discovery/DiscoverySpiDataExchange.java | 4 +- .../discovery/tcp/TcpClientDiscoverySpi.java | 6 +- .../spi/discovery/tcp/TcpDiscoverySpi.java | 31 +- .../TcpDiscoveryJoinRequestMessage.java | 10 +- .../messages/TcpDiscoveryNodeAddedMessage.java | 24 +- .../core/src/test/config/store/jdbc/Ignite.xml | 101 ++ .../store/GridCacheBalancingStoreSelfTest.java | 1 + ...ractJdbcCacheStoreMultithreadedSelfTest.java | 196 +++ .../PojoJdbcCacheStoreMultitreadedSelfTest.java | 34 + .../store/jdbc/PojoJdbcCacheStoreTest.java | 702 ++++++++ .../cache/store/jdbc/model/Organization.java | 155 ++ .../cache/store/jdbc/model/OrganizationKey.java | 97 + .../ignite/cache/store/jdbc/model/Person.java | 155 ++ .../cache/store/jdbc/model/PersonKey.java | 97 + .../ignite/cache/store/jdbc/model/package.html | 24 + .../ignite/internal/GridAffinitySelfTest.java | 2 +- .../cache/GridCacheAbstractFullApiSelfTest.java | 2 +- .../GridCacheConcurrentTxMultiNodeTest.java | 14 +- ...idCacheConfigurationConsistencySelfTest.java | 5 +- .../cache/GridCacheOffHeapSelfTest.java | 2 +- .../GridCacheOffHeapTieredAbstractSelfTest.java | 4 +- .../GridCacheQueryInternalKeysSelfTest.java | 4 +- .../GridCacheReferenceCleanupSelfTest.java | 2 +- .../processors/cache/GridCacheTestEntryEx.java | 6 + .../processors/cache/GridCacheTestValue.java | 1 - .../cache/IgniteCacheAtomicLocalPeekTest.java | 43 + .../cache/IgniteCacheAtomicPeekTest.java | 49 + .../IgniteCacheAtomicReplicatedPeekTest.java | 32 + .../cache/IgniteCachePeekAbstractTest.java | 333 ++++ .../cache/IgniteCacheTxLocalPeekTest.java | 43 + .../processors/cache/IgniteCacheTxPeekTest.java | 49 + .../cache/IgniteCacheTxReplicatedPeekTest.java | 32 + ...eAbstractDataStructuresFailoverSelfTest.java | 424 ++--- ...actQueueFailoverDataConsistencySelfTest.java | 79 +- .../GridCacheAtomicLongApiSelfTest.java | 484 ----- ...CacheAtomicReferenceApiSelfAbstractTest.java | 137 +- ...cheAtomicReferenceMultiNodeAbstractTest.java | 61 +- ...idCacheAtomicStampedApiSelfAbstractTest.java | 57 +- .../GridCacheCountDownLatchSelfTest.java | 410 ----- .../GridCacheMultiNodeDataStructureTest.java | 7 +- .../GridCacheQueueApiSelfAbstractTest.java | 250 +-- .../GridCacheQueueCleanupSelfTest.java | 50 +- ...ridCacheQueueJoinedNodeSelfAbstractTest.java | 34 +- ...GridCacheQueueMultiNodeAbstractSelfTest.java | 188 +- ...dCacheQueueMultiNodeConsistencySelfTest.java | 137 +- ...CacheQueueRotativeMultiNodeAbstractTest.java | 149 +- .../GridCacheSequenceApiSelfAbstractTest.java | 200 ++- ...dCacheSequenceMultiNodeAbstractSelfTest.java | 40 +- .../GridCacheSetAbstractSelfTest.java | 272 ++- .../GridCacheSetFailoverAbstractSelfTest.java | 38 +- .../IgniteAtomicLongApiAbstractSelfTest.java | 267 +++ .../IgniteAtomicsAbstractTest.java | 83 + .../IgniteCollectionAbstractTest.java | 255 +++ .../IgniteCountDownLatchAbstractSelfTest.java | 270 +++ .../IgniteDataStructureUniqueNameTest.java | 356 ++++ .../GridCacheLocalAtomicQueueApiSelfTest.java | 11 +- .../local/GridCacheLocalAtomicSetSelfTest.java | 4 +- .../local/GridCacheLocalQueueApiSelfTest.java | 19 +- .../GridCacheLocalSequenceApiSelfTest.java | 17 +- .../local/GridCacheLocalSetSelfTest.java | 8 +- .../local/IgniteLocalAtomicLongApiSelfTest.java | 33 + .../IgniteLocalCountDownLatchSelfTest.java | 95 + ...dCachePartitionedAtomicQueueApiSelfTest.java | 13 +- ...ionedAtomicQueueCreateMultiNodeSelfTest.java | 10 +- ...micQueueFailoverDataConsistencySelfTest.java | 2 +- ...PartitionedAtomicQueueMultiNodeSelfTest.java | 13 +- ...itionedAtomicQueueRotativeMultiNodeTest.java | 13 +- ...hePartitionedAtomicReferenceApiSelfTest.java | 19 +- ...PartitionedAtomicReferenceMultiNodeTest.java | 19 +- ...titionedAtomicSequenceMultiThreadedTest.java | 102 +- ...chePartitionedAtomicSetFailoverSelfTest.java | 8 +- .../GridCachePartitionedAtomicSetSelfTest.java | 21 +- ...achePartitionedAtomicStampedApiSelfTest.java | 23 +- ...rtitionedDataStructuresFailoverSelfTest.java | 8 +- ...idCachePartitionedNodeRestartTxSelfTest.java | 19 +- .../GridCachePartitionedQueueApiSelfTest.java | 25 +- ...PartitionedQueueCreateMultiNodeSelfTest.java | 50 +- ...dCachePartitionedQueueEntryMoveSelfTest.java | 53 +- ...nedQueueFailoverDataConsistencySelfTest.java | 7 + ...CachePartitionedQueueJoinedNodeSelfTest.java | 25 +- ...dCachePartitionedQueueMultiNodeSelfTest.java | 23 +- ...hePartitionedQueueRotativeMultiNodeTest.java | 24 +- ...GridCachePartitionedSequenceApiSelfTest.java | 24 +- ...chePartitionedSequenceMultiNodeSelfTest.java | 25 +- ...GridCachePartitionedSetFailoverSelfTest.java | 6 +- .../GridCachePartitionedSetSelfTest.java | 8 +- .../IgnitePartitionedAtomicLongApiSelfTest.java | 33 + ...IgnitePartitionedCountDownLatchSelfTest.java | 33 + .../IgnitePartitionedSetNoBackupsSelfTest.java | 68 + ...cheReplicatedAtomicReferenceApiSelfTest.java | 16 +- ...eReplicatedAtomicReferenceMultiNodeTest.java | 16 +- ...CacheReplicatedAtomicStampedApiSelfTest.java | 15 +- ...eplicatedDataStructuresFailoverSelfTest.java | 8 +- .../GridCacheReplicatedQueueApiSelfTest.java | 22 +- ...idCacheReplicatedQueueMultiNodeSelfTest.java | 22 +- ...cheReplicatedQueueRotativeMultiNodeTest.java | 22 +- .../GridCacheReplicatedSequenceApiSelfTest.java | 17 +- ...acheReplicatedSequenceMultiNodeSelfTest.java | 19 +- .../GridCacheReplicatedSetSelfTest.java | 8 +- .../IgniteReplicatedAtomicLongApiSelfTest.java | 33 + .../IgniteReplicatedCountDownLatchSelfTest.java | 33 + .../IgniteCrossCacheTxStoreSelfTest.java | 13 +- .../dht/GridCacheDhtInternalEntrySelfTest.java | 40 +- .../near/GridCacheNearMultiNodeSelfTest.java | 2 +- ...achePartitionedMultiNodeFullApiSelfTest.java | 2 +- .../cache/eviction/GridCacheMockEntry.java | 1 + .../local/GridCacheLocalFullApiSelfTest.java | 5 +- ...ridCacheContinuousQueryAbstractSelfTest.java | 3 +- ...dCacheContinuousQueryReplicatedSelfTest.java | 4 +- .../util/future/IgniteFutureImplTest.java | 3 +- .../cache/GridCacheDataStructuresLoadTest.java | 203 ++- .../GridContinuousOperationsLoadTest.java | 9 +- .../GridCachePartitionedAtomicLongLoadTest.java | 15 +- .../loadtests/dsi/GridDsiLifecycleBean.java | 2 +- .../ignite/loadtests/dsi/GridDsiPerfJob.java | 7 +- .../loadtests/hashmap/GridCacheTestContext.java | 2 +- .../ignite/loadtests/mapper/TestObject.java | 1 - .../marshaller/GridMarshallerAbstractTest.java | 32 - .../GridAbstractDiscoverySelfTest.java | 6 +- .../GridTcpDiscoverySpiStartStopSelfTest.java | 4 +- .../ignite/testframework/junits/IgniteMock.java | 50 + .../junits/spi/GridSpiAbstractTest.java | 6 +- .../IgniteCacheDataStructuresSelfTestSuite.java | 13 +- .../ignite/testsuites/IgniteCacheTestSuite.java | 7 + .../hadoop/jobtracker/GridHadoopJobTracker.java | 41 +- .../processors/query/h2/IgniteH2Indexing.java | 2 +- .../cache/GridCacheOffHeapAndSwapSelfTest.java | 2 +- .../processors/cache/GridCacheSwapSelfTest.java | 2 +- .../http/jetty/GridJettyRestHandler.java | 23 +- .../tests/ScalarAffinityRoutingSpec.scala | 5 +- .../processors/schedule/ScheduleFutureImpl.java | 16 +- modules/schema-load/pom.xml | 107 ++ .../main/java/media/data_connection_48x48.png | Bin 0 -> 4443 bytes .../src/main/java/media/error_48x48.png | Bin 0 -> 4349 bytes .../src/main/java/media/ignite_128x128.png | Bin 0 -> 4917 bytes .../src/main/java/media/ignite_16x16.png | Bin 0 -> 608 bytes .../src/main/java/media/ignite_24x24.png | Bin 0 -> 930 bytes .../src/main/java/media/ignite_32x32.png | Bin 0 -> 1203 bytes .../src/main/java/media/ignite_48x48.png | Bin 0 -> 1868 bytes .../src/main/java/media/ignite_64x64.png | Bin 0 -> 2453 bytes .../src/main/java/media/information_48x48.png | Bin 0 -> 4102 bytes .../src/main/java/media/question_48x48.png | Bin 0 -> 3857 bytes .../src/main/java/media/sign_warning_48x48.png | Bin 0 -> 2988 bytes .../schema-load/src/main/java/media/style.css | 95 + .../src/main/java/media/text_tree_48x48.png | Bin 0 -> 2567 bytes .../ignite/schema/generator/PojoGenerator.java | 415 +++++ .../ignite/schema/generator/XmlGenerator.java | 341 ++++ .../ignite/schema/model/PojoDescriptor.java | 508 ++++++ .../apache/ignite/schema/model/PojoField.java | 421 +++++ .../schema/parser/DatabaseMetadataParser.java | 105 ++ .../apache/ignite/schema/parser/DbColumn.java | 76 + .../apache/ignite/schema/parser/DbTable.java | 105 ++ .../parser/dialect/DB2MetadataDialect.java | 30 + .../parser/dialect/DatabaseMetadataDialect.java | 78 + .../parser/dialect/JdbcMetadataDialect.java | 144 ++ .../parser/dialect/OracleMetadataDialect.java | 257 +++ .../ignite/schema/ui/ConfirmCallable.java | 81 + .../org/apache/ignite/schema/ui/Controls.java | 661 +++++++ .../org/apache/ignite/schema/ui/GridPaneEx.java | 177 ++ .../org/apache/ignite/schema/ui/MessageBox.java | 233 +++ .../apache/ignite/schema/ui/ModalDialog.java | 50 + .../apache/ignite/schema/ui/SchemaLoadApp.java | 1395 +++++++++++++++ .../ignite/schema/ui/TextColumnValidator.java | 32 + .../schema/load/AbstractSchemaLoaderTest.java | 134 ++ .../load/generator/PojoGeneratorTest.java | 70 + .../schema/load/generator/XmlGeneratorTest.java | 50 + .../apache/ignite/schema/load/model/Ignite.xml | 321 ++++ .../apache/ignite/schema/load/model/Objects.txt | 502 ++++++ .../ignite/schema/load/model/ObjectsKey.txt | 96 + .../ignite/schema/load/model/Primitives.txt | 506 ++++++ .../ignite/schema/load/model/PrimitivesKey.txt | 96 + .../load/parser/DbMetadataParserTest.java | 118 ++ .../testsuites/IgniteSchemaLoadTestSuite.java | 41 + .../org/apache/ignite/IgniteSpringBean.java | 65 + .../config/benchmark-multicast.properties | 74 + .../yardstick/config/benchmark-store.properties | 69 + modules/yardstick/config/benchmark.properties | 70 +- .../yardstick/config/ignite-store-config.xml | 203 +++ .../ignite/yardstick/cache/model/SampleKey.java | 88 + .../yardstick/cache/model/SampleValue.java | 9 +- .../jdbc/IgniteJdbcStoreAbstractBenchmark.java | 44 + .../store/jdbc/IgniteJdbcStoreGetBenchmark.java | 53 + .../store/jdbc/IgniteJdbcStorePutBenchmark.java | 42 + .../jdbc/IgniteJdbcStorePutGetBenchmark.java | 47 + pom.xml | 7 +- 410 files changed, 30042 insertions(+), 16510 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2279f4b7/modules/core/src/main/java/org/apache/ignite/IgniteCache.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/IgniteCache.java index 479aaed,bea85dc..e5b2afa --- a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java +++ b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java @@@ -44,8 -45,12 +45,13 @@@ import java.util.concurrent.locks.* * These methods don't specify any keys to load, and leave it to the underlying storage to load cache * data based on the optionally passed in arguments. * </li> + * <li>Various {@code 'query(..)'} methods to allow cache data querying.</li> + * <li> + * Methods like {@code 'tx{Un}Synchronize(..)'} witch allow to get notifications for transaction state changes. + * This feature is very useful when integrating cache transactions with some other in-house transactions. + * </li> * <li>Method {@link #metrics()} to provide metrics for the whole cache.</li> + * <li>Method {@link #getConfiguration(Class)}} to provide cache configuration bean.</li> * </ul> * * @param <K> Cache key type. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2279f4b7/modules/core/src/main/java/org/apache/ignite/IgnitePortables.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2279f4b7/modules/core/src/main/java/org/apache/ignite/cache/CacheConfiguration.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2279f4b7/modules/core/src/main/java/org/apache/ignite/cache/CacheProjection.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2279f4b7/modules/core/src/main/java/org/apache/ignite/cache/query/CacheContinuousQuery.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2279f4b7/modules/core/src/main/java/org/apache/ignite/configuration/CacheQueryConfiguration.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/configuration/CacheQueryConfiguration.java index e6e4f81,0000000..1822856 mode 100644,000000..100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheQueryConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheQueryConfiguration.java @@@ -1,226 -1,0 +1,224 @@@ +/* + * 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.configuration; + +import org.apache.ignite.cache.query.*; + +import java.io.*; - import java.util.*; + +/** + * Configuration for embedded indexing facilities. + */ +public class CacheQueryConfiguration implements Serializable { + /** */ + private static final long serialVersionUID = 0L; + + /** Collection of query type metadata. */ + private Collection<QueryTypeMetadata> typeMeta; + + /** Query type resolver. */ + private QueryTypeResolver typeRslvr; + + /** */ + private boolean idxPrimitiveKey; + + /** */ + private boolean idxPrimitiveVal; + + /** */ + private boolean idxFixedTyping; + + /** */ + private boolean escapeAll; + + /** */ + private int pageSize = 1000; + + /** + * Default constructor. + */ + public CacheQueryConfiguration() { + // No-op. + } + + /** + * @param cfg Configuration to copy. + */ + public CacheQueryConfiguration(CacheQueryConfiguration cfg) { - typeMeta = cfg.getTypeMetadata(); + typeRslvr = cfg.getTypeResolver(); + idxPrimitiveKey = cfg.isIndexPrimitiveKey(); + idxPrimitiveVal = cfg.isIndexPrimitiveValue(); + idxFixedTyping = cfg.isIndexFixedTyping(); + escapeAll = cfg.isEscapeAll(); + } + + /** + * Gets collection of query type metadata objects. + * + * @return Collection of query type metadata. + */ + public Collection<QueryTypeMetadata> getTypeMetadata() { + return typeMeta; + } + + /** + * Sets collection of query type metadata objects. + * + * @param typeMeta Collection of query type metadata. + */ + public void setTypeMetadata(Collection<QueryTypeMetadata> typeMeta) { + this.typeMeta = typeMeta; + } + + /** + * Gets query type resolver. + * + * @return Query type resolver. + */ + public QueryTypeResolver getTypeResolver() { + return typeRslvr; + } + + /** + * Sets query type resolver. + * + * @param typeRslvr Query type resolver. + */ + public void setTypeResolver(QueryTypeResolver typeRslvr) { + this.typeRslvr = typeRslvr; + } + + /** + * Gets flag indicating whether SQL engine should index by key in cases + * where key is primitive type + * + * @return {@code True} if primitive keys should be indexed. + */ + public boolean isIndexPrimitiveKey() { + return idxPrimitiveKey; + } + + /** + * Sets flag indicating whether SQL engine should index by key in cases + * where key is primitive type. + * + * @param idxPrimitiveKey {@code True} if primitive keys should be indexed. + */ + public void setIndexPrimitiveKey(boolean idxPrimitiveKey) { + this.idxPrimitiveKey = idxPrimitiveKey; + } + + /** + * Gets flag indicating whether SQL engine should index by value in cases + * where value is primitive type + * + * @return {@code True} if primitive values should be indexed. + */ + public boolean isIndexPrimitiveValue() { + return idxPrimitiveVal; + } + + /** + * Sets flag indexing whether SQL engine should index by value in cases + * where value is primitive type. + * + * @param idxPrimitiveVal {@code True} if primitive values should be indexed. + */ + public void setIndexPrimitiveValue(boolean idxPrimitiveVal) { + this.idxPrimitiveVal = idxPrimitiveVal; + } + + /** + * This flag essentially controls whether all values of the same type have + * identical key type. + * <p> + * If {@code false}, SQL engine will store all keys in BINARY form to make it possible to store + * the same value type with different key types. If {@code true}, key type will be converted + * to respective SQL type if it is possible, hence, improving performance of queries. + * <p> + * Setting this value to {@code false} also means that {@code '_key'} column cannot be indexed and + * cannot participate in query where clauses. The behavior of using '_key' column in where + * clauses with this flag set to {@code false} is undefined. + * + * @return {@code True} if SQL engine should try to convert values to their respective SQL + * types for better performance. + */ + public boolean isIndexFixedTyping() { + return idxFixedTyping; + } + + /** + * This flag essentially controls whether key type is going to be identical + * for all values of the same type. + * <p> + * If false, SQL engine will store all keys in BINARY form to make it possible to store + * the same value type with different key types. If true, key type will be converted + * to respective SQL type if it is possible, which may provide significant performance + * boost. + * + * @param idxFixedTyping {@code True} if SQL engine should try to convert values to their respective SQL + * types for better performance. + */ + public void setIndexFixedTyping(boolean idxFixedTyping) { + this.idxFixedTyping = idxFixedTyping; + } + + /** + * If {@code true}, then table name and all column names in 'create table' SQL + * generated for SQL engine are escaped with double quotes. This flag should be set if table name of + * column name is H2 reserved word or is not valid H2 identifier (e.g. contains space or hyphen). + * <p> + * Note if this flag is set then table and column name in SQL queries also must be escaped with double quotes. + + * @return Flag value. + */ + public boolean isEscapeAll() { + return escapeAll; + } + + /** + * If {@code true}, then table name and all column names in 'create table' SQL + * generated for SQL engine are escaped with double quotes. This flag should be set if table name of + * column name is H2 reserved word or is not valid H2 identifier (e.g. contains space or hyphen). + * <p> + * Note if this flag is set then table and column name in SQL queries also must be escaped with double quotes. + + * @param escapeAll Flag value. + */ + public void setEscapeAll(boolean escapeAll) { + this.escapeAll = escapeAll; + } + + /** + * Gets default query result page size. + * + * @return Page size. + */ + public int getPageSize() { + return pageSize; + } + + /** + * Sets default query result page size. + * + * @param pageSize Page size. + */ + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2279f4b7/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2279f4b7/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2279f4b7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProjectionImpl.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2279f4b7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2279f4b7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheDistributedQueryManager.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2279f4b7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueriesProxy.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2279f4b7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2279f4b7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2279f4b7/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java index 0000000,f5470e9..085ab03 mode 000000,100644..100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java @@@ -1,0 -1,595 +1,594 @@@ + /* + * 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.datastructures; + + import org.apache.ignite.*; + import org.apache.ignite.cache.*; + import org.apache.ignite.cache.affinity.*; -import org.apache.ignite.cache.query.*; + import org.apache.ignite.cluster.*; + import org.apache.ignite.datastructures.*; + import org.apache.ignite.internal.processors.cache.*; + import org.apache.ignite.internal.processors.cache.query.*; + import org.apache.ignite.internal.util.*; + import org.apache.ignite.internal.util.lang.*; + import org.apache.ignite.internal.util.typedef.*; + import org.apache.ignite.internal.util.typedef.internal.*; + import org.apache.ignite.lang.*; + import org.jetbrains.annotations.*; + + import java.io.*; + import java.util.*; + import java.util.concurrent.*; + + import static org.apache.ignite.internal.processors.cache.query.GridCacheQueryType.*; + + /** + * Cache set implementation. + */ + public class GridCacheSetImpl<T> extends AbstractCollection<T> implements IgniteSet<T> { + /** */ + private static final int BATCH_SIZE = 100; + + /** Cache context. */ + private final GridCacheContext ctx; + + /** Cache. */ + private final GridCache<GridCacheSetItemKey, Boolean> cache; + + /** Logger. */ + private final IgniteLogger log; + + /** Set name. */ + private final String name; + + /** Set unique ID. */ + private final IgniteUuid id; + + /** Collocation flag. */ + private final boolean collocated; + + /** Queue header partition. */ + private final int hdrPart; + + /** Removed flag. */ + private volatile boolean rmvd; + + /** + * @param ctx Cache context. + * @param name Set name. + * @param hdr Set header. + */ + @SuppressWarnings("unchecked") + public GridCacheSetImpl(GridCacheContext ctx, String name, GridCacheSetHeader hdr) { + this.ctx = ctx; + this.name = name; + id = hdr.id(); + collocated = hdr.collocated(); + + cache = ctx.cache(); + + log = ctx.logger(GridCacheSetImpl.class); + + hdrPart = ctx.affinity().partition(new GridCacheSetHeaderKey(name)); + } + + /** {@inheritDoc} */ + @Override public boolean collocated() { + return collocated; + } + + /** {@inheritDoc} */ + @Override public String name() { + return name; + } + + /** {@inheritDoc} */ + @Override public boolean removed() { + return rmvd; + } + + /** {@inheritDoc} */ + @SuppressWarnings("unchecked") + @Override public int size() { + try { + onAccess(); + + if (ctx.isLocal() || ctx.isReplicated()) { + GridConcurrentHashSet<GridCacheSetItemKey> set = ctx.dataStructures().setData(id); + + return set != null ? set.size() : 0; + } + + CacheQuery qry = new GridCacheQueryAdapter<>(ctx, SET, null, null, null, + new GridSetQueryPredicate<>(id, collocated), false, false); + + Collection<ClusterNode> nodes = dataNodes(ctx.affinity().affinityTopologyVersion()); + + qry.projection(ctx.grid().forNodes(nodes)); + + Iterable<Integer> col = (Iterable<Integer>)qry.execute(new SumReducer()).get(); + + int sum = 0; + + for (Integer val : col) + sum += val; + + return sum; + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } + } + + /** {@inheritDoc} */ + @SuppressWarnings("unchecked") + @Override public boolean isEmpty() { + onAccess(); + + GridConcurrentHashSet<GridCacheSetItemKey> set = ctx.dataStructures().setData(id); + + return (set == null || set.isEmpty()) && size() == 0; + } + + /** {@inheritDoc} */ + @Override public boolean contains(Object o) { + onAccess(); + + final GridCacheSetItemKey key = itemKey(o); + + return retry(new Callable<Boolean>() { + @Override public Boolean call() throws Exception { + return cache.get(key) != null; + } + }); + } + + /** {@inheritDoc} */ + @Override public boolean add(T o) { + onAccess(); + + final GridCacheSetItemKey key = itemKey(o); + + return retry(new Callable<Boolean>() { + @Override public Boolean call() throws Exception { + return cache.putxIfAbsent(key, true); + } + }); + } + + /** {@inheritDoc} */ + @Override public boolean remove(Object o) { + onAccess(); + + final GridCacheSetItemKey key = itemKey(o); + + return retry(new Callable<Boolean>() { + @Override public Boolean call() throws Exception { + return cache.removex(key); + } + }); + } + + /** {@inheritDoc} */ + @Override public boolean containsAll(Collection<?> c) { + for (Object obj : c) { + if (!contains(obj)) + return false; + } + + return true; + } + + /** {@inheritDoc} */ + @Override public boolean addAll(Collection<? extends T> c) { + onAccess(); + + boolean add = false; + + Map<GridCacheSetItemKey, Boolean> addKeys = null; + + for (T obj : c) { + if (add) { + if (addKeys == null) + addKeys = U.newHashMap(BATCH_SIZE); + + addKeys.put(itemKey(obj), true); + + if (addKeys.size() == BATCH_SIZE) { + retryPutAll(addKeys); + + addKeys.clear(); + } + } + else + add |= add(obj); + } + + if (!F.isEmpty(addKeys)) + retryPutAll(addKeys); + + return add; + } + + /** {@inheritDoc} */ + @Override public boolean removeAll(Collection<?> c) { + onAccess(); + + boolean rmv = false; + + Set<GridCacheSetItemKey> rmvKeys = null; + + for (Object obj : c) { + if (rmv) { + if (rmvKeys == null) + rmvKeys = U.newHashSet(BATCH_SIZE); + + rmvKeys.add(itemKey(obj)); + + if (rmvKeys.size() == BATCH_SIZE) { + retryRemoveAll(rmvKeys); + + rmvKeys.clear(); + } + } + else + rmv |= remove(obj); + } + + if (!F.isEmpty(rmvKeys)) + retryRemoveAll(rmvKeys); + + return rmv; + } + + /** {@inheritDoc} */ + @Override public boolean retainAll(Collection<?> c) { + try { + onAccess(); + + try (GridCloseableIterator<T> iter = iterator0()) { + boolean rmv = false; + + Set<GridCacheSetItemKey> rmvKeys = null; + + for (T val : iter) { + if (!c.contains(val)) { + rmv = true; + + if (rmvKeys == null) + rmvKeys = U.newHashSet(BATCH_SIZE); + + rmvKeys.add(itemKey(val)); + + if (rmvKeys.size() == BATCH_SIZE) { + retryRemoveAll(rmvKeys); + + rmvKeys.clear(); + } + } + } + + if (!F.isEmpty(rmvKeys)) + retryRemoveAll(rmvKeys); + + return rmv; + } + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } + } + + /** {@inheritDoc} */ + @Override public void clear() { + try { + onAccess(); + + try (GridCloseableIterator<T> iter = iterator0()) { + Collection<GridCacheSetItemKey> rmvKeys = new ArrayList<>(BATCH_SIZE); + + for (T val : iter) { + rmvKeys.add(itemKey(val)); + + if (rmvKeys.size() == BATCH_SIZE) { + retryRemoveAll(rmvKeys); + + rmvKeys.clear(); + } + } + + if (!rmvKeys.isEmpty()) + retryRemoveAll(rmvKeys); + } + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } + } + + /** {@inheritDoc} */ + @Override public Iterator<T> iterator() { + onAccess(); + + return iterator0(); + } + + /** {@inheritDoc} */ + @Override public void close() { + try { + if (rmvd) + return; + + ctx.kernalContext().dataStructures().removeSet(name, ctx); + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } + } + + /** {@inheritDoc} */ + @SuppressWarnings("unchecked") + private GridCloseableIterator<T> iterator0() { + try { + CacheQuery qry = new GridCacheQueryAdapter<>(ctx, SET, null, null, null, + new GridSetQueryPredicate<>(id, collocated), false, false); + + Collection<ClusterNode> nodes = dataNodes(ctx.affinity().affinityTopologyVersion()); + + qry.projection(ctx.grid().forNodes(nodes)); + + CacheQueryFuture<Map.Entry<T, ?>> fut = qry.execute(); + + CacheWeakQueryIteratorsHolder.WeakQueryFutureIterator it = + ctx.itHolder().iterator(fut, new CacheIteratorConverter<T, Map.Entry<T, ?>>() { + @Override protected T convert(Map.Entry<T, ?> e) { + return e.getKey(); + } + + @Override protected void remove(T item) { + GridCacheSetImpl.this.remove(item); + } + }); + + if (rmvd) { + ctx.itHolder().removeIterator(it); + + checkRemoved(); + } + + return it; + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } + } + + /** + * @param call Callable. + * @return Callable result. + */ + private <R> R retry(Callable<R> call) { + try { + return DataStructuresProcessor.retry(log, call); + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } + } + + /** + * @param keys Keys to remove. + */ + private void retryRemoveAll(final Collection<GridCacheSetItemKey> keys) { + retry(new Callable<Void>() { + @Override public Void call() throws Exception { + cache.removeAll(keys); + + return null; + } + }); + } + + /** + * @param keys Keys to remove. + */ + private void retryPutAll(final Map<GridCacheSetItemKey, Boolean> keys) { + retry(new Callable<Void>() { + @Override public Void call() throws Exception { + cache.putAll(keys); + + return null; + } + }); + } + + /** + * @param topVer Topology version. + * @return Nodes where set data request should be sent. + * @throws IgniteCheckedException If all cache nodes left grid. + */ + @SuppressWarnings("unchecked") + private Collection<ClusterNode> dataNodes(long topVer) throws IgniteCheckedException { + if (ctx.isLocal() || ctx.isReplicated()) + return Collections.singleton(ctx.localNode()); + + Collection<ClusterNode> nodes; + + if (collocated) { + List<ClusterNode> nodes0 = ctx.affinity().nodes(hdrPart, topVer); + + nodes = !nodes0.isEmpty() ? + Collections.singleton(nodes0.contains(ctx.localNode()) ? ctx.localNode() : F.first(nodes0)) : nodes0; + } + else + nodes = CU.affinityNodes(ctx, topVer); + + if (nodes.isEmpty()) + throw new IgniteCheckedException("Failed to get set data, all cache nodes left grid."); + + return nodes; + } + + /** + * @param rmvd Removed flag. + */ + void removed(boolean rmvd) { + if (this.rmvd) + return; + + this.rmvd = rmvd; + + if (rmvd) + ctx.itHolder().clearQueries(); + } + + /** + * Throws {@link DataStructureRemovedException} if set was removed. + */ + private void checkRemoved() { + if (rmvd) + throw new DataStructureRemovedException("Set has been removed from cache: " + this); + } + + /** + * Checks if set was removed and handles iterators weak reference queue. + */ + private void onAccess() { + ctx.itHolder().checkWeakQueue(); + + checkRemoved(); + } + + /** + * @return Set ID. + */ + IgniteUuid id() { + return id; + } + + /** + * @return Cache context. + */ + GridCacheContext context() { + return ctx; + } + + /** + * @param item Set item. + * @return Item key. + */ + private GridCacheSetItemKey itemKey(Object item) { + return collocated ? new CollocatedItemKey(name, id, item) : new GridCacheSetItemKey(id, item); + } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(GridCacheSetImpl.class, this); + } + + /** + * + */ + private static class SumReducer implements IgniteReducer<Object, Integer>, Externalizable { + /** */ + private static final long serialVersionUID = -3436987759126521204L; + + /** */ + private int cntr; + + /** + * Required by {@link Externalizable}. + */ + public SumReducer() { + // No-op. + } + + /** {@inheritDoc} */ + @Override public boolean collect(@Nullable Object o) { + cntr++; + + return true; + } + + /** {@inheritDoc} */ + @Override public Integer reduce() { + return cntr; + } + + /** {@inheritDoc} */ + @Override public void writeExternal(ObjectOutput out) throws IOException { + // No-op. + } + + /** {@inheritDoc} */ + @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { + // No-op. + } + } + + /** + * Item key for collocated set. + */ + private static class CollocatedItemKey extends GridCacheSetItemKey { + /** */ + private static final long serialVersionUID = -1400701398705953750L; + + /** */ + private String setName; + + /** + * Required by {@link Externalizable}. + */ + public CollocatedItemKey() { + // No-op. + } + + /** + * @param setName Set name. + * @param setId Set unique ID. + * @param item Set item. + */ + private CollocatedItemKey(String setName, IgniteUuid setId, Object item) { + super(setId, item); + + this.setName = setName; + } + + /** + * @return Item affinity key. + */ + @CacheAffinityKeyMapped + public Object affinityKey() { + return setName; + } + + /** {@inheritDoc} */ + @Override public void writeExternal(ObjectOutput out) throws IOException { + super.writeExternal(out); + + U.writeString(out, setName); + } + + /** {@inheritDoc} */ + @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { + super.readExternal(in); + + setName = U.readString(in); + } + } + } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2279f4b7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java ---------------------------------------------------------------------- diff --cc modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java index ff9c600,0a35047..05243b9 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java @@@ -20,9 -20,8 +20,8 @@@ package org.apache.ignite.internal.proc import org.apache.ignite.*; import org.apache.ignite.cache.*; import org.apache.ignite.cache.affinity.*; - import org.apache.ignite.cache.datastructures.*; import org.apache.ignite.cache.eviction.lru.*; -import org.apache.ignite.cache.query.*; +import org.apache.ignite.cache.query.annotations.*; import org.apache.ignite.cluster.*; import org.apache.ignite.compute.*; import org.apache.ignite.configuration.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2279f4b7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapSelfTest.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2279f4b7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestValue.java ---------------------------------------------------------------------- diff --cc modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestValue.java index 9ce96c9,4aecbd1..2b59efe --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestValue.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestValue.java @@@ -17,8 -17,7 +17,7 @@@ package org.apache.ignite.internal.processors.cache; --import org.apache.ignite.cache.query.*; +import org.apache.ignite.cache.query.annotations.*; import org.apache.ignite.internal.util.typedef.internal.*; import java.io.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2279f4b7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2279f4b7/modules/core/src/test/java/org/apache/ignite/loadtests/mapper/TestObject.java ---------------------------------------------------------------------- diff --cc modules/core/src/test/java/org/apache/ignite/loadtests/mapper/TestObject.java index c2f0fd8,d30f296..16ace09 --- a/modules/core/src/test/java/org/apache/ignite/loadtests/mapper/TestObject.java +++ b/modules/core/src/test/java/org/apache/ignite/loadtests/mapper/TestObject.java @@@ -17,8 -17,7 +17,7 @@@ package org.apache.ignite.loadtests.mapper; --import org.apache.ignite.cache.query.*; +import org.apache.ignite.cache.query.annotations.*; import java.io.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2279f4b7/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2279f4b7/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2279f4b7/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapSelfTest.java ----------------------------------------------------------------------