You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by an...@apache.org on 2016/08/11 03:33:13 UTC

[01/19] ignite git commit: version changed to: 1.6.4

Repository: ignite
Updated Branches:
  refs/heads/master e5ae9fcad -> 4ee2353f7


version changed to: 1.6.4


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d945a5dd
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d945a5dd
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d945a5dd

Branch: refs/heads/master
Commit: d945a5dd89b01f05a59e2b02fb86c1007736aff9
Parents: a90d05b
Author: Ignite Teamcity <ig...@apache.org>
Authored: Thu Aug 4 18:37:37 2016 +0300
Committer: Ignite Teamcity <ig...@apache.org>
Committed: Thu Aug 4 18:37:37 2016 +0300

----------------------------------------------------------------------
 RELEASE_NOTES.txt                               | 312 +++++++++++++++----
 examples/pom-standalone-lgpl.xml                |   7 +
 examples/pom-standalone.xml                     |   7 +
 examples/pom.xml                                |   2 +-
 examples/schema-import/pom-standalone.xml       |   7 +
 examples/schema-import/pom.xml                  |   2 +-
 modules/aop/pom.xml                             |   2 +-
 modules/apache-license-gen/pom.xml              |   2 +-
 modules/aws/pom.xml                             |   2 +-
 modules/benchmarks/pom.xml                      |   2 +-
 modules/camel/pom.xml                           |   2 +-
 modules/cassandra/pom.xml                       |   2 +-
 modules/clients/pom.xml                         |   2 +-
 modules/cloud/pom.xml                           |   2 +-
 modules/codegen/pom.xml                         |   2 +-
 modules/core/pom.xml                            |   4 +-
 modules/extdata/p2p/pom.xml                     |   2 +-
 .../extdata/uri/modules/uri-dependency/pom.xml  |   2 +-
 modules/extdata/uri/pom.xml                     |   2 +-
 modules/flink/pom.xml                           |   2 +-
 modules/flume/pom.xml                           |   2 +-
 modules/gce/pom.xml                             |   2 +-
 modules/geospatial/pom.xml                      |   2 +-
 modules/hadoop/pom.xml                          |   2 +-
 modules/hibernate/pom.xml                       |   2 +-
 modules/indexing/pom.xml                        |   2 +-
 modules/jcl/pom.xml                             |   2 +-
 modules/jms11/pom.xml                           |   2 +-
 modules/jta/pom.xml                             |   2 +-
 modules/kafka/pom.xml                           |   2 +-
 modules/log4j/pom.xml                           |   2 +-
 modules/log4j2/pom.xml                          |   2 +-
 modules/mesos/pom.xml                           |   2 +-
 modules/mqtt/pom.xml                            |   2 +-
 modules/osgi-karaf/pom.xml                      |   2 +-
 modules/osgi-paxlogging/pom.xml                 |   2 +-
 modules/osgi/pom.xml                            |   2 +-
 modules/rest-http/pom.xml                       |   2 +-
 modules/scalar-2.10/pom.xml                     |   2 +-
 modules/scalar/pom.xml                          |   2 +-
 modules/schedule/pom.xml                        |   2 +-
 modules/schema-import-db/pom.xml                |   2 +-
 modules/schema-import/pom.xml                   |   2 +-
 modules/slf4j/pom.xml                           |   2 +-
 modules/spark-2.10/pom.xml                      |   2 +-
 modules/spark/pom.xml                           |   2 +-
 modules/spring/pom.xml                          |   2 +-
 modules/ssh/pom.xml                             |   2 +-
 modules/storm/pom.xml                           |   2 +-
 modules/tools/pom.xml                           |   2 +-
 modules/twitter/pom.xml                         |   2 +-
 modules/urideploy/pom.xml                       |   2 +-
 modules/visor-console-2.10/pom.xml              |   2 +-
 modules/visor-console/pom.xml                   |   2 +-
 modules/visor-plugins/pom.xml                   |   2 +-
 modules/web-agent/pom.xml                       |   2 +-
 modules/web-console/pom.xml                     |   2 +-
 modules/web/ignite-appserver-test/pom.xml       |   2 +-
 modules/web/ignite-websphere-test/pom.xml       |   2 +-
 modules/web/pom.xml                             |   2 +-
 modules/yardstick/pom.xml                       |   2 +-
 modules/yarn/pom.xml                            |   2 +-
 modules/zookeeper/pom.xml                       |   2 +-
 pom.xml                                         |   4 +-
 64 files changed, 328 insertions(+), 129 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index cef51bd..67b18ad 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -1,8 +1,23 @@
-Apache Ignite Release Notes
-===========================
+GridGain In-Memory Data Fabric Professional Edition Release Notes
+=======================================
 
-Apache Ignite In-Memory Data Fabric 1.6
----------------------------------------
+GridGain In-Memory Data Fabric Professional Edition 1.6.4
+------------------------------------
+* Fixed a bug in GridCacheTtlManager.
+* Added basic implementation of address resolver.
+
+GridGain In-Memory Data Fabric Professional Edition 1.6.3
+------------------------------------
+* .NET: Fixed a bug in IBinaryObjectBuilder causing type name to be lost.
+
+GridGain In-Memory Data Fabric Professional Edition 1.6.2
+------------------------------------
+* Fixed CountDownLatch recreation.
+* CPP: Fixed string deserialization performance issue.
+* .NET: Added NuGet distribution.
+
+GridGain In-Memory Data Fabric Professional Edition 1.6.1
+------------------------------------
 Ignite .NET:
 * Added LINQ Provider for cache SQL queries
 * Added native configuration mechanism (C#, app.config, web.config - instead of Spring XML)
@@ -20,77 +35,218 @@ Ignite C++:
 * Simplified Autotools build process for C++ client.
 
 Ignite:
-* Added ability to get partition 'updateCntr' with continuous query public API.
-* Added asynchronous execution of ContinuousQuery's remote filter and local listener.
-* Added backup partitions storing to local store default behavior.
-* Added cache deadlock detection.
 * Added Cache Store implementation backed by Cassandra DB.
-* Added method to get versioned cache entry.
 * Added ODBC driver for Ignite.
-* Added support for join timeout while registering local addresses with IP finder in TcpDiscoverySpi.
-* Added support for JTA transactions via synchronization callback.
 * Added Web Console for Ignite.
+* ODBC: Added decimal type support.
+
+Changes in GridGain In-Memory Data Fabric Professional Edition 1.5.30
+------------------------------------
+* Ignite Cache: new API that lets calculating size per particular partition.
+* Visor CMD: Added skip confirm in batch mode. Improved kill command.
+* Hadoop: Implemented new weight-based map-reduce planner (IgniteHadoopWeightedMapReducePlanner).
+* .NET: Added ability to implement custom affintiy functions.
+* Added support of EXPIRED events to continuous queries.
+* Data Streamer: ability to set timeout for a number of methods.
+* Fixed NPE in Ignite Services internals that happened when a service was executed before system cache was started.
+* Fixed NPE in OptimizedMarshaller when pool of streams is used.
+* Fixed the issue when it wasn't possible to deserialize an object on Java side if the object was placed in the cache on C++ or .Net side.
+* Fixed SQL indexes processing under Java 8.
+
+GridGain In-Memory Data Fabric Professional Edition 1.5.29
+------------------------------------
+* Binary objects: performance improvements.
+* IGFS: Performance and usability improvements.
+* Fixed issue with unnecessary discovery messages resend that may cause slow discovery message delivery.
+* Fixed possible IO message loss during reconnect.
+* Additional system properties for troubleshooting logging.
+* Fixed issue when job ID was generated in a non unique way.
+
+GridGain In-Memory Data Fabric Professional Edition 1.5.28
+------------------------------------
+* IGFS: Usability improvements.
+* Fixed performance degradation when a cache is preloaded from many IgniteDataStreamers in parallel from the same node.
+* Fixed issue with service redeployment after topology change.
+
+GridGain In-Memory Data Fabric Professional Edition 1.5.27
+------------------------------------
+* IGFS: Fixed a problem with native libraries loading.
+* REST HTTP: Updated from json-lib 2.4 to Jackson 2.7.5.
+* External addresses are now registered in IP finder.
+* Client node's addresses are now not registered in IP finder.
+
+GridGain In-Memory Data Fabric Professional Edition 1.5.26
+------------------------------------
+* IGFS: Performance improvements.
+* Spark: added IgniteRDD.withKeepBinary() method for full support of binary objects.
+* Added Cassandra-based persistent store implementation.
+* Continuous queries: warning will be printed on client nodes instead of exception trace if the remote filter is not in classpath.
+* Fixed missing IgniteCountdownLatch updates that can lead to a deadlock or wrong behavior.
+* Fixed local store conflict resolving with keepBinary flag set to false.
+* Fixed addresses duplication at IP finder.
+* ZookeeperIpFinder now properly handles reconnects.
+
+GridGain In-Memory Data Fabric Professional Edition 1.5.25
+------------------------------------
+* IGFS: Performance improvements for client mode.
+* Hadoop: fixed inefficient memory usage during mapper output processing.
+* Fixed marshalling of arrays of primitives types when their are being placed into a cache.
+* Spark: added transformer closure to savePairs(..) and saveValues(..) methods of IgniteRDD.
+* Spark: fixed support for java.sql.Date in queries executed from IgniteRDD.
+
+GridGain In-Memory Data Fabric Professional Edition 1.5.24
+------------------------------------
+* IGFS: Added user name mapper to properly deal with security in complex Hadoop environments.
+* Validating that the same IgniteConfiguration instance is not used more than once.
+* Fixed marshalling of Void type with Binary marshaller.
+* Fixed metrics calculation for OFFHEAP_TIRED mode.
+* ScanQuery and localEntries now honor keepBinary flag.
+* Zookeeper module dependencies set fixed.
+
+GridGain In-Memory Data Fabric Professional Edition 1.5.23
+------------------------------------
+* IGFS: Improved error logging for operations in DUAL mode.
+* Added Ignition.getOrStart method.
+* Spark: support BigDecimal for queries executed from IgniteRDD.
+* Mesos integration: added possibility to configure http server timeout.
+* Fixed a bug with Ignite API usage during node stop.
+* Fixed a bug with 'keepBinary' handling for CacheInterceptor.
+* Fixed a bug with CacheEntryEvent cleanup for filtered events.
+* Fixed a bug with broken synchronization between cache entry expiration and update.
+
+GridGain In-Memory Data Fabric Professional Edition 1.5.22
+------------------------------------
+* Fixed UTF-16 surrogate pairs marshalling.
+* Fixed local store behavior at cross cache transactions.
+* Fixed memory leak in IgniteH2Indexing.
+* Added backup partitions storing to local store default behavior.
+* ScanQueries over local partitions performance optimisation.
+* Visor CMD: Added ability to attach custom scripts to alerts.
+* WebSession: fixed a bug causing invalidated session to be returned from HttpServletRequest.getSession() call.
+* Hadoop: fixed a bug causing exception during job resource unpacking.
+
+GridGain In-Memory Data Fabric Professional Edition 1.5.21
+------------------------------------
+* Web sessions: minor fix to prevent NullPointerException in some special case.
+
+GridGain In-Memory Data Fabric Professional Edition 1.5.20
+------------------------------------
+* Web sessions: user session classes are no longer needed on server nodes.
+
+GridGain In-Memory Data Fabric Professional Edition 1.5.19
+------------------------------------
+* Added cache deadlock detection.
 * Fixed a bug causing object deserialization when local store is configured for cache.
 * Fixed a problem with incorrect classloader picked in OSGI environment.
+* Hadoop: fixed a bug causing exception during MR planning when input split file doesn't exist.
+
+GridGain In-Memory Data Fabric Professional Edition 1.5.18
+------------------------------------
+* Fixed potential thread starvation during cache rebalancing.
+* Fixed deadlock in services deployment when Spring is used.
+* Mesos integration: added possibility to load Ignite package from file system.
+
+GridGain In-Memory Data Fabric Professional Edition 1.5.17
+------------------------------------
+* Performance optimization for transactions that do not acquire locks.
+* Optimized memory usage on server nodes to allow more client connections.
+* Added support for join timeout while registering local addresses with IP finder in TcpDiscoverySpi.
+
+GridGain In-Memory Data Fabric Professional Edition 1.5.16
+------------------------------------
+* Added asynchronous execution of ContinuousQuery's remote filter and local listener.
+
+GridGain In-Memory Data Fabric Professional Edition 1.5.15
+------------------------------------
+* Fixed discovery and node start procedure issues that may cause slowdowns during larger topologies start (>100 nodes).
+
+GridGain In-Memory Data Fabric Professional Edition 1.5.14
+------------------------------------
 * Fixed a race condition when evicted offheap data was not delivered to query engine leading to query timeout.
-* Fixed an issue in ContinuousQueries that caused missing of notifications.
+
+GridGain In-Memory Data Fabric Professional Edition 1.5.12
+------------------------------------
+* Improved marshaller behavior during cluster topology change.
+* .NET: Added ability to use Java-based remote filters in continuous queries.
+
+GridGain In-Memory Data Fabric Professional Edition 1.5.11
+------------------------------------
+* Fixed cluster stability with 500+ clients.
 * Fixed background cache partition map exchange not to flood network.
-* Fixed BinaryContext to honor custom loader set through IgniteConfiguration.
 * Fixed BinaryObjectOffHeapImpl leak to public code.
-* Fixed cluster stability with 500+ clients.
-* Fixed continuous queries to send filter factory instead of filter.
-* Fixed continuous query deployment in case originating node has left.
-* Fixed issues with continuous query.
-* Fixed deadlock in services deployment when Spring is used.
-* Fixed discovery and node start procedure issues that may cause slowdowns during larger topologies start (>100 nodes).
-* Fixed eviction policy notification if swap or off heap is enabled and an entry is not loaded during preloading.
-* Fixed excessive thread stack usage in case of high contention on cache entries.
-* Fixed execution of Splunk MapReduce jobs on top of Ignite MR.
-* Fixed GridClosureProcessor internal closures to be deserialized by BinaryMarshaller.
+* Fixed BinaryContext to honor custom loader set through IgniteConfiguration.
+* Fixed continuous query not to call listener with empty set of events.
+* IGFS: Massive performance and stability fixes.
+* Many stability and fault-tolerance fixes.
+
+GridGain In-Memory Data Fabric Professional Edition 1.5.10
+------------------------------------
+* Fixed continuous query listener notification handling.
+
+GridGain In-Memory Data Fabric Community Edition 1.5.9
+---------------------------------------
 * Fixed issue with AWS dependencies.
-* Fixed java proxies deserialization with optimized marshaller.
-* Fixed local store behavior at cross cache transactions.
-* Fixed marshalling of Java collection and maps for BinaryMarshaller.
-* Fixed memory leak in IgniteH2Indexing.
+* Fixed excessive thread stack usage in case of high contention on cache entries.
+* Fixed continuous queries to send filter factory instead of filter.
 * Fixed NPE during rebalancing.
-* Fixed NPE in GridMergeIndex.
-* Fixed OOME when OFFHEAP_TIERED mode is used.
-* Fixed potential thread starvation during cache rebalancing.
-* Fixed race condition on load cache on changing topology.
-* Fixed race in marshalling logic that could arise when several nodes are running on the same host.
-* Fixed redeployment issues happened with ScanQueries filters.
+* Fixed system caches not to use user-defined TransactionConfiguration.
+* Fixed GridClosureProcessor internal closures to be deserialized by BinaryMarshaller.
+* Fixed web session clustering with WebLogic.
+* Fixed value copying in entry processor with OptimizedMarshaller.
+* Fixed continuous query listener notification during concurrent key put.
 * Fixed service proxy not to make remote call for methods declared in java.lang.Object.
-* Fixed several ClassNotFoundException in OSGi environment.
+* Added support for JTA transactions via synchronization callback.
+
+GridGain In-Memory Data Fabric Community Edition 1.5.8
+---------------------------------------
+* Fixed java proxies deserialization with optimized marshaller.
+* Fixed excessive thread stack usage in case of high contention on cache entries.
 * Fixed SKIP_STORE flag behavior for transaction entry.
-* Fixed support for classes with equal simple name for binary marshaller.
-* Fixed system caches not to use user-defined TransactionConfiguration.
-* Fixed the issue when CacheStore was updated even if EntryProcessor didn't update an entry.
 * Fixed thread safety for TcpDiscoveryMulticastIpFinder.
-* Fixed unintentional deserialization of BinaryObjects in OFFHEAP mode with peer class loading enabled.
-* Fixed UTF-16 surrogate pairs marshalling.
-* Fixed value copying in entry processor with OptimizedMarshaller.
-* Fixed web session clustering with WebLogic.
-* Hadoop: fixed a bug causing exception during MR planning when input split file doesn't exist.
-* IGFS: Added configuration flag to disable default path modes under "/ignite" folder.
-* IGFS: Added pluggable factory interface for Hadoop FileSystem creation.
 * IGFS: Fixed file properties when running over secondary file system.
 * IGFS: Fixed issues with Kerberized HDFS.
-* IGFS: Massive performance and stability fixes.
-* Improved marshaller behavior during cluster topology change.
-* Mesos integration: added possibility to load Ignite package from file system.
-* Optimized cache 'get' operations on affinity node.
-* Optimized memory usage on server nodes to allow more client connections.
-* Passed update notifier flag to discovery data to be sure that all cluster nodes have the same notifier status as the first node.
-* Performance optimization for transactions that do not acquire locks.
-* ScanQueries over local partitions performance optimisation.
+
+GridGain In-Memory Data Fabric Community Edition 1.5.7
+---------------------------------------
+* Added method to get versioned cache entry.
+* Added ability to get partition 'updateCntr' with continuous query public API.
+* Fixed several ClassNotFoundException in OSGi environment.
+* Fixed continuous query notification with single node topology.
+* Fixed continuous query notification with cache listeners.
+* Fixed continuous query deployment in case originating node has left.
+* Fixed NPE in GridMergeIndex.
+* Fixed race condition on load cache on changing topology.
+* Fixed OOME when OFFHEAP_TIERED mode is used.
+* Fixed support for classes with equal simple name for binary marshaller.
+
+GridGain In-Memory Data Fabric Community Edition 1.5.6
+---------------------------------------
 * Support of package-private implementations for Ignite Services.
+* Fixed unintentional deserialization of BinaryObjects in OFFHEAP mode with peer class loading enabled.
+
+GridGain In-Memory Data Fabric Community Edition 1.5.5
+---------------------------------------
+* Fixed the issue when CacheStore was updated even if EntryProcessor didn't update an entry.
+* Fixed execution of Splunk MapReduce jobs on top of Ignite MR.
+
+GridGain In-Memory Data Fabric Community Edition 1.5.4
+---------------------------------------
+* Passed update notifier flag to discovery data to be sure that all cluster nodes have the same notifier status as the first node.
+* Optimized cache 'get' operations on affinity node.
 * Supported Ignite Compute tasks cancellation for Ignite.NET.
-* Visor CMD: Added ability to attach custom scripts to alerts.
-* Web sessions: minor fix to prevent NullPointerException in some special case.
-* Web sessions: user session classes are no longer needed on server nodes.
-* A lot of stability and fault-tolerance fixes.
+* Fixed race in marshalling logic that could arise when several nodes are running on the same host.
+* Fixed marshalling of Java collection and maps for BinaryMarshaller.
+* Fixed eviction policy notification if swap or off heap is enabled and an entry is not loaded during preloading.
+* Fixed redeployment issues happened with ScanQueries filters.
+* Fixed an issue in ContinuousQueries that caused missing of notifications.
 
-Apache Ignite In-Memory Data Fabric 1.5
+GridGain In-Memory Data Fabric Community Edition 1.5.3
+---------------------------------------
+* IGFS: Added pluggable factory interface for Hadoop FileSystem creation.
+* IGFS: Added configuration flag to disable default path modes under "/ignite" folder.
+* IGFS: Various stability fixes.
+
+GridGain In-Memory Data Fabric Community Edition 1.5.1
 ---------------------------------------
 * Ignite.NET: Initial Release.
 * Ignite C++: Initial Release.
@@ -113,14 +269,12 @@ Apache Ignite In-Memory Data Fabric 1.5
 
 Complete list of closed issues: https://issues.apache.org/jira/issues/?jql=project%20%3D%20IGNITE%20AND%20fixVersion%20%3D%201.5%20AND%20status%20%3D%20closed
 
-Apache Ignite In-Memory Data Fabric 1.4
+GridGain In-Memory Data Fabric Community Edition 1.4.1
 ---------------------------------------
 * Added SSL support to communication and discovery.
 * Added support for log4j2.
 * Added versioned entry to cache API.
 * Added client node based JDBC driver implementation.
-* Fixed consistency issue for custom events processing within discovery.
-* Fixed race in cache swap/unswap logic.
 * Fixed IGNITE_HOME resolution with JBoss.
 * Fixed configuration file resolution on classpath.
 * Fixed MBean registration for caches.
@@ -131,21 +285,39 @@ Apache Ignite In-Memory Data Fabric 1.4
 * Fixed affinity routing in compute grid.
 * Many stability and fault-tolerance fixes.
 
-Apache Ignite In-Memory Data Fabric 1.3
+GridGain In-Memory Data Fabric Community Edition 1.3.3
+---------------------------------------
+
+* Added SSL support to communication and discovery.
+* Fixed IGNITE_HOME resolution with JBoss.
+* Fixed configuration file resolution on classpath.
+* Fixed MBean registration for caches.
+* Many stability and fault-tolerance fixes.
+
+GridGain In-Memory Data Fabric Community Edition 1.3.1
 ---------------------------------------
 
 * Added auto-retries for cache operations in recoverable cases.
 * Added integration with Apache YARN.
-* Added auto detection and dropping of slow client nodes.
 * Fixed several issues with JTA integration.
 * Fixed several issues with Hibernate L2 cache.
-* Fixed issue with GAR files in source release.
 * Stability fixes for TCP discovery SPI.
 * Stability fixes for onheap and offheap SQL queries.
 * Bug fixes in In-Memory Accelerator For Apache Hadoop.
 * Many stability and fault-tolerance fixes.
 
-Apache Ignite In-Memory Data Fabric 1.2
+GridGain In-Memory Data Fabric Community Edition 1.1.4
+---------------------------------------
+
+* Added dropping of slow clients.
+* Fixed several connectivity issues.
+
+GridGain In-Memory Data Fabric Community Edition 1.1.3
+---------------------------------------
+
+* Fixed cache store configuration validation.
+
+GridGain In-Memory Data Fabric Community Edition 1.1.2
 ---------------------------------------
 
 * Added client mode to TCP discovery SPI.
@@ -157,7 +329,13 @@ Apache Ignite In-Memory Data Fabric 1.2
 * Bug fixes in In-Memory Accelerator For Apache Hadoop.
 * Many stability and fault-tolerance fixes.
 
-Apache Ignite In-Memory Data Fabric 1.1
+GridGain In-Memory Data Fabric Community Edition 1.0.5
+---------------------------------------
+
+* Fixed unnecessary value sending for near cache with near lock response
+* Optimized getOrCreateCache methods for case when cache is already started locally
+
+GridGain In-Memory Data Fabric Community Edition 1.0.4
 ---------------------------------------
 
 * Added Google Compute Engine TCP discovery IP finder.
@@ -177,7 +355,7 @@ Apache Ignite In-Memory Data Fabric 1.1
 * Made deployment scanners for URI-based deployment pluggable.
 * Many stability and fault-tolerance fixes.
 
-Apache Ignite In-Memory Data Fabric 1.0
+GridGain In-Memory Data Fabric Community Edition 1.0
 ---------------------------------------
 
 * Simplified query API.
@@ -193,7 +371,7 @@ Apache Ignite In-Memory Data Fabric 1.0
 * Added ability to automatically exclude LGPL optional dependencies during build.
 
 
-Apache Ignite In-Memory Data Fabric 1.0 RC3
+GridGain In-Memory Data Fabric Community Edition 1.0 RC3
 -------------------------------------------
 
 This is the first release of Apache Ignite project. The source code in large part is based

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/examples/pom-standalone-lgpl.xml
----------------------------------------------------------------------
diff --git a/examples/pom-standalone-lgpl.xml b/examples/pom-standalone-lgpl.xml
index 7e7ccc2..73bbc69 100644
--- a/examples/pom-standalone-lgpl.xml
+++ b/examples/pom-standalone-lgpl.xml
@@ -26,6 +26,13 @@
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
 
+    <repositories>
+        <repository>
+            <id>GridGain External Repository</id>
+            <url>http://www.gridgainsystems.com/nexus/content/repositories/external</url>
+        </repository>
+    </repositories>
+
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/examples/pom-standalone.xml
----------------------------------------------------------------------
diff --git a/examples/pom-standalone.xml b/examples/pom-standalone.xml
index 6247ced..b01d67a 100644
--- a/examples/pom-standalone.xml
+++ b/examples/pom-standalone.xml
@@ -26,6 +26,13 @@
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
 
+    <repositories>
+        <repository>
+            <id>GridGain External Repository</id>
+            <url>http://www.gridgainsystems.com/nexus/content/repositories/external</url>
+        </repository>
+    </repositories>
+
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/examples/pom.xml
----------------------------------------------------------------------
diff --git a/examples/pom.xml b/examples/pom.xml
index 979a46f..203e1d3 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -28,7 +28,7 @@
     </parent>
 
     <artifactId>ignite-examples</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/examples/schema-import/pom-standalone.xml
----------------------------------------------------------------------
diff --git a/examples/schema-import/pom-standalone.xml b/examples/schema-import/pom-standalone.xml
index e443728..95c8a9d 100644
--- a/examples/schema-import/pom-standalone.xml
+++ b/examples/schema-import/pom-standalone.xml
@@ -26,6 +26,13 @@
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
 
+    <repositories>
+        <repository>
+            <id>GridGain External Repository</id>
+            <url>http://www.gridgainsystems.com/nexus/content/repositories/external</url>
+        </repository>
+    </repositories>
+
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     </properties>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/examples/schema-import/pom.xml
----------------------------------------------------------------------
diff --git a/examples/schema-import/pom.xml b/examples/schema-import/pom.xml
index b6e36ef..6c5a957 100644
--- a/examples/schema-import/pom.xml
+++ b/examples/schema-import/pom.xml
@@ -35,7 +35,7 @@
     </properties>
 
     <artifactId>ignite-schema-import-demo</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/aop/pom.xml
----------------------------------------------------------------------
diff --git a/modules/aop/pom.xml b/modules/aop/pom.xml
index eaebaf2..a3b2727 100644
--- a/modules/aop/pom.xml
+++ b/modules/aop/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-aop</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/apache-license-gen/pom.xml
----------------------------------------------------------------------
diff --git a/modules/apache-license-gen/pom.xml b/modules/apache-license-gen/pom.xml
index 53b1a8f..cdf15fb 100644
--- a/modules/apache-license-gen/pom.xml
+++ b/modules/apache-license-gen/pom.xml
@@ -31,7 +31,7 @@
 
     <groupId>org.apache.ignite</groupId>
     <artifactId>ignite-apache-license-gen</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <build>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/aws/pom.xml
----------------------------------------------------------------------
diff --git a/modules/aws/pom.xml b/modules/aws/pom.xml
index 2aee655..04e9585 100644
--- a/modules/aws/pom.xml
+++ b/modules/aws/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-aws</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/benchmarks/pom.xml
----------------------------------------------------------------------
diff --git a/modules/benchmarks/pom.xml b/modules/benchmarks/pom.xml
index 00315a8..28c2ed1 100644
--- a/modules/benchmarks/pom.xml
+++ b/modules/benchmarks/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-benchmarks</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <properties>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/camel/pom.xml
----------------------------------------------------------------------
diff --git a/modules/camel/pom.xml b/modules/camel/pom.xml
index f40ff62..52ba091 100644
--- a/modules/camel/pom.xml
+++ b/modules/camel/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-camel</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <properties>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/cassandra/pom.xml
----------------------------------------------------------------------
diff --git a/modules/cassandra/pom.xml b/modules/cassandra/pom.xml
index dc8b08c..77a4414 100644
--- a/modules/cassandra/pom.xml
+++ b/modules/cassandra/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-cassandra</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <properties>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/clients/pom.xml
----------------------------------------------------------------------
diff --git a/modules/clients/pom.xml b/modules/clients/pom.xml
index fa25d18..bb53662 100644
--- a/modules/clients/pom.xml
+++ b/modules/clients/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-clients</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/cloud/pom.xml
----------------------------------------------------------------------
diff --git a/modules/cloud/pom.xml b/modules/cloud/pom.xml
index 8232d00..6ebc61c 100644
--- a/modules/cloud/pom.xml
+++ b/modules/cloud/pom.xml
@@ -29,7 +29,7 @@
     </parent>
 
     <artifactId>ignite-cloud</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <properties>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/codegen/pom.xml
----------------------------------------------------------------------
diff --git a/modules/codegen/pom.xml b/modules/codegen/pom.xml
index aff0d3a..ef21c6b 100644
--- a/modules/codegen/pom.xml
+++ b/modules/codegen/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-codegen</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <properties>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/core/pom.xml
----------------------------------------------------------------------
diff --git a/modules/core/pom.xml b/modules/core/pom.xml
index 5e32caf..d287967 100644
--- a/modules/core/pom.xml
+++ b/modules/core/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-core</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <repositories>
@@ -42,7 +42,7 @@
     </repositories>
 
     <properties>
-        <ignite.update.notifier.product>apache-ignite</ignite.update.notifier.product>
+        <ignite.update.notifier.product>gridgain-community</ignite.update.notifier.product>
 
         <!-- Imports:
                 - com.sun.jmx.mbeanserver => only used from TCKMBeanServerBuilder which has no usages within Ignite's

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/extdata/p2p/pom.xml
----------------------------------------------------------------------
diff --git a/modules/extdata/p2p/pom.xml b/modules/extdata/p2p/pom.xml
index 9bebf74..820c0b6 100644
--- a/modules/extdata/p2p/pom.xml
+++ b/modules/extdata/p2p/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-extdata-p2p</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/extdata/uri/modules/uri-dependency/pom.xml
----------------------------------------------------------------------
diff --git a/modules/extdata/uri/modules/uri-dependency/pom.xml b/modules/extdata/uri/modules/uri-dependency/pom.xml
index 1d9da24..344178f 100644
--- a/modules/extdata/uri/modules/uri-dependency/pom.xml
+++ b/modules/extdata/uri/modules/uri-dependency/pom.xml
@@ -27,7 +27,7 @@
     <artifactId>ignite-extdata-uri-dep</artifactId>
     <packaging>jar</packaging>
 
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <modelVersion>4.0.0</modelVersion>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/extdata/uri/pom.xml
----------------------------------------------------------------------
diff --git a/modules/extdata/uri/pom.xml b/modules/extdata/uri/pom.xml
index 1cef7f9..f5b524c 100644
--- a/modules/extdata/uri/pom.xml
+++ b/modules/extdata/uri/pom.xml
@@ -32,7 +32,7 @@
     </parent>
 
     <artifactId>ignite-extdata-uri</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/flink/pom.xml
----------------------------------------------------------------------
diff --git a/modules/flink/pom.xml b/modules/flink/pom.xml
index 118c175..6c52d9e 100644
--- a/modules/flink/pom.xml
+++ b/modules/flink/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-flink</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <properties>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/flume/pom.xml
----------------------------------------------------------------------
diff --git a/modules/flume/pom.xml b/modules/flume/pom.xml
index f9d36e9..6fead3f 100644
--- a/modules/flume/pom.xml
+++ b/modules/flume/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-flume</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/gce/pom.xml
----------------------------------------------------------------------
diff --git a/modules/gce/pom.xml b/modules/gce/pom.xml
index 8c7bed4..8338425 100644
--- a/modules/gce/pom.xml
+++ b/modules/gce/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-gce</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/geospatial/pom.xml
----------------------------------------------------------------------
diff --git a/modules/geospatial/pom.xml b/modules/geospatial/pom.xml
index eeef657..b0076e2 100644
--- a/modules/geospatial/pom.xml
+++ b/modules/geospatial/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-geospatial</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/hadoop/pom.xml
----------------------------------------------------------------------
diff --git a/modules/hadoop/pom.xml b/modules/hadoop/pom.xml
index a3f40e5..c5168c6 100644
--- a/modules/hadoop/pom.xml
+++ b/modules/hadoop/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-hadoop</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/hibernate/pom.xml
----------------------------------------------------------------------
diff --git a/modules/hibernate/pom.xml b/modules/hibernate/pom.xml
index b0ea68d..6c687ab 100644
--- a/modules/hibernate/pom.xml
+++ b/modules/hibernate/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-hibernate</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/indexing/pom.xml
----------------------------------------------------------------------
diff --git a/modules/indexing/pom.xml b/modules/indexing/pom.xml
index d667531..d533dfa 100644
--- a/modules/indexing/pom.xml
+++ b/modules/indexing/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-indexing</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/jcl/pom.xml
----------------------------------------------------------------------
diff --git a/modules/jcl/pom.xml b/modules/jcl/pom.xml
index fbc9441..293a34d 100644
--- a/modules/jcl/pom.xml
+++ b/modules/jcl/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-jcl</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/jms11/pom.xml
----------------------------------------------------------------------
diff --git a/modules/jms11/pom.xml b/modules/jms11/pom.xml
index a4222a0..dafbbdf 100644
--- a/modules/jms11/pom.xml
+++ b/modules/jms11/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-jms11</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/jta/pom.xml
----------------------------------------------------------------------
diff --git a/modules/jta/pom.xml b/modules/jta/pom.xml
index 64ad26d..ed6a06e 100644
--- a/modules/jta/pom.xml
+++ b/modules/jta/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-jta</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/kafka/pom.xml
----------------------------------------------------------------------
diff --git a/modules/kafka/pom.xml b/modules/kafka/pom.xml
index 07d031e..bd585c9 100644
--- a/modules/kafka/pom.xml
+++ b/modules/kafka/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-kafka</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/log4j/pom.xml
----------------------------------------------------------------------
diff --git a/modules/log4j/pom.xml b/modules/log4j/pom.xml
index f74e59b..b70a578 100644
--- a/modules/log4j/pom.xml
+++ b/modules/log4j/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-log4j</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/log4j2/pom.xml
----------------------------------------------------------------------
diff --git a/modules/log4j2/pom.xml b/modules/log4j2/pom.xml
index ac99196..2485aa3 100644
--- a/modules/log4j2/pom.xml
+++ b/modules/log4j2/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-log4j2</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/mesos/pom.xml
----------------------------------------------------------------------
diff --git a/modules/mesos/pom.xml b/modules/mesos/pom.xml
index 660b046..514a2b0 100644
--- a/modules/mesos/pom.xml
+++ b/modules/mesos/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-mesos</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <properties>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/mqtt/pom.xml
----------------------------------------------------------------------
diff --git a/modules/mqtt/pom.xml b/modules/mqtt/pom.xml
index ae984eb..391d7fe 100644
--- a/modules/mqtt/pom.xml
+++ b/modules/mqtt/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-mqtt</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/osgi-karaf/pom.xml
----------------------------------------------------------------------
diff --git a/modules/osgi-karaf/pom.xml b/modules/osgi-karaf/pom.xml
index f4e0113..dbc1fb3 100644
--- a/modules/osgi-karaf/pom.xml
+++ b/modules/osgi-karaf/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-osgi-karaf</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <packaging>pom</packaging>
 
     <build>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/osgi-paxlogging/pom.xml
----------------------------------------------------------------------
diff --git a/modules/osgi-paxlogging/pom.xml b/modules/osgi-paxlogging/pom.xml
index 779c9a9..9b3a3ff 100644
--- a/modules/osgi-paxlogging/pom.xml
+++ b/modules/osgi-paxlogging/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-osgi-paxlogging</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <packaging>jar</packaging>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/osgi/pom.xml
----------------------------------------------------------------------
diff --git a/modules/osgi/pom.xml b/modules/osgi/pom.xml
index 041fbd1..f9bf6f4 100644
--- a/modules/osgi/pom.xml
+++ b/modules/osgi/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-osgi</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/rest-http/pom.xml
----------------------------------------------------------------------
diff --git a/modules/rest-http/pom.xml b/modules/rest-http/pom.xml
index 860c64d..72ff61c 100644
--- a/modules/rest-http/pom.xml
+++ b/modules/rest-http/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-rest-http</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <properties>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/scalar-2.10/pom.xml
----------------------------------------------------------------------
diff --git a/modules/scalar-2.10/pom.xml b/modules/scalar-2.10/pom.xml
index 06f43b9..2328302 100644
--- a/modules/scalar-2.10/pom.xml
+++ b/modules/scalar-2.10/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-scalar_2.10</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/scalar/pom.xml
----------------------------------------------------------------------
diff --git a/modules/scalar/pom.xml b/modules/scalar/pom.xml
index e42c710..d4c37cc 100644
--- a/modules/scalar/pom.xml
+++ b/modules/scalar/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-scalar</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/schedule/pom.xml
----------------------------------------------------------------------
diff --git a/modules/schedule/pom.xml b/modules/schedule/pom.xml
index e06f051..09cf3c5 100644
--- a/modules/schedule/pom.xml
+++ b/modules/schedule/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-schedule</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <properties>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/schema-import-db/pom.xml
----------------------------------------------------------------------
diff --git a/modules/schema-import-db/pom.xml b/modules/schema-import-db/pom.xml
index b34281b..910ad85 100644
--- a/modules/schema-import-db/pom.xml
+++ b/modules/schema-import-db/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-schema-import-db</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/schema-import/pom.xml
----------------------------------------------------------------------
diff --git a/modules/schema-import/pom.xml b/modules/schema-import/pom.xml
index 271e513..b0ab2eb 100644
--- a/modules/schema-import/pom.xml
+++ b/modules/schema-import/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-schema-import</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/slf4j/pom.xml
----------------------------------------------------------------------
diff --git a/modules/slf4j/pom.xml b/modules/slf4j/pom.xml
index 85195b0..bbc0b70 100644
--- a/modules/slf4j/pom.xml
+++ b/modules/slf4j/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-slf4j</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/spark-2.10/pom.xml
----------------------------------------------------------------------
diff --git a/modules/spark-2.10/pom.xml b/modules/spark-2.10/pom.xml
index c02599b..b970e3d 100644
--- a/modules/spark-2.10/pom.xml
+++ b/modules/spark-2.10/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-spark_2.10</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/spark/pom.xml
----------------------------------------------------------------------
diff --git a/modules/spark/pom.xml b/modules/spark/pom.xml
index 4bde34f..6b631d3 100644
--- a/modules/spark/pom.xml
+++ b/modules/spark/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-spark</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/spring/pom.xml
----------------------------------------------------------------------
diff --git a/modules/spring/pom.xml b/modules/spring/pom.xml
index 397b209..bb96d4c 100644
--- a/modules/spring/pom.xml
+++ b/modules/spring/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-spring</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/ssh/pom.xml
----------------------------------------------------------------------
diff --git a/modules/ssh/pom.xml b/modules/ssh/pom.xml
index aec0948..7e41bbc 100644
--- a/modules/ssh/pom.xml
+++ b/modules/ssh/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-ssh</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/storm/pom.xml
----------------------------------------------------------------------
diff --git a/modules/storm/pom.xml b/modules/storm/pom.xml
index 712f910..eb96c60 100644
--- a/modules/storm/pom.xml
+++ b/modules/storm/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-storm</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <properties>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/tools/pom.xml
----------------------------------------------------------------------
diff --git a/modules/tools/pom.xml b/modules/tools/pom.xml
index 4f65542..cd6f2a7 100644
--- a/modules/tools/pom.xml
+++ b/modules/tools/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-tools</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <properties>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/twitter/pom.xml
----------------------------------------------------------------------
diff --git a/modules/twitter/pom.xml b/modules/twitter/pom.xml
index 8f0d917..9c86d9b 100644
--- a/modules/twitter/pom.xml
+++ b/modules/twitter/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-twitter</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/urideploy/pom.xml
----------------------------------------------------------------------
diff --git a/modules/urideploy/pom.xml b/modules/urideploy/pom.xml
index a621017..a57315a 100644
--- a/modules/urideploy/pom.xml
+++ b/modules/urideploy/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-urideploy</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/visor-console-2.10/pom.xml
----------------------------------------------------------------------
diff --git a/modules/visor-console-2.10/pom.xml b/modules/visor-console-2.10/pom.xml
index a1d2987..a86567e 100644
--- a/modules/visor-console-2.10/pom.xml
+++ b/modules/visor-console-2.10/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-visor-console_2.10</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/visor-console/pom.xml
----------------------------------------------------------------------
diff --git a/modules/visor-console/pom.xml b/modules/visor-console/pom.xml
index 3dd9bd8..7c6e71b 100644
--- a/modules/visor-console/pom.xml
+++ b/modules/visor-console/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-visor-console</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/visor-plugins/pom.xml
----------------------------------------------------------------------
diff --git a/modules/visor-plugins/pom.xml b/modules/visor-plugins/pom.xml
index d095650..7e0b127 100644
--- a/modules/visor-plugins/pom.xml
+++ b/modules/visor-plugins/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-visor-plugins</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/web-agent/pom.xml
----------------------------------------------------------------------
diff --git a/modules/web-agent/pom.xml b/modules/web-agent/pom.xml
index d87084f..8170160 100644
--- a/modules/web-agent/pom.xml
+++ b/modules/web-agent/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-web-agent</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
 
     <properties>
         <maven.build.timestamp.format>yyMMddHHmmss</maven.build.timestamp.format>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/web-console/pom.xml
----------------------------------------------------------------------
diff --git a/modules/web-console/pom.xml b/modules/web-console/pom.xml
index 5c5cac0..382da80 100644
--- a/modules/web-console/pom.xml
+++ b/modules/web-console/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-web-console</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
 
     <build>
         <plugins>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/web/ignite-appserver-test/pom.xml
----------------------------------------------------------------------
diff --git a/modules/web/ignite-appserver-test/pom.xml b/modules/web/ignite-appserver-test/pom.xml
index 045bbfa..fb9fbe2 100644
--- a/modules/web/ignite-appserver-test/pom.xml
+++ b/modules/web/ignite-appserver-test/pom.xml
@@ -30,7 +30,7 @@
 
     <artifactId>ignite-appserver-test</artifactId>
     <packaging>jar</packaging>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/web/ignite-websphere-test/pom.xml
----------------------------------------------------------------------
diff --git a/modules/web/ignite-websphere-test/pom.xml b/modules/web/ignite-websphere-test/pom.xml
index 9127560..b2e665c 100644
--- a/modules/web/ignite-websphere-test/pom.xml
+++ b/modules/web/ignite-websphere-test/pom.xml
@@ -30,7 +30,7 @@
 
     <artifactId>ignite-websphere-test</artifactId>
     <packaging>war</packaging>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/web/pom.xml
----------------------------------------------------------------------
diff --git a/modules/web/pom.xml b/modules/web/pom.xml
index 710c803..cf02a42 100644
--- a/modules/web/pom.xml
+++ b/modules/web/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-web</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/yardstick/pom.xml
----------------------------------------------------------------------
diff --git a/modules/yardstick/pom.xml b/modules/yardstick/pom.xml
index 51d714e..58529a4 100644
--- a/modules/yardstick/pom.xml
+++ b/modules/yardstick/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-yardstick</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <properties>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/yarn/pom.xml
----------------------------------------------------------------------
diff --git a/modules/yarn/pom.xml b/modules/yarn/pom.xml
index 884176a..0a4e694 100644
--- a/modules/yarn/pom.xml
+++ b/modules/yarn/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-yarn</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <properties>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/modules/zookeeper/pom.xml
----------------------------------------------------------------------
diff --git a/modules/zookeeper/pom.xml b/modules/zookeeper/pom.xml
index 41c381b..57fcb5b 100644
--- a/modules/zookeeper/pom.xml
+++ b/modules/zookeeper/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-zookeeper</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/d945a5dd/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 2c7bad1..8f8e041 100644
--- a/pom.xml
+++ b/pom.xml
@@ -32,12 +32,12 @@
 
     <groupId>org.apache.ignite</groupId>
     <artifactId>apache-ignite</artifactId>
-    <version>1.7.0-SNAPSHOT</version>
+    <version>1.6.4</version>
     <packaging>pom</packaging>
 
     <properties>
         <!--fix <attachartifact>...< /> at apache-release profile if changed-->
-        <ignite.zip.pattern>${project.artifactId}-${ignite.edition}-${project.version}-bin</ignite.zip.pattern>
+        <ignite.zip.pattern>gridgain-professional-${ignite.edition}-${project.version}</ignite.zip.pattern>
     </properties>
 
     <scm>


[09/19] ignite git commit: IGNITE-3659: Added special test suite to handle ignored tests.

Posted by an...@apache.org.
IGNITE-3659: Added special test suite to handle ignored tests.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b9d9d84f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b9d9d84f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b9d9d84f

Branch: refs/heads/master
Commit: b9d9d84f4fcaf7f025b480769b612fc63b5082f4
Parents: 00f47d7
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Aug 9 14:04:47 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Aug 9 14:04:47 2016 +0300

----------------------------------------------------------------------
 .../ignite/testframework/IgniteTestSuite.java   | 191 +++++++++++++++++++
 .../apache/ignite/testsuites/IgniteIgnore.java  |  35 ++++
 .../testsuites/IgniteIgnoredTestSuite.java      |  63 ++++++
 3 files changed, 289 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/b9d9d84f/modules/core/src/test/java/org/apache/ignite/testframework/IgniteTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/IgniteTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testframework/IgniteTestSuite.java
new file mode 100644
index 0000000..2828065
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/IgniteTestSuite.java
@@ -0,0 +1,191 @@
+/*
+ * 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.testframework;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.apache.ignite.testsuites.IgniteIgnore;
+import org.jetbrains.annotations.Nullable;
+import org.junit.internal.MethodSorter;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Base class for run junit tests.
+ * Test methods marked with @Ignored annotation won't be executed.
+ */
+public class IgniteTestSuite extends TestSuite {
+    /** Whether to execute only ignored tests. */
+    private final boolean ignoredOnly;
+
+    /**
+     * Constructor.
+     *
+     * @param name Name.
+     */
+    public IgniteTestSuite(String name) {
+        this(null, name);
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param theClass TestCase class
+     */
+    public IgniteTestSuite(Class<? extends TestCase> theClass) {
+        this(theClass, false);
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param theClass TestCase class
+     * @param ignoredOnly Whether to execute only ignored tests.
+     */
+    public IgniteTestSuite(Class<? extends TestCase> theClass, boolean ignoredOnly) {
+        this(theClass, null, ignoredOnly);
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param theClass TestCase class
+     * @param name Test suite name.
+     */
+    public IgniteTestSuite(Class<? extends TestCase> theClass, String name) {
+        this(theClass, name, false);
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param theClass TestCase class
+     * @param name Test suite name.
+     * @param ignoredOnly Whether to execute only ignored tests.
+     */
+    public IgniteTestSuite(@Nullable Class<? extends TestCase> theClass, @Nullable String name, boolean ignoredOnly) {
+        this.ignoredOnly = ignoredOnly;
+
+        if (theClass != null)
+            addTestsFromTestCase(theClass);
+
+        if (name != null)
+            setName(name);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void addTestSuite(Class<? extends TestCase> testClass) {
+        addTestSuite(testClass, false);
+    }
+
+    /**
+     * Add test class to the suite.
+     *
+     * @param testClass Test class.
+     * @param ignoredOnly Ignore only flag.
+     */
+    public void addTestSuite(Class<? extends TestCase> testClass, boolean ignoredOnly) {
+        addTest(new IgniteTestSuite(testClass, ignoredOnly));
+    }
+
+    /**
+     *
+     * @param theClass TestCase class
+     */
+    private void addTestsFromTestCase(Class<?> theClass) {
+        setName(theClass.getName());
+
+        try {
+            getTestConstructor(theClass);
+        }
+        catch (NoSuchMethodException ex) {
+            addTest(warning("Class " + theClass.getName() +
+                " has no public constructor TestCase(String name) or TestCase()"));
+
+            return;
+        }
+
+        if(!Modifier.isPublic(theClass.getModifiers()))
+            addTest(warning("Class " + theClass.getName() + " is not public"));
+        else {
+            Class superCls = theClass;
+
+            int testAdded = 0;
+
+            for(List<String> names = new ArrayList<>(); Test.class.isAssignableFrom(superCls);
+                superCls = superCls.getSuperclass()) {
+                Method[] methods = MethodSorter.getDeclaredMethods(superCls);
+
+                for (Method each : methods) {
+                    if (addTestMethod(each, names, theClass))
+                        testAdded++;
+                }
+            }
+
+            if(testAdded == 0)
+                addTest(warning("No tests found in " + theClass.getName()));
+        }
+    }
+
+    /**
+     * @param method test method
+     * @param names test name list
+     * @param theClass test class
+     */
+    private boolean addTestMethod(Method method, List<String> names, Class<?> theClass) {
+        String name = method.getName();
+
+        if(!names.contains(name) && canAddMethod(method)) {
+            if(!Modifier.isPublic(method.getModifiers()))
+                addTest(warning("Test method isn\'t public: " + method.getName() + "(" +
+                    theClass.getCanonicalName() + ")"));
+            else {
+                names.add(name);
+
+                addTest(createTest(theClass, name));
+
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Check whether method should be ignored.
+     *
+     * @param method Method.
+     * @return {@code True} if it should be ignored.
+     */
+    protected boolean canAddMethod(Method method) {
+        boolean res = method.getParameterTypes().length == 0 && method.getName().startsWith("test")
+            && method.getReturnType().equals(Void.TYPE);
+
+        if (res) {
+            // If method signature and name matches check if it is ignored or not.
+            boolean hasIgnore = method.isAnnotationPresent(IgniteIgnore.class);
+
+            res = hasIgnore == ignoredOnly;
+        }
+
+        return res;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/b9d9d84f/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgnore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgnore.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgnore.java
new file mode 100644
index 0000000..ac9a885
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgnore.java
@@ -0,0 +1,35 @@
+/*
+ * 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.testsuites;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation which indicates that the test is ignored.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.METHOD, ElementType.TYPE})
+public @interface IgniteIgnore {
+    /**
+     * The optional reason why the test is ignored.
+     */
+    String value() default "";
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/b9d9d84f/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgnoredTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgnoredTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgnoredTestSuite.java
new file mode 100644
index 0000000..c3ec5e4
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgnoredTestSuite.java
@@ -0,0 +1,63 @@
+/*
+ * 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.testsuites;
+
+import junit.framework.TestSuite;
+import org.apache.ignite.testframework.IgniteTestSuite;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ * Special test suite with ignored tests.
+ */
+public class IgniteIgnoredTestSuite extends TestSuite {
+    /**
+     * @return IgniteCache test suite.
+     * @throws Exception Thrown in case of the failure.
+     */
+    public static TestSuite suite() throws Exception {
+        IgniteTestSuite suite = new IgniteTestSuite("Ignite Ignored Test Suite");
+
+        suite.addTestSuite(SampleTestClass.class, true);
+
+        return suite;
+    }
+
+    /**
+     * Sample test class. To be removed once the very first really ignored test class is there.
+     */
+    public static class SampleTestClass extends GridCommonAbstractTest {
+        /**
+         * Test 1.
+         *
+         * @throws Exception If failed.
+         */
+        public void testMethod1() throws Exception {
+            System.out.println("Normal test method called.");
+        }
+
+        /**
+         * Test 2.
+         *
+         * @throws Exception If failed.
+         */
+        @IgniteIgnore
+        public void testMethod2() throws Exception {
+            System.out.println("Ignored method called.");
+        }
+    }
+}


[17/19] ignite git commit: IGNITE-3272 Fixed "Memory consumption in ContinuousQueryHandler". This close #930.

Posted by an...@apache.org.
IGNITE-3272 Fixed "Memory consumption in ContinuousQueryHandler". This close #930.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ff3e00ca
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ff3e00ca
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ff3e00ca

Branch: refs/heads/master
Commit: ff3e00caa892a7399622711b620fcb4dcfbbfb56
Parents: 151dfa7
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Wed Aug 10 16:21:52 2016 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Wed Aug 10 16:21:52 2016 +0300

----------------------------------------------------------------------
 .../internal/GridEventConsumeHandler.java       |   5 +
 .../internal/GridMessageListenHandler.java      |   5 +
 .../continuous/CacheContinuousQueryEntry.java   |  16 +-
 .../continuous/CacheContinuousQueryHandler.java |  85 ++++++---
 .../continuous/GridContinuousHandler.java       |   5 +
 .../continuous/GridContinuousProcessor.java     |  11 +-
 .../continuous/GridContinuousQueryBatch.java    |  47 +++++
 ...niteCacheContinuousQueryBackupQueueTest.java | 184 ++++++++++++++++++-
 8 files changed, 318 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/ff3e00ca/modules/core/src/main/java/org/apache/ignite/internal/GridEventConsumeHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridEventConsumeHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/GridEventConsumeHandler.java
index 19bf1a7..b4b1e58 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridEventConsumeHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridEventConsumeHandler.java
@@ -402,6 +402,11 @@ class GridEventConsumeHandler implements GridContinuousHandler {
     }
 
     /** {@inheritDoc} */
+    @Override public void onNodeLeft() {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
     @Nullable @Override public Object orderedTopic() {
         return null;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/ff3e00ca/modules/core/src/main/java/org/apache/ignite/internal/GridMessageListenHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridMessageListenHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/GridMessageListenHandler.java
index 0ac6877..2b8041d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridMessageListenHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridMessageListenHandler.java
@@ -224,6 +224,11 @@ public class GridMessageListenHandler implements GridContinuousHandler {
     }
 
     /** {@inheritDoc} */
+    @Override public void onNodeLeft() {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
     @Override public void writeExternal(ObjectOutput out) throws IOException {
         out.writeBoolean(depEnabled);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ff3e00ca/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryEntry.java
index 74f930a..366a1e0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryEntry.java
@@ -200,6 +200,20 @@ public class CacheContinuousQueryEntry implements GridCacheDeployable, Message {
     }
 
     /**
+     * @param topVer Topology version.
+     */
+    void topologyVersion(AffinityTopologyVersion topVer) {
+        this.topVer = topVer;
+    }
+
+    /**
+     * @return Size include this event and filtered.
+     */
+    public int size() {
+        return filteredEvts != null ? filteredEvts.size() + 1 : 1;
+    }
+
+    /**
      * @return If entry filtered then will return light-weight <i><b>new entry</b></i> without values and key
      * (avoid to huge memory consumption), otherwise {@code this}.
      */
@@ -208,7 +222,7 @@ public class CacheContinuousQueryEntry implements GridCacheDeployable, Message {
             return this;
 
         CacheContinuousQueryEntry e =
-            new CacheContinuousQueryEntry(cacheId, evtType, null, null, null, keepBinary, part, updateCntr, topVer);
+            new CacheContinuousQueryEntry(cacheId, null, null, null, null, keepBinary, part, updateCntr, null);
 
         e.flags = flags;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ff3e00ca/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
index 5012569..7b3b47b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
@@ -64,8 +64,8 @@ import org.apache.ignite.internal.processors.cache.query.CacheQueryType;
 import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryManager.JCacheQueryLocalListener;
 import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryManager.JCacheQueryRemoteFilter;
 import org.apache.ignite.internal.processors.continuous.GridContinuousBatch;
-import org.apache.ignite.internal.processors.continuous.GridContinuousBatchAdapter;
 import org.apache.ignite.internal.processors.continuous.GridContinuousHandler;
+import org.apache.ignite.internal.processors.continuous.GridContinuousQueryBatch;
 import org.apache.ignite.internal.processors.platform.cache.query.PlatformContinuousQueryFilter;
 import org.apache.ignite.internal.util.GridConcurrentSkipListSet;
 import org.apache.ignite.internal.util.GridLongList;
@@ -132,7 +132,7 @@ public class CacheContinuousQueryHandler<K, V> implements GridContinuousHandler
     private transient boolean skipPrimaryCheck;
 
     /** Backup queue. */
-    private transient Collection<CacheContinuousQueryEntry> backupQueue;
+    private transient volatile Collection<CacheContinuousQueryEntry> backupQueue;
 
     /** */
     private boolean locCache;
@@ -430,33 +430,48 @@ public class CacheContinuousQueryHandler<K, V> implements GridContinuousHandler
             }
 
             @Override public void cleanupBackupQueue(Map<Integer, Long> updateCntrs) {
-                Iterator<CacheContinuousQueryEntry> it = backupQueue.iterator();
+                Collection<CacheContinuousQueryEntry> backupQueue0 = backupQueue;
 
-                while (it.hasNext()) {
-                    CacheContinuousQueryEntry backupEntry = it.next();
+                if (backupQueue0 != null) {
+                    Iterator<CacheContinuousQueryEntry> it = backupQueue0.iterator();
 
-                    Long updateCntr = updateCntrs.get(backupEntry.partition());
+                    while (it.hasNext()) {
+                        CacheContinuousQueryEntry backupEntry = it.next();
 
-                    if (updateCntr != null && backupEntry.updateCounter() <= updateCntr)
-                        it.remove();
+                        Long updateCntr = updateCntrs.get(backupEntry.partition());
+
+                        if (updateCntr != null && backupEntry.updateCounter() <= updateCntr)
+                            it.remove();
+                    }
                 }
             }
 
             @Override public void flushBackupQueue(GridKernalContext ctx, AffinityTopologyVersion topVer) {
-                if (backupQueue.isEmpty())
+                Collection<CacheContinuousQueryEntry> backupQueue0 = backupQueue;
+
+                if (backupQueue0 == null)
                     return;
 
                 try {
-                    GridCacheContext<K, V> cctx = cacheContext(ctx);
+                    ClusterNode nodeId0 = ctx.discovery().node(nodeId);
 
-                    for (CacheContinuousQueryEntry e : backupQueue) {
-                        if (!e.isFiltered())
-                            prepareEntry(cctx, nodeId, e);
-                    }
+                    if (nodeId0 != null) {
+                        GridCacheContext<K, V> cctx = cacheContext(ctx);
 
-                    ctx.continuous().addBackupNotification(nodeId, routineId, backupQueue, topic);
+                        for (CacheContinuousQueryEntry e : backupQueue0) {
+                            if (!e.isFiltered())
+                                prepareEntry(cctx, nodeId, e);
+
+                            e.topologyVersion(topVer);
+                        }
+
+                        ctx.continuous().addBackupNotification(nodeId, routineId, backupQueue0, topic);
+                    }
+                    else
+                        // Node which start CQ leave topology. Not needed to put data to backup queue.
+                        backupQueue = null;
 
-                    backupQueue.clear();
+                    backupQueue0.clear();
                 }
                 catch (IgniteCheckedException e) {
                     U.error(ctx.log(getClass()), "Failed to send backup event notification to node: " + nodeId, e);
@@ -479,9 +494,13 @@ public class CacheContinuousQueryHandler<K, V> implements GridContinuousHandler
             }
 
             @Override public void onPartitionEvicted(int part) {
-                for (Iterator<CacheContinuousQueryEntry> it = backupQueue.iterator(); it.hasNext();) {
-                    if (it.next().partition() == part)
-                        it.remove();
+                Collection<CacheContinuousQueryEntry> backupQueue0 = backupQueue;
+
+                if (backupQueue0 != null) {
+                    for (Iterator<CacheContinuousQueryEntry> it = backupQueue0.iterator(); it.hasNext(); ) {
+                        if (it.next().partition() == part)
+                            it.remove();
+                    }
                 }
             }
 
@@ -740,7 +759,10 @@ public class CacheContinuousQueryHandler<K, V> implements GridContinuousHandler
         if (!primary && !internal && entry.updateCounter() != -1L /* Skip init query and expire entries */) {
             entry.markBackup();
 
-            backupQueue.add(entry.forBackupQueue());
+            Collection<CacheContinuousQueryEntry> backupQueue0 = backupQueue;
+
+            if (backupQueue0 != null)
+                backupQueue0.add(entry.forBackupQueue());
         }
 
         return notify;
@@ -765,12 +787,11 @@ public class CacheContinuousQueryHandler<K, V> implements GridContinuousHandler
                 if (!locCache) {
                     Collection<CacheEntryEvent<? extends K, ? extends V>> evts = handleEvent(ctx, entry);
 
-                    if (!evts.isEmpty()) {
+                    if (!evts.isEmpty())
                         locLsnr.onUpdated(evts);
 
-                        if (!internal && !skipPrimaryCheck)
-                            sendBackupAcknowledge(ackBuf.onAcknowledged(entry), routineId, ctx);
-                    }
+                    if (!internal && !skipPrimaryCheck)
+                        sendBackupAcknowledge(ackBuf.onAcknowledged(entry), routineId, ctx);
                 }
                 else {
                     if (!entry.isFiltered())
@@ -931,7 +952,7 @@ public class CacheContinuousQueryHandler<K, V> implements GridContinuousHandler
          * @param topVer Topology version.
          * @param initCntr Update counters.
          */
-        public PartitionRecovery(IgniteLogger log, AffinityTopologyVersion topVer, @Nullable Long initCntr) {
+        PartitionRecovery(IgniteLogger log, AffinityTopologyVersion topVer, @Nullable Long initCntr) {
             this.log = log;
 
             if (initCntr != null) {
@@ -1176,6 +1197,14 @@ public class CacheContinuousQueryHandler<K, V> implements GridContinuousHandler
     }
 
     /** {@inheritDoc} */
+    @Override public void onNodeLeft() {
+        Collection<CacheContinuousQueryEntry> backupQueue0 = backupQueue;
+
+        if (backupQueue0 != null)
+            backupQueue = null;
+    }
+
+    /** {@inheritDoc} */
     @Override public void p2pMarshal(GridKernalContext ctx) throws IgniteCheckedException {
         assert ctx != null;
         assert ctx.config().isPeerClassLoadingEnabled();
@@ -1196,7 +1225,7 @@ public class CacheContinuousQueryHandler<K, V> implements GridContinuousHandler
 
     /** {@inheritDoc} */
     @Override public GridContinuousBatch createBatch() {
-        return new GridContinuousBatchAdapter();
+        return new GridContinuousQueryBatch();
     }
 
     /** {@inheritDoc} */
@@ -1345,7 +1374,9 @@ public class CacheContinuousQueryHandler<K, V> implements GridContinuousHandler
         @SuppressWarnings("unchecked")
         @Nullable synchronized IgniteBiTuple<Map<Integer, Long>, Set<AffinityTopologyVersion>>
         onAcknowledged(GridContinuousBatch batch) {
-            size += batch.size();
+            assert batch instanceof GridContinuousQueryBatch;
+
+            size += ((GridContinuousQueryBatch)batch).entriesCount();
 
             Collection<CacheContinuousQueryEntry> entries = (Collection)batch.collect();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ff3e00ca/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousHandler.java
index 46e87af..c90746d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousHandler.java
@@ -116,6 +116,11 @@ public interface GridContinuousHandler extends Externalizable, Cloneable {
     public void onBatchAcknowledged(UUID routineId, GridContinuousBatch batch, GridKernalContext ctx);
 
     /**
+     * Node which started routine leave topology.
+     */
+    public void onNodeLeft();
+
+    /**
      * @return Topic for ordered notifications. If {@code null}, notifications
      * will be sent in non-ordered messages.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/ff3e00ca/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
index fce48c4..5f61051 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
@@ -175,8 +175,13 @@ public class GridContinuousProcessor extends GridProcessorAdapter {
                     UUID routineId = e.getKey();
                     RemoteRoutineInfo info = e.getValue();
 
-                    if (info.autoUnsubscribe && nodeId.equals(info.nodeId))
-                        unregisterRemote(routineId);
+                    if (nodeId.equals(info.nodeId)) {
+                        if (info.autoUnsubscribe)
+                            unregisterRemote(routineId);
+
+                        if (info.hnd.isQuery())
+                            info.hnd.onNodeLeft();
+                    }
                 }
 
                 for (Map.Entry<IgniteUuid, SyncMessageAckFuture> e : syncMsgFuts.entrySet()) {
@@ -865,6 +870,8 @@ public class GridContinuousProcessor extends GridProcessorAdapter {
 
                 try {
                     sendNotification(nodeId, routineId, futId, F.asList(obj), null, msg, null);
+
+                    info.hnd.onBatchAcknowledged(routineId, info.add(obj), ctx);
                 }
                 catch (IgniteCheckedException e) {
                     syncMsgFuts.remove(futId);

http://git-wip-us.apache.org/repos/asf/ignite/blob/ff3e00ca/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousQueryBatch.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousQueryBatch.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousQueryBatch.java
new file mode 100644
index 0000000..c5d854b
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousQueryBatch.java
@@ -0,0 +1,47 @@
+/*
+ * 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.continuous;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryEntry;
+
+/**
+ * Continuous routine batch adapter.
+ */
+public class GridContinuousQueryBatch extends GridContinuousBatchAdapter {
+    /** Entries size included filtered entries. */
+    private final AtomicInteger size = new AtomicInteger();
+
+    /** {@inheritDoc} */
+    @Override public void add(Object obj) {
+        assert obj != null;
+        assert obj instanceof CacheContinuousQueryEntry;
+
+        super.add(obj);
+
+        size.addAndGet(((CacheContinuousQueryEntry)obj).size());
+    }
+
+    /**
+     * @return Entries count.
+     */
+    public int entriesCount() {
+        return size.get();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ff3e00ca/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryBackupQueueTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryBackupQueueTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryBackupQueueTest.java
index aea1954..d823409 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryBackupQueueTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryBackupQueueTest.java
@@ -18,18 +18,29 @@
 package org.apache.ignite.internal.processors.cache.query.continuous;
 
 import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.TimeUnit;
 import javax.cache.configuration.Factory;
 import javax.cache.event.CacheEntryEvent;
 import javax.cache.event.CacheEntryEventFilter;
 import javax.cache.event.CacheEntryUpdatedListener;
+import org.apache.ignite.Ignite;
 import org.apache.ignite.cache.query.ContinuousQuery;
 import org.apache.ignite.cache.query.QueryCursor;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.processors.continuous.GridContinuousHandler;
+import org.apache.ignite.internal.processors.continuous.GridContinuousProcessor;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
@@ -46,14 +57,27 @@ public class IgniteCacheContinuousQueryBackupQueueTest extends GridCommonAbstrac
     /** Keys count. */
     private static final int KEYS_COUNT = 1024;
 
+    /** CQ count. */
+    private static final int QUERY_COUNT = 20;
+
     /** Grid count. */
     private static final int GRID_COUNT = 2;
 
+    /** */
+    private static boolean client = false;
+
+    /** */
+    private static String CACHE_NAME = "test-cache";
+
+    /** */
+    private static final int BACKUP_ACK_THRESHOLD = 100;
+
     /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(gridName);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(CACHE_NAME);
+
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setAtomicityMode(ATOMIC);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
@@ -61,42 +85,51 @@ public class IgniteCacheContinuousQueryBackupQueueTest extends GridCommonAbstrac
 
         cfg.setCacheConfiguration(ccfg);
 
+        cfg.setClientMode(client);
+
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
 
         return cfg;
     }
 
     /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        startGridsMultiThreaded(GRID_COUNT);
+    }
+
+    /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {
         super.afterTest();
 
         stopAllGrids();
+
+        client = false;
     }
 
     /** {@inheritDoc} */
     @Override protected long getTestTimeout() {
-        return TimeUnit.MINUTES.toMillis(2);
+        return TimeUnit.MINUTES.toMillis(10);
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testBackupQueue() throws Exception {
-        startGridsMultiThreaded(GRID_COUNT);
-
         final CacheEventListener lsnr = new CacheEventListener();
 
         ContinuousQuery<Object, Object> qry = new ContinuousQuery<>();
 
         qry.setLocalListener(lsnr);
-        qry.setRemoteFilterFactory(new FilterFactory());
+        qry.setRemoteFilterFactory(new AlwaysFalseFilterFactory());
 
-        try (QueryCursor<?> ignore = grid(0).cache(null).query(qry)) {
+        try (QueryCursor<?> ignore = grid(0).cache(CACHE_NAME).query(qry)) {
             for (int i = 0; i < KEYS_COUNT; i++) {
                 log.info("Put key: " + i);
 
                 for (int j = 0; j < 100; j++)
-                    grid(i % GRID_COUNT).cache(null).put(i, new byte[1024 * 50]);
+                    grid(j % GRID_COUNT).cache(CACHE_NAME).put(i, new byte[1024 * 50]);
             }
 
             log.info("Finish.");
@@ -104,19 +137,150 @@ public class IgniteCacheContinuousQueryBackupQueueTest extends GridCommonAbstrac
     }
 
     /**
+     * @throws Exception If failed.
+     */
+    public void testManyQueryBackupQueue() throws Exception {
+        List<QueryCursor> qryCursors = new ArrayList<>();
+
+        for (int i = 0; i < QUERY_COUNT; i++) {
+            ContinuousQuery<Object, Object> qry = new ContinuousQuery<>();
+
+            qry.setLocalListener(new CacheEventListener());
+            qry.setRemoteFilterFactory(new AlwaysFalseFilterFactory());
+
+            qryCursors.add(grid(0).cache(CACHE_NAME).query(qry));
+        }
+
+        for (int i = 0; i < KEYS_COUNT; i++) {
+            log.info("Put key: " + i);
+
+            for (int j = 0; j < 150; j++)
+                grid(ThreadLocalRandom.current().nextInt(GRID_COUNT)).cache(CACHE_NAME).put(i, new byte[1024 * 50]);
+        }
+
+        int size = backupQueueSize();
+
+        assertTrue(size > 0);
+        assertTrue(size <= BACKUP_ACK_THRESHOLD * QUERY_COUNT * /* partition count */1024);
+
+        for (QueryCursor qry : qryCursors)
+            qry.close();
+    }
+
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testBackupQueueAutoUnsubscribeFalse() throws Exception {
+        try {
+            client = true;
+
+            Ignite client = startGrid(GRID_COUNT);
+
+            awaitPartitionMapExchange();
+
+            List<QueryCursor> qryCursors = new ArrayList<>();
+
+            for (int i = 0; i < QUERY_COUNT; i++) {
+                ContinuousQuery<Object, Object> qry = new ContinuousQuery<>();
+
+                qry.setLocalListener(new CacheEventListener());
+                qry.setRemoteFilterFactory(new AlwaysFalseFilterFactory());
+                qry.setAutoUnsubscribe(false);
+
+                qryCursors.add(client.cache(CACHE_NAME).query(qry));
+            }
+
+            for (int i = 0; i < KEYS_COUNT; i++) {
+                log.info("Put key: " + i);
+
+                grid(i % GRID_COUNT).cache(CACHE_NAME).put(i, new byte[1024 * 50]);
+            }
+
+            int size = backupQueueSize();
+
+            assertTrue(size > 0);
+            assertTrue(size <= BACKUP_ACK_THRESHOLD * QUERY_COUNT * /* partition count */1024);
+
+            stopGrid(GRID_COUNT);
+
+            awaitPartitionMapExchange();
+
+            for (int i = 0; i < KEYS_COUNT; i++) {
+                log.info("Put key: " + i);
+
+                grid(i % GRID_COUNT).cache(CACHE_NAME).put(i, new byte[1024 * 50]);
+            }
+
+            size = backupQueueSize();
+
+            assertEquals(-1, size);
+        }
+        finally {
+            stopGrid(GRID_COUNT);
+        }
+    }
+
+    /**
+     * @return Backup queue size or {@code -1} if backup queue doesn't exist.
+     */
+    private int backupQueueSize() {
+        int backupQueueSize = -1;
+
+        for (int i = 0; i < GRID_COUNT; i++) {
+            for (Collection<Object> backQueue : backupQueues(grid(i)))
+                backupQueueSize += backQueue.size();
+        }
+
+        return backupQueueSize;
+    }
+
+    /**
+     * @param ignite Ignite.
+     * @return Backup queue for test query.
+     */
+    private List<Collection<Object>> backupQueues(Ignite ignite) {
+        GridContinuousProcessor proc = ((IgniteKernal)ignite).context().continuous();
+
+        Map<Object, Object> infos = new HashMap<>();
+
+        Map<Object, Object> rmtInfos = GridTestUtils.getFieldValue(proc, "rmtInfos");
+        Map<Object, Object> locInfos = GridTestUtils.getFieldValue(proc, "locInfos");
+
+        infos.putAll(rmtInfos);
+        infos.putAll(locInfos);
+
+        List<Collection<Object>> backupQueues = new ArrayList<>();
+
+        for (Object info : infos.values()) {
+            GridContinuousHandler hnd = GridTestUtils.getFieldValue(info, "hnd");
+
+            if (hnd.isQuery() && hnd.cacheName().equals(CACHE_NAME)) {
+                Collection<Object> q = GridTestUtils.getFieldValue(hnd,
+                    CacheContinuousQueryHandler.class, "backupQueue");
+
+                if (q != null)
+                    backupQueues.add(q);
+            }
+        }
+
+        return backupQueues;
+    }
+
+    /**
      *
      */
-    private static class FilterFactory implements Factory<CacheEntryEventFilter<Object, Object>> {
+    private static class AlwaysFalseFilterFactory implements Factory<CacheEntryEventFilter<Object, Object>> {
         /** {@inheritDoc} */
         @Override public CacheEntryEventFilter<Object, Object> create() {
-            return new CacheEventFilter();
+            return new AlwaysFalseFilter();
         }
     }
 
     /**
      *
      */
-    private static class CacheEventFilter implements CacheEntryEventFilter<Object, Object>, Serializable {
+    private static class AlwaysFalseFilter implements CacheEntryEventFilter<Object, Object>, Serializable {
         /** {@inheritDoc} */
         @Override public boolean evaluate(CacheEntryEvent<?, ?> evt) {
             return false;


[16/19] ignite git commit: Fixed checks for client mode + daemon mode.

Posted by an...@apache.org.
Fixed checks for client mode + daemon mode.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/317a6750
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/317a6750
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/317a6750

Branch: refs/heads/master
Commit: 317a675095d96ce158dd66c1739107a2e18cfc8c
Parents: 8bf0a48
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Wed Aug 10 17:44:59 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Wed Aug 10 17:44:59 2016 +0700

----------------------------------------------------------------------
 .../internal/managers/discovery/GridDiscoveryManager.java    | 3 ++-
 .../apache/ignite/internal/visor/util/VisorTaskUtils.java    | 8 ++++++++
 .../java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java | 8 ++++++--
 3 files changed, 16 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/317a6750/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 bbf3ebd..2a47ca2 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
@@ -2225,7 +2225,8 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
                     if (log.isInfoEnabled())
                         log.info("Client node reconnected to topology: " + node);
 
-                    ackTopology(topVer.topologyVersion(), true);
+                    if (!isLocDaemon)
+                        ackTopology(topVer.topologyVersion(), true);
 
                     break;
                 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/317a6750/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
index 7eebbf1..2721be4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
@@ -1024,4 +1024,12 @@ public class VisorTaskUtils {
 
         return bos.toByteArray();
     }
+
+    /**
+     * @param msg Exception message.
+     * @return {@code true} if node failed to join grid.
+     */
+    public static boolean joinTimedOut(String msg) {
+        return msg != null && msg.startsWith("Join process timed out.");
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/317a6750/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
index 9821134..4230a26 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
@@ -2018,15 +2018,19 @@ class ClientImpl extends TcpDiscoveryImpl {
             Map<Integer, CacheMetrics> cacheMetrics,
             long tstamp)
         {
+            boolean isLocDaemon = spi.locNode.isDaemon();
+
             assert nodeId != null;
             assert metrics != null;
-            assert cacheMetrics != null;
+            assert isLocDaemon || cacheMetrics != null;
 
             TcpDiscoveryNode node = nodeId.equals(getLocalNodeId()) ? locNode : rmtNodes.get(nodeId);
 
             if (node != null && node.visible()) {
                 node.setMetrics(metrics);
-                node.setCacheMetrics(cacheMetrics);
+
+                if (!isLocDaemon)
+                    node.setCacheMetrics(cacheMetrics);
 
                 node.lastUpdateTime(tstamp);
 


[10/19] ignite git commit: Merge remote-tracking branch 'upstream/ignite-1.6.5' into ignite-1.6.5

Posted by an...@apache.org.
Merge remote-tracking branch 'upstream/ignite-1.6.5' into ignite-1.6.5


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e23aba4b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e23aba4b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e23aba4b

Branch: refs/heads/master
Commit: e23aba4b060a9dfbee20384550a49274a479ac00
Parents: b9d9d84 0180010
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Aug 9 14:05:17 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Aug 9 14:05:17 2016 +0300

----------------------------------------------------------------------
 .../ignite/codegen/MessageCodeGenerator.java    |   6 +-
 .../java/org/apache/ignite/IgniteCompute.java   |  69 +-
 .../ignite/internal/GridJobExecuteRequest.java  | 148 +++-
 .../ignite/internal/GridJobExecuteResponse.java |  42 +-
 .../ignite/internal/IgniteComputeImpl.java      | 120 ++-
 .../failover/GridFailoverContextImpl.java       |  27 +-
 .../managers/failover/GridFailoverManager.java  |  17 +-
 .../affinity/GridAffinityProcessor.java         |  18 +
 .../processors/cache/GridCacheSwapManager.java  |  22 +-
 .../distributed/dht/GridDhtCacheAdapter.java    |  19 +-
 .../distributed/dht/GridDhtLocalPartition.java  |  33 +-
 .../cache/distributed/dht/GridReservable.java   |   5 +-
 .../cache/query/GridCacheQueryManager.java      |  10 +-
 .../processors/closure/AffinityTask.java        |  17 +-
 .../closure/GridClosureProcessor.java           | 142 +++-
 .../processors/job/GridJobProcessor.java        | 139 ++-
 .../internal/processors/job/GridJobWorker.java  | 203 +++--
 .../processors/query/GridQueryProcessor.java    |  22 +-
 .../processors/task/GridTaskWorker.java         | 235 +++--
 .../ignite/internal/util/IgniteUtils.java       |  10 +
 .../ignite/spi/failover/FailoverContext.java    |  15 +-
 .../spi/failover/always/AlwaysFailoverSpi.java  |  15 +-
 .../GridJobMasterLeaveAwareSelfTest.java        |   4 +-
 ...ectionLocalJobMultipleArgumentsSelfTest.java |   4 +-
 .../GridTaskFailoverAffinityRunTest.java        |   2 +-
 .../IgniteComputeEmptyClusterGroupTest.java     |   8 +-
 .../binary/GridBinaryAffinityKeySelfTest.java   |   6 +-
 ...acheAbstractUsersAffinityMapperSelfTest.java |   2 +-
 ...niteDynamicCacheStartStopConcurrentTest.java |   2 +-
 .../spi/failover/GridFailoverTestContext.java   |   6 +
 ...eLockPartitionOnAffinityRunAbstractTest.java | 412 +++++++++
 ...PartitionOnAffinityRunAtomicCacheOpTest.java | 329 +++++++
 ...niteCacheLockPartitionOnAffinityRunTest.java | 852 +++++++++++++++++++
 ...LockPartitionOnAffinityRunTxCacheOpTest.java |  33 +
 ...titionOnAffinityRunWithCollisionSpiTest.java | 204 +++++
 .../IgniteCacheAffinityRunTestSuite.java        |  45 +
 36 files changed, 2961 insertions(+), 282 deletions(-)
----------------------------------------------------------------------



[18/19] ignite git commit: Merge branches ignite-1.6.5 to ignite-1.7.2.

Posted by an...@apache.org.
Merge branches ignite-1.6.5 to ignite-1.7.2.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7307d8d5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7307d8d5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7307d8d5

Branch: refs/heads/master
Commit: 7307d8d5393740fbfb39aea39559c01d8cb44914
Parents: 317a675 ff3e00c
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Thu Aug 11 10:26:11 2016 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Thu Aug 11 10:26:11 2016 +0700

----------------------------------------------------------------------
 .../internal/GridEventConsumeHandler.java       |   5 +
 .../internal/GridMessageListenHandler.java      |   5 +
 .../continuous/CacheContinuousQueryEntry.java   |  16 +-
 .../continuous/CacheContinuousQueryHandler.java |  85 ++++++---
 .../continuous/GridContinuousHandler.java       |   5 +
 .../continuous/GridContinuousProcessor.java     |  11 +-
 .../continuous/GridContinuousQueryBatch.java    |  47 +++++
 ...niteCacheContinuousQueryBackupQueueTest.java | 184 ++++++++++++++++++-
 8 files changed, 318 insertions(+), 40 deletions(-)
----------------------------------------------------------------------



[04/19] ignite git commit: IGNITE-3634 - SpringCacheManager should support null values

Posted by an...@apache.org.
IGNITE-3634 - SpringCacheManager should support null values


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/00f47d78
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/00f47d78
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/00f47d78

Branch: refs/heads/master
Commit: 00f47d78216db5de75dda2a1b5fef2c1e65d9871
Parents: d945a5d
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Fri Aug 5 18:04:01 2016 -0700
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Fri Aug 5 18:04:01 2016 -0700

----------------------------------------------------------------------
 .../apache/ignite/cache/spring/SpringCache.java |  44 +-
 .../ignite/cache/spring/SpringCacheManager.java |   7 +-
 .../spring/GridSpringCacheManagerSelfTest.java  | 438 +++++++++++++++++++
 .../cache/spring/GridSpringCacheTestKey.java    |  61 +++
 .../spring/GridSpringCacheTestKeyGenerator.java |  40 ++
 .../spring/GridSpringCacheTestService.java      | 181 ++++++++
 .../GridSpringDynamicCacheTestService.java      |  85 ++++
 .../SpringCacheManagerContextInjectionTest.java | 125 ++++++
 .../ignite/cache/spring/spring-caching.xml      |  57 +++
 .../spring/GridSpringCacheManagerSelfTest.java  | 342 ---------------
 .../ignite/spring/GridSpringCacheTestKey.java   |  61 ---
 .../spring/GridSpringCacheTestKeyGenerator.java |  40 --
 .../spring/GridSpringCacheTestService.java      | 125 ------
 .../GridSpringDynamicCacheTestService.java      |  85 ----
 .../SpringCacheManagerContextInjectionTest.java | 126 ------
 .../org/apache/ignite/spring/spring-caching.xml |  57 ---
 .../testsuites/IgniteSpringTestSuite.java       |   4 +-
 17 files changed, 1032 insertions(+), 846 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/00f47d78/modules/spring/src/main/java/org/apache/ignite/cache/spring/SpringCache.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/main/java/org/apache/ignite/cache/spring/SpringCache.java b/modules/spring/src/main/java/org/apache/ignite/cache/spring/SpringCache.java
index 6014205..afd060a 100644
--- a/modules/spring/src/main/java/org/apache/ignite/cache/spring/SpringCache.java
+++ b/modules/spring/src/main/java/org/apache/ignite/cache/spring/SpringCache.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.cache.spring;
 
+import java.io.Serializable;
 import org.apache.ignite.IgniteCache;
 import org.springframework.cache.Cache;
 import org.springframework.cache.support.SimpleValueWrapper;
@@ -26,6 +27,9 @@ import org.springframework.cache.support.SimpleValueWrapper;
  */
 class SpringCache implements Cache {
     /** */
+    private static final Object NULL = new NullValue();
+
+    /** */
     private final IgniteCache<Object, Object> cache;
 
     /**
@@ -51,7 +55,7 @@ class SpringCache implements Cache {
     @Override public ValueWrapper get(Object key) {
         Object val = cache.get(key);
 
-        return val != null ? new SimpleValueWrapper(val) : null;
+        return val != null ? fromValue(val) : null;
     }
 
     /** {@inheritDoc} */
@@ -59,6 +63,9 @@ class SpringCache implements Cache {
     @Override public <T> T get(Object key, Class<T> type) {
         Object val = cache.get(key);
 
+        if (NULL.equals(val))
+            val = null;
+
         if (val != null && type != null && !type.isInstance(val))
             throw new IllegalStateException("Cached value is not of required type [cacheName=" + cache.getName() +
                 ", key=" + key + ", val=" + val + ", requiredType=" + type + ']');
@@ -68,14 +75,22 @@ class SpringCache implements Cache {
 
     /** {@inheritDoc} */
     @Override public void put(Object key, Object val) {
-        cache.put(key, val);
+        if (val == null)
+            cache.withSkipStore().put(key, NULL);
+        else
+            cache.put(key, val);
     }
 
     /** {@inheritDoc} */
     @Override public ValueWrapper putIfAbsent(Object key, Object val) {
-        Object old = cache.putIfAbsent(key, val);
+        Object old;
+
+        if (val == null)
+            old = cache.withSkipStore().putIfAbsent(key, NULL);
+        else
+            old = cache.putIfAbsent(key, val);
 
-        return old != null ? new SimpleValueWrapper(old) : null;
+        return old != null ? fromValue(old) : null;
     }
 
     /** {@inheritDoc} */
@@ -87,4 +102,23 @@ class SpringCache implements Cache {
     @Override public void clear() {
         cache.removeAll();
     }
-}
\ No newline at end of file
+
+    /**
+     * @param val Cache value.
+     * @return Wrapped value.
+     */
+    private static ValueWrapper fromValue(Object val) {
+        assert val != null;
+
+        return new SimpleValueWrapper(NULL.equals(val) ? null : val);
+    }
+
+    /**
+     */
+    private static class NullValue implements Serializable {
+        /** {@inheritDoc} */
+        @Override public boolean equals(Object o) {
+            return this == o || (o != null && getClass() == o.getClass());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/00f47d78/modules/spring/src/main/java/org/apache/ignite/cache/spring/SpringCacheManager.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/main/java/org/apache/ignite/cache/spring/SpringCacheManager.java b/modules/spring/src/main/java/org/apache/ignite/cache/spring/SpringCacheManager.java
index 6d1a9b6..fbdeb73 100644
--- a/modules/spring/src/main/java/org/apache/ignite/cache/spring/SpringCacheManager.java
+++ b/modules/spring/src/main/java/org/apache/ignite/cache/spring/SpringCacheManager.java
@@ -28,6 +28,7 @@ import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 import org.jsr166.ConcurrentHashMap8;
 import org.springframework.beans.factory.InitializingBean;
+import org.springframework.cache.Cache;
 import org.springframework.cache.CacheManager;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContextAware;
@@ -158,7 +159,7 @@ public class SpringCacheManager implements CacheManager, InitializingBean, Appli
     /** Ignite instance. */
     private Ignite ignite;
 
-    /** Spring context */
+    /** Spring context. */
     private ApplicationContext springCtx;
 
     /** {@inheritDoc} */
@@ -276,7 +277,7 @@ public class SpringCacheManager implements CacheManager, InitializingBean, Appli
     }
 
     /** {@inheritDoc} */
-    @Override public org.springframework.cache.Cache getCache(String name) {
+    @Override public Cache getCache(String name) {
         assert ignite != null;
 
         SpringCache cache = caches.get(name);
@@ -308,4 +309,4 @@ public class SpringCacheManager implements CacheManager, InitializingBean, Appli
 
         return new ArrayList<>(caches.keySet());
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/00f47d78/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheManagerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheManagerSelfTest.java b/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheManagerSelfTest.java
new file mode 100644
index 0000000..601401c
--- /dev/null
+++ b/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheManagerSelfTest.java
@@ -0,0 +1,438 @@
+/*
+ * 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.cache.spring;
+
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.springframework.beans.factory.BeanFactory;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * Spring cache test.
+ */
+public class GridSpringCacheManagerSelfTest extends GridCommonAbstractTest {
+    /** */
+    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+    /** */
+    private static final String CACHE_NAME = "testCache";
+
+    /** */
+    private static final String DYNAMIC_CACHE_NAME = "dynamicCache";
+
+    /** */
+    private static final Object NULL;
+
+    /**
+     */
+    static {
+        try {
+            NULL = U.field(SpringCache.class, "NULL");
+        }
+        catch (IgniteCheckedException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    /** */
+    private GridSpringCacheTestService svc;
+
+    /** */
+    private GridSpringDynamicCacheTestService dynamicSvc;
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        CacheConfiguration cache = new CacheConfiguration();
+
+        cache.setName(CACHE_NAME);
+
+        cfg.setCacheConfiguration(cache);
+
+        TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+        disco.setIpFinder(IP_FINDER);
+
+        cfg.setDiscoverySpi(disco);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getTestGridName() {
+        return "testGrid";
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        startGrid();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        BeanFactory factory = new ClassPathXmlApplicationContext("org/apache/ignite/cache/spring/spring-caching.xml");
+
+        svc = (GridSpringCacheTestService)factory.getBean("testService");
+        dynamicSvc = (GridSpringDynamicCacheTestService)factory.getBean("dynamicTestService");
+
+        svc.reset();
+        dynamicSvc.reset();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        grid().cache(CACHE_NAME).removeAll();
+
+        grid().destroyCache(DYNAMIC_CACHE_NAME);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testSimpleKey() throws Exception {
+        for (int i = 0; i < 3; i++) {
+            assertEquals("value" + i, svc.simpleKey(i));
+            assertEquals("value" + i, svc.simpleKey(i));
+        }
+
+        assertEquals(3, svc.called());
+
+        IgniteCache<Integer, String> c = grid().cache(CACHE_NAME);
+
+        assertEquals(3, c.size());
+
+        for (int i = 0; i < 3; i++)
+            assertEquals("value" + i, c.get(i));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testSimpleKeyNullValue() throws Exception {
+        for (int i = 0; i < 3; i++) {
+            assertNull(svc.simpleKeyNullValue(i));
+            assertNull(svc.simpleKeyNullValue(i));
+        }
+
+        assertEquals(3, svc.called());
+
+        IgniteCache<Integer, String> c = grid().cache(CACHE_NAME);
+
+        assertEquals(3, c.size());
+
+        for (int i = 0; i < 3; i++)
+            assertEquals(NULL, c.get(i));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testComplexKey() throws Exception {
+        for (int i = 0; i < 3; i++) {
+            assertEquals("value" + i + "suffix" + i, svc.complexKey(i, "suffix" + i));
+            assertEquals("value" + i + "suffix" + i, svc.complexKey(i, "suffix" + i));
+        }
+
+        assertEquals(3, svc.called());
+
+        IgniteCache<GridSpringCacheTestKey, String> c = grid().cache(CACHE_NAME);
+
+        assertEquals(3, c.size());
+
+        for (int i = 0; i < 3; i++)
+            assertEquals("value" + i + "suffix" + i, c.get(new GridSpringCacheTestKey(i, "suffix" + i)));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testComplexKeyNullValue() throws Exception {
+        for (int i = 0; i < 3; i++) {
+            assertNull(svc.complexKeyNullValue(i, "suffix" + i));
+            assertNull(svc.complexKeyNullValue(i, "suffix" + i));
+        }
+
+        assertEquals(3, svc.called());
+
+        IgniteCache<GridSpringCacheTestKey, String> c = grid().cache(CACHE_NAME);
+
+        assertEquals(3, c.size());
+
+        for (int i = 0; i < 3; i++)
+            assertEquals(NULL, c.get(new GridSpringCacheTestKey(i, "suffix" + i)));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testSimpleKeyPut() throws Exception {
+        IgniteCache<Integer, String> c = grid().cache(CACHE_NAME);
+
+        for (int i = 0; i < 3; i++) {
+            assertEquals("value" + i + "odd", svc.simpleKeyPut(i));
+
+            assertEquals(i + 1, c.size());
+            assertEquals("value" + i + "odd", c.get(i));
+
+            assertEquals("value" + i + "even", svc.simpleKeyPut(i));
+
+            assertEquals(i + 1, c.size());
+            assertEquals("value" + i + "even", c.get(i));
+        }
+
+        assertEquals(6, svc.called());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testSimpleKeyPutNullValue() throws Exception {
+        IgniteCache<Integer, String> c = grid().cache(CACHE_NAME);
+
+        for (int i = 0; i < 3; i++) {
+            assertNull(svc.simpleKeyPutNullValue(i));
+
+            assertEquals(i + 1, c.size());
+            assertEquals(NULL, c.get(i));
+
+            assertNull(svc.simpleKeyPutNullValue(i));
+
+            assertEquals(i + 1, c.size());
+            assertEquals(NULL, c.get(i));
+        }
+
+        assertEquals(6, svc.called());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testComplexKeyPut() throws Exception {
+        IgniteCache<GridSpringCacheTestKey, String> c = grid().cache(CACHE_NAME);
+
+        for (int i = 0; i < 3; i++) {
+            assertEquals("value" + i + "suffix" + i + "odd", svc.complexKeyPut(i, "suffix" + i));
+
+            assertEquals(i + 1, c.size());
+            assertEquals("value" + i + "suffix" + i + "odd", c.get(new GridSpringCacheTestKey(i, "suffix" + i)));
+
+            assertEquals("value" + i + "suffix" + i + "even", svc.complexKeyPut(i, "suffix" + i));
+
+            assertEquals(i + 1, c.size());
+            assertEquals("value" + i + "suffix" + i + "even", c.get(new GridSpringCacheTestKey(i, "suffix" + i)));
+        }
+
+        assertEquals(6, svc.called());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testComplexKeyPutNullValue() throws Exception {
+        IgniteCache<GridSpringCacheTestKey, String> c = grid().cache(CACHE_NAME);
+
+        for (int i = 0; i < 3; i++) {
+            assertNull(svc.complexKeyPutNullValue(i, "suffix" + i));
+
+            assertEquals(i + 1, c.size());
+            assertEquals(NULL, c.get(new GridSpringCacheTestKey(i, "suffix" + i)));
+
+            assertNull(svc.complexKeyPutNullValue(i, "suffix" + i));
+
+            assertEquals(i + 1, c.size());
+            assertEquals(NULL, c.get(new GridSpringCacheTestKey(i, "suffix" + i)));
+        }
+
+        assertEquals(6, svc.called());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testSimpleKeyEvict() throws Exception {
+        IgniteCache<Integer, String> c = grid().cache(CACHE_NAME);
+
+        for (int i = 0; i < 3; i++)
+            c.put(i, "value" + i);
+
+        assertEquals(3, c.size());
+
+        assertEquals("value0", c.get(0));
+        assertEquals("value1", c.get(1));
+        assertEquals("value2", c.get(2));
+
+        svc.simpleKeyEvict(2);
+
+        assertEquals(2, c.size());
+
+        assertEquals("value0", c.get(0));
+        assertEquals("value1", c.get(1));
+        assertNull(c.get(2));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testComplexKeyEvict() throws Exception {
+        IgniteCache<GridSpringCacheTestKey, String> c = grid().cache(CACHE_NAME);
+
+        for (int i = 0; i < 3; i++)
+            c.put(new GridSpringCacheTestKey(i, "suffix" + i), "value" + i);
+
+        assertEquals(3, c.size());
+
+        assertEquals("value0", c.get(new GridSpringCacheTestKey(0, "suffix" + 0)));
+        assertEquals("value1", c.get(new GridSpringCacheTestKey(1, "suffix" + 1)));
+        assertEquals("value2", c.get(new GridSpringCacheTestKey(2, "suffix" + 2)));
+
+        svc.complexKeyEvict(2, "suffix" + 2);
+
+        assertEquals(2, c.size());
+
+        assertEquals("value0", c.get(new GridSpringCacheTestKey(0, "suffix" + 0)));
+        assertEquals("value1", c.get(new GridSpringCacheTestKey(1, "suffix" + 1)));
+        assertNull(c.get(new GridSpringCacheTestKey(2, "suffix" + 2)));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testEvictAll() throws Exception {
+        IgniteCache<Integer, String> c = grid().cache(CACHE_NAME);
+
+        for (int i = 0; i < 3; i++)
+            c.put(i, "value" + i);
+
+        assertEquals(3, c.size());
+
+        assertEquals("value0", c.get(0));
+        assertEquals("value1", c.get(1));
+        assertEquals("value2", c.get(2));
+
+        svc.evictAll();
+
+        assertEquals(0, c.size());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testDynamicCache() throws Exception {
+        for (int i = 0; i < 3; i++) {
+            assertEquals("value" + i, dynamicSvc.cacheable(i));
+            assertEquals("value" + i, dynamicSvc.cacheable(i));
+        }
+
+        assertEquals(3, dynamicSvc.called());
+
+        IgniteCache<Integer, String> c = grid().cache(DYNAMIC_CACHE_NAME);
+
+        // Check that correct config is used.
+        assertEquals(2, c.getConfiguration(CacheConfiguration.class).getBackups());
+
+        assertEquals(3, c.size());
+
+        for (int i = 0; i < 3; i++)
+            assertEquals("value" + i, c.get(i));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testDynamicCachePut() throws Exception {
+        for (int i = 0; i < 3; i++) {
+            assertEquals("value" + i, dynamicSvc.cachePut(i));
+            assertEquals("value" + i, dynamicSvc.cachePut(i));
+        }
+
+        assertEquals(6, dynamicSvc.called());
+
+        IgniteCache<Integer, String> c = grid().cache(DYNAMIC_CACHE_NAME);
+
+        // Check that correct config is used.
+        assertEquals(2, c.getConfiguration(CacheConfiguration.class).getBackups());
+
+        assertEquals(3, c.size());
+
+        for (int i = 0; i < 3; i++)
+            assertEquals("value" + i, c.get(i));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testDynamicCacheEvict() throws Exception {
+        CacheConfiguration<Integer, String> cacheCfg = new CacheConfiguration<>();
+
+        cacheCfg.setName(DYNAMIC_CACHE_NAME);
+
+        IgniteCache<Integer, String> c = grid().createCache(cacheCfg);
+
+        for (int i = 0; i < 3; i++)
+            c.put(i, "value" + i);
+
+        assertEquals(3, c.size());
+
+        for (int i = 0; i < 2; i++) {
+            dynamicSvc.cacheEvict(i);
+            dynamicSvc.cacheEvict(i);
+        }
+
+        assertEquals(4, dynamicSvc.called());
+
+        assertEquals(1, c.size());
+
+        assertEquals("value2", c.get(2));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testDynamicCacheEvictAll() throws Exception {
+        CacheConfiguration<Integer, String> cacheCfg = new CacheConfiguration<>();
+
+        cacheCfg.setName(DYNAMIC_CACHE_NAME);
+
+        IgniteCache<Integer, String> c = grid().createCache(cacheCfg);
+
+        for (int i = 0; i < 3; i++)
+            c.put(i, "value" + i);
+
+        assertEquals(3, c.size());
+
+        dynamicSvc.cacheEvictAll();
+        dynamicSvc.cacheEvictAll();
+
+        assertEquals(2, dynamicSvc.called());
+
+        assertEquals(0, c.size());
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/00f47d78/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheTestKey.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheTestKey.java b/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheTestKey.java
new file mode 100644
index 0000000..3f55112
--- /dev/null
+++ b/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheTestKey.java
@@ -0,0 +1,61 @@
+/*
+ * 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.cache.spring;
+
+import java.io.Serializable;
+
+/**
+ * Complex key.
+ */
+public class GridSpringCacheTestKey implements Serializable {
+    /** */
+    private final Integer p1;
+
+    /** */
+    private final String p2;
+
+    /**
+     * @param p1 Parameter 1.
+     * @param p2 Parameter 2.
+     */
+    public GridSpringCacheTestKey(Integer p1, String p2) {
+        assert p1 != null;
+        assert p2 != null;
+
+        this.p1 = p1;
+        this.p2 = p2;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        GridSpringCacheTestKey key = (GridSpringCacheTestKey)o;
+
+        return p1.equals(key.p1) && p2.equals(key.p2);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        return 31 * p1 + p2.hashCode();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/00f47d78/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheTestKeyGenerator.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheTestKeyGenerator.java b/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheTestKeyGenerator.java
new file mode 100644
index 0000000..7bab6cb
--- /dev/null
+++ b/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheTestKeyGenerator.java
@@ -0,0 +1,40 @@
+/*
+ * 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.cache.spring;
+
+import java.lang.reflect.Method;
+import org.springframework.cache.interceptor.KeyGenerator;
+
+/**
+ * Key generator.
+ */
+public class GridSpringCacheTestKeyGenerator implements KeyGenerator {
+    /** {@inheritDoc} */
+    @Override public Object generate(Object target, Method mtd, Object... params) {
+        assert params != null;
+        assert params.length > 0;
+
+        if (params.length == 1)
+            return params[0];
+        else {
+            assert params.length == 2;
+
+            return new GridSpringCacheTestKey((Integer)params[0], (String)params[1]);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/00f47d78/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheTestService.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheTestService.java b/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheTestService.java
new file mode 100644
index 0000000..544997d
--- /dev/null
+++ b/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheTestService.java
@@ -0,0 +1,181 @@
+/*
+ * 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.cache.spring;
+
+import java.util.concurrent.atomic.AtomicInteger;
+import org.springframework.cache.annotation.CacheEvict;
+import org.springframework.cache.annotation.CachePut;
+import org.springframework.cache.annotation.Cacheable;
+
+/**
+ * Test service.
+ */
+public class GridSpringCacheTestService {
+    /** */
+    private final AtomicInteger cnt = new AtomicInteger();
+
+    /**
+     * @return How many times service was called.
+     */
+    public int called() {
+        return cnt.get();
+    }
+
+    /**
+     * Resets service.
+     */
+    public void reset() {
+        cnt.set(0);
+    }
+
+    /**
+     * @param key Key.
+     * @return Value.
+     */
+    @Cacheable("testCache")
+    public String simpleKey(Integer key) {
+        assert key != null;
+
+        cnt.incrementAndGet();
+
+        return "value" + key;
+    }
+
+    /**
+     * @param key Key.
+     * @return Value.
+     */
+    @Cacheable("testCache")
+    public String simpleKeyNullValue(Integer key) {
+        assert key != null;
+
+        cnt.incrementAndGet();
+
+        return null;
+    }
+
+    /**
+     * @param p1 Parameter 1.
+     * @param p2 Parameter 2.
+     * @return Value.
+     */
+    @Cacheable("testCache")
+    public String complexKey(Integer p1, String p2) {
+        assert p1 != null;
+        assert p2 != null;
+
+        cnt.incrementAndGet();
+
+        return "value" + p1 + p2;
+    }
+
+    /**
+     * @param p1 Parameter 1.
+     * @param p2 Parameter 2.
+     * @return Value.
+     */
+    @Cacheable("testCache")
+    public String complexKeyNullValue(Integer p1, String p2) {
+        assert p1 != null;
+        assert p2 != null;
+
+        cnt.incrementAndGet();
+
+        return null;
+    }
+
+    /**
+     * @param key Key.
+     * @return Value.
+     */
+    @CachePut("testCache")
+    public String simpleKeyPut(Integer key) {
+        assert key != null;
+
+        int cnt0 = cnt.incrementAndGet();
+
+        return "value" + key + (cnt0 % 2 == 0 ? "even" : "odd");
+    }
+
+    /**
+     * @param key Key.
+     * @return Value.
+     */
+    @CachePut("testCache")
+    public String simpleKeyPutNullValue(Integer key) {
+        assert key != null;
+
+        cnt.incrementAndGet();
+
+        return null;
+    }
+
+    /**
+     * @param p1 Parameter 1.
+     * @param p2 Parameter 2.
+     * @return Value.
+     */
+    @CachePut("testCache")
+    public String complexKeyPut(Integer p1, String p2) {
+        assert p1 != null;
+        assert p2 != null;
+
+        int cnt0 = cnt.incrementAndGet();
+
+        return "value" + p1 + p2 + (cnt0 % 2 == 0 ? "even" : "odd");
+    }
+
+    /**
+     * @param p1 Parameter 1.
+     * @param p2 Parameter 2.
+     * @return Value.
+     */
+    @CachePut("testCache")
+    public String complexKeyPutNullValue(Integer p1, String p2) {
+        assert p1 != null;
+        assert p2 != null;
+
+        cnt.incrementAndGet();
+
+        return null;
+    }
+
+    /**
+     * @param key Key.
+     */
+    @CacheEvict("testCache")
+    public void simpleKeyEvict(Integer key) {
+        // No-op.
+    }
+
+    /**
+     * @param p1 Parameter 1.
+     * @param p2 Parameter 2.
+     */
+    @CacheEvict("testCache")
+    public void complexKeyEvict(Integer p1, String p2) {
+        // No-op.
+    }
+
+    /**
+     */
+    @CacheEvict(value = "testCache", allEntries = true)
+    public void evictAll() {
+        // No-op.
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/00f47d78/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringDynamicCacheTestService.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringDynamicCacheTestService.java b/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringDynamicCacheTestService.java
new file mode 100644
index 0000000..6584277
--- /dev/null
+++ b/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringDynamicCacheTestService.java
@@ -0,0 +1,85 @@
+/*
+ * 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.cache.spring;
+
+import java.util.concurrent.atomic.AtomicInteger;
+import org.springframework.cache.annotation.CacheEvict;
+import org.springframework.cache.annotation.CachePut;
+import org.springframework.cache.annotation.Cacheable;
+
+/**
+ * Test service.
+ */
+public class GridSpringDynamicCacheTestService {
+    /** */
+    private final AtomicInteger cnt = new AtomicInteger();
+
+    /**
+     * @param key Key.
+     * @return Value.
+     */
+    @Cacheable("dynamicCache")
+    public String cacheable(Integer key) {
+        assert key != null;
+
+        cnt.incrementAndGet();
+
+        return "value" + key;
+    }
+
+    /**
+     * @param key Key.
+     * @return Value.
+     */
+    @CachePut("dynamicCache")
+    public String cachePut(Integer key) {
+        assert key != null;
+
+        cnt.incrementAndGet();
+
+        return "value" + key;
+    }
+
+    /**
+     * @param key Key.
+     */
+    @CacheEvict("dynamicCache")
+    public void cacheEvict(Integer key) {
+        cnt.incrementAndGet();
+    }
+
+    /**
+     */
+    @CacheEvict(value = "dynamicCache", allEntries = true)
+    public void cacheEvictAll() {
+        cnt.incrementAndGet();
+    }
+
+    /**
+     * @return Calls count.
+     */
+    public int called() {
+        return cnt.get();
+    }
+
+    /**
+     */
+    public void reset() {
+        cnt.set(0);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/00f47d78/modules/spring/src/test/java/org/apache/ignite/cache/spring/SpringCacheManagerContextInjectionTest.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/cache/spring/SpringCacheManagerContextInjectionTest.java b/modules/spring/src/test/java/org/apache/ignite/cache/spring/SpringCacheManagerContextInjectionTest.java
new file mode 100644
index 0000000..0a898b6
--- /dev/null
+++ b/modules/spring/src/test/java/org/apache/ignite/cache/spring/SpringCacheManagerContextInjectionTest.java
@@ -0,0 +1,125 @@
+/*
+ *  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.cache.spring;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.TestInjectionLifecycleBean;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgnitionEx;
+import org.apache.ignite.lifecycle.LifecycleBean;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.springframework.beans.factory.BeanFactory;
+import org.springframework.context.annotation.AnnotationConfigApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ *
+ */
+public class SpringCacheManagerContextInjectionTest extends GridCommonAbstractTest {
+    /**
+     * @throws Exception If failed.
+     */
+    public void testBeanInjectionUsingConfigPath() throws Exception {
+        new AnnotationConfigApplicationContext(TestPathConfiguration.class);
+
+        Ignite grid = IgnitionEx.grid("springInjectionTest");
+
+        IgniteConfiguration cfg = grid.configuration();
+
+        LifecycleBean[] beans = cfg.getLifecycleBeans();
+
+        assertEquals(2, beans.length);
+
+        TestInjectionLifecycleBean bean1 = (TestInjectionLifecycleBean)beans[0];
+        TestInjectionLifecycleBean bean2 = (TestInjectionLifecycleBean)beans[1];
+
+        bean1.checkState();
+        bean2.checkState();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testBeanInjectionUsingConfiguration() throws Exception {
+        BeanFactory factory = new AnnotationConfigApplicationContext(TestCfgConfiguration.class);
+
+        TestInjectionLifecycleBean bean1 = (TestInjectionLifecycleBean)factory.getBean("bean1");
+        TestInjectionLifecycleBean bean2 = (TestInjectionLifecycleBean)factory.getBean("bean2");
+
+        bean1.checkState();
+        bean2.checkState();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids();
+
+        super.afterTest();
+    }
+
+    /** */
+    @SuppressWarnings("WeakerAccess")
+    @Configuration
+    static class TestPathConfiguration {
+        /** */
+        @Bean(name = "mgr")
+        public SpringCacheManager springCacheManager() {
+            SpringCacheManager mgr = new SpringCacheManager();
+
+            mgr.setConfigurationPath("org/apache/ignite/spring-injection-test.xml");
+
+            return mgr;
+        }
+    }
+
+    /** */
+    @SuppressWarnings("WeakerAccess")
+    @Configuration
+    static class TestCfgConfiguration {
+        /** */
+        @Bean(name = "mgr")
+        public SpringCacheManager springCacheManager() {
+            IgniteConfiguration cfg = new IgniteConfiguration();
+
+            cfg.setLocalHost("127.0.0.1");
+
+            cfg.setGridName("scmt");
+
+            cfg.setLifecycleBeans(bean1(), bean2());
+
+            SpringCacheManager mgr = new SpringCacheManager();
+
+            mgr.setConfiguration(cfg);
+
+            return mgr;
+        }
+
+        /** */
+        @Bean(name = "bean1")
+        LifecycleBean bean1() {
+            return new TestInjectionLifecycleBean();
+        }
+
+        /** */
+        @Bean(name = "bean2")
+        LifecycleBean bean2() {
+            return new TestInjectionLifecycleBean();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/00f47d78/modules/spring/src/test/java/org/apache/ignite/cache/spring/spring-caching.xml
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/cache/spring/spring-caching.xml b/modules/spring/src/test/java/org/apache/ignite/cache/spring/spring-caching.xml
new file mode 100644
index 0000000..355f6e0
--- /dev/null
+++ b/modules/spring/src/test/java/org/apache/ignite/cache/spring/spring-caching.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:cache="http://www.springframework.org/schema/cache"
+       xsi:schemaLocation="
+        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+        http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd">
+    <!--
+        Test service with cacheable methods.
+    -->
+    <bean id="testService" class="org.apache.ignite.cache.spring.GridSpringCacheTestService"/>
+
+    <!--
+        Test service with cacheable methods (dynamic cache).
+    -->
+    <bean id="dynamicTestService" class="org.apache.ignite.cache.spring.GridSpringDynamicCacheTestService"/>
+
+    <!--
+        Cache manager.
+    -->
+    <bean id="cacheManager" class="org.apache.ignite.cache.spring.SpringCacheManager">
+        <property name="gridName" value="testGrid"/>
+        <property name="dynamicCacheConfiguration">
+            <bean class="org.apache.ignite.configuration.CacheConfiguration">
+                <property name="backups" value="2"/>
+            </bean>
+        </property>
+    </bean>
+
+    <!--
+        Key generator.
+    -->
+    <bean id="keyGenerator" class="org.apache.ignite.cache.spring.GridSpringCacheTestKeyGenerator"/>
+
+    <!--
+        Enable annotation-driver configuration for caching.
+    -->
+    <cache:annotation-driven key-generator="keyGenerator"/>
+</beans>

http://git-wip-us.apache.org/repos/asf/ignite/blob/00f47d78/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheManagerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheManagerSelfTest.java b/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheManagerSelfTest.java
deleted file mode 100644
index 0293e66..0000000
--- a/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheManagerSelfTest.java
+++ /dev/null
@@ -1,342 +0,0 @@
-/*
- * 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.spring;
-
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.springframework.beans.factory.BeanFactory;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-/**
- * Spring cache test.
- */
-public class GridSpringCacheManagerSelfTest extends GridCommonAbstractTest {
-    /** */
-    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
-    /** */
-    private static final String CACHE_NAME = "testCache";
-
-    /** */
-    private static final String DYNAMIC_CACHE_NAME = "dynamicCache";
-
-    /** */
-    private GridSpringCacheTestService svc;
-
-    /** */
-    private GridSpringDynamicCacheTestService dynamicSvc;
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        CacheConfiguration cache = new CacheConfiguration();
-
-        cache.setName(CACHE_NAME);
-
-        cfg.setCacheConfiguration(cache);
-
-        TcpDiscoverySpi disco = new TcpDiscoverySpi();
-
-        disco.setIpFinder(IP_FINDER);
-
-        cfg.setDiscoverySpi(disco);
-
-        return cfg;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String getTestGridName() {
-        return "testGrid";
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        startGrid();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        stopAllGrids();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        BeanFactory factory = new ClassPathXmlApplicationContext("org/apache/ignite/spring/spring-caching.xml");
-
-        svc = (GridSpringCacheTestService)factory.getBean("testService");
-        dynamicSvc = (GridSpringDynamicCacheTestService)factory.getBean("dynamicTestService");
-
-        svc.reset();
-        dynamicSvc.reset();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        grid().cache(CACHE_NAME).removeAll();
-
-        grid().destroyCache(DYNAMIC_CACHE_NAME);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testSimpleKey() throws Exception {
-        for (int i = 0; i < 3; i++) {
-            assertEquals("value" + i, svc.simpleKey(i));
-            assertEquals("value" + i, svc.simpleKey(i));
-        }
-
-        assertEquals(3, svc.called());
-
-        IgniteCache<Integer, String> c = grid().cache(CACHE_NAME);
-
-        assertEquals(3, c.size());
-
-        for (int i = 0; i < 3; i++)
-            assertEquals("value" + i, c.get(i));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testComplexKey() throws Exception {
-        for (int i = 0; i < 3; i++) {
-            assertEquals("value" + i + "suffix" + i, svc.complexKey(i, "suffix" + i));
-            assertEquals("value" + i + "suffix" + i, svc.complexKey(i, "suffix" + i));
-        }
-
-        assertEquals(3, svc.called());
-
-        IgniteCache<GridSpringCacheTestKey, String> c = grid().cache(CACHE_NAME);
-
-        assertEquals(3, c.size());
-
-        for (int i = 0; i < 3; i++)
-            assertEquals("value" + i + "suffix" + i, c.get(new GridSpringCacheTestKey(i, "suffix" + i)));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testSimpleKeyPut() throws Exception {
-        IgniteCache<Integer, String> c = grid().cache(CACHE_NAME);
-
-        for (int i = 0; i < 3; i++) {
-            assertEquals("value" + i + "odd", svc.simpleKeyPut(i));
-
-            assertEquals(i + 1, c.size());
-            assertEquals("value" + i + "odd", c.get(i));
-
-            assertEquals("value" + i + "even", svc.simpleKeyPut(i));
-
-            assertEquals(i + 1, c.size());
-            assertEquals("value" + i + "even", c.get(i));
-        }
-
-        assertEquals(6, svc.called());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testComplexKeyPut() throws Exception {
-        IgniteCache<GridSpringCacheTestKey, String> c = grid().cache(CACHE_NAME);
-
-        for (int i = 0; i < 3; i++) {
-            assertEquals("value" + i + "suffix" + i + "odd", svc.complexKeyPut(i, "suffix" + i));
-
-            assertEquals(i + 1, c.size());
-            assertEquals("value" + i + "suffix" + i + "odd", c.get(new GridSpringCacheTestKey(i, "suffix" + i)));
-
-            assertEquals("value" + i + "suffix" + i + "even", svc.complexKeyPut(i, "suffix" + i));
-
-            assertEquals(i + 1, c.size());
-            assertEquals("value" + i + "suffix" + i + "even", c.get(new GridSpringCacheTestKey(i, "suffix" + i)));
-        }
-
-        assertEquals(6, svc.called());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testSimpleKeyEvict() throws Exception {
-        IgniteCache<Integer, String> c = grid().cache(CACHE_NAME);
-
-        for (int i = 0; i < 3; i++)
-            c.put(i, "value" + i);
-
-        assertEquals(3, c.size());
-
-        assertEquals("value0", c.get(0));
-        assertEquals("value1", c.get(1));
-        assertEquals("value2", c.get(2));
-
-        svc.simpleKeyEvict(2);
-
-        assertEquals(2, c.size());
-
-        assertEquals("value0", c.get(0));
-        assertEquals("value1", c.get(1));
-        assertNull(c.get(2));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testComplexKeyEvict() throws Exception {
-        IgniteCache<GridSpringCacheTestKey, String> c = grid().cache(CACHE_NAME);
-
-        for (int i = 0; i < 3; i++)
-            c.put(new GridSpringCacheTestKey(i, "suffix" + i), "value" + i);
-
-        assertEquals(3, c.size());
-
-        assertEquals("value0", c.get(new GridSpringCacheTestKey(0, "suffix" + 0)));
-        assertEquals("value1", c.get(new GridSpringCacheTestKey(1, "suffix" + 1)));
-        assertEquals("value2", c.get(new GridSpringCacheTestKey(2, "suffix" + 2)));
-
-        svc.complexKeyEvict(2, "suffix" + 2);
-
-        assertEquals(2, c.size());
-
-        assertEquals("value0", c.get(new GridSpringCacheTestKey(0, "suffix" + 0)));
-        assertEquals("value1", c.get(new GridSpringCacheTestKey(1, "suffix" + 1)));
-        assertNull(c.get(new GridSpringCacheTestKey(2, "suffix" + 2)));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testEvictAll() throws Exception {
-        IgniteCache<Integer, String> c = grid().cache(CACHE_NAME);
-
-        for (int i = 0; i < 3; i++)
-            c.put(i, "value" + i);
-
-        assertEquals(3, c.size());
-
-        assertEquals("value0", c.get(0));
-        assertEquals("value1", c.get(1));
-        assertEquals("value2", c.get(2));
-
-        svc.evictAll();
-
-        assertEquals(0, c.size());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDynamicCache() throws Exception {
-        for (int i = 0; i < 3; i++) {
-            assertEquals("value" + i, dynamicSvc.cacheable(i));
-            assertEquals("value" + i, dynamicSvc.cacheable(i));
-        }
-
-        assertEquals(3, dynamicSvc.called());
-
-        IgniteCache<Integer, String> c = grid().cache(DYNAMIC_CACHE_NAME);
-
-        // Check that correct config is used.
-        assertEquals(2, c.getConfiguration(CacheConfiguration.class).getBackups());
-
-        assertEquals(3, c.size());
-
-        for (int i = 0; i < 3; i++)
-            assertEquals("value" + i, c.get(i));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDynamicCachePut() throws Exception {
-        for (int i = 0; i < 3; i++) {
-            assertEquals("value" + i, dynamicSvc.cachePut(i));
-            assertEquals("value" + i, dynamicSvc.cachePut(i));
-        }
-
-        assertEquals(6, dynamicSvc.called());
-
-        IgniteCache<Integer, String> c = grid().cache(DYNAMIC_CACHE_NAME);
-
-        // Check that correct config is used.
-        assertEquals(2, c.getConfiguration(CacheConfiguration.class).getBackups());
-
-        assertEquals(3, c.size());
-
-        for (int i = 0; i < 3; i++)
-            assertEquals("value" + i, c.get(i));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDynamicCacheEvict() throws Exception {
-        CacheConfiguration<Integer, String> cacheCfg = new CacheConfiguration<>();
-
-        cacheCfg.setName(DYNAMIC_CACHE_NAME);
-
-        IgniteCache<Integer, String> c = grid().createCache(cacheCfg);
-
-        for (int i = 0; i < 3; i++)
-            c.put(i, "value" + i);
-
-        assertEquals(3, c.size());
-
-        for (int i = 0; i < 2; i++) {
-            dynamicSvc.cacheEvict(i);
-            dynamicSvc.cacheEvict(i);
-        }
-
-        assertEquals(4, dynamicSvc.called());
-
-        assertEquals(1, c.size());
-
-        assertEquals("value2", c.get(2));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDynamicCacheEvictAll() throws Exception {
-        CacheConfiguration<Integer, String> cacheCfg = new CacheConfiguration<>();
-
-        cacheCfg.setName(DYNAMIC_CACHE_NAME);
-
-        IgniteCache<Integer, String> c = grid().createCache(cacheCfg);
-
-        for (int i = 0; i < 3; i++)
-            c.put(i, "value" + i);
-
-        assertEquals(3, c.size());
-
-        dynamicSvc.cacheEvictAll();
-        dynamicSvc.cacheEvictAll();
-
-        assertEquals(2, dynamicSvc.called());
-
-        assertEquals(0, c.size());
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/00f47d78/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheTestKey.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheTestKey.java b/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheTestKey.java
deleted file mode 100644
index c54fa82..0000000
--- a/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheTestKey.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.spring;
-
-import java.io.Serializable;
-
-/**
- * Complex key.
- */
-public class GridSpringCacheTestKey implements Serializable {
-    /** */
-    private final Integer p1;
-
-    /** */
-    private final String p2;
-
-    /**
-     * @param p1 Parameter 1.
-     * @param p2 Parameter 2.
-     */
-    public GridSpringCacheTestKey(Integer p1, String p2) {
-        assert p1 != null;
-        assert p2 != null;
-
-        this.p1 = p1;
-        this.p2 = p2;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean equals(Object o) {
-        if (this == o)
-            return true;
-
-        if (o == null || getClass() != o.getClass())
-            return false;
-
-        GridSpringCacheTestKey key = (GridSpringCacheTestKey)o;
-
-        return p1.equals(key.p1) && p2.equals(key.p2);
-    }
-
-    /** {@inheritDoc} */
-    @Override public int hashCode() {
-        return 31 * p1 + p2.hashCode();
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/00f47d78/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheTestKeyGenerator.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheTestKeyGenerator.java b/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheTestKeyGenerator.java
deleted file mode 100644
index 4585ceb..0000000
--- a/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheTestKeyGenerator.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.spring;
-
-import java.lang.reflect.Method;
-import org.springframework.cache.interceptor.KeyGenerator;
-
-/**
- * Key generator.
- */
-public class GridSpringCacheTestKeyGenerator implements KeyGenerator {
-    /** {@inheritDoc} */
-    @Override public Object generate(Object target, Method mtd, Object... params) {
-        assert params != null;
-        assert params.length > 0;
-
-        if (params.length == 1)
-            return params[0];
-        else {
-            assert params.length == 2;
-
-            return new GridSpringCacheTestKey((Integer)params[0], (String)params[1]);
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/00f47d78/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheTestService.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheTestService.java b/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheTestService.java
deleted file mode 100644
index c528650..0000000
--- a/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheTestService.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * 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.spring;
-
-import java.util.concurrent.atomic.AtomicInteger;
-import org.springframework.cache.annotation.CacheEvict;
-import org.springframework.cache.annotation.CachePut;
-import org.springframework.cache.annotation.Cacheable;
-
-/**
- * Test service.
- */
-public class GridSpringCacheTestService {
-    /** */
-    private final AtomicInteger cnt = new AtomicInteger();
-
-    /**
-     * @return How many times service was called.
-     */
-    public int called() {
-        return cnt.get();
-    }
-
-    /**
-     * Resets service.
-     */
-    public void reset() {
-        cnt.set(0);
-    }
-
-    /**
-     * @param key Key.
-     * @return Value.
-     */
-    @Cacheable("testCache")
-    public String simpleKey(Integer key) {
-        assert key != null;
-
-        cnt.incrementAndGet();
-
-        return "value" + key;
-    }
-
-    /**
-     * @param p1 Parameter 1.
-     * @param p2 Parameter 2.
-     * @return Value.
-     */
-    @Cacheable("testCache")
-    public String complexKey(Integer p1, String p2) {
-        assert p1 != null;
-        assert p2 != null;
-
-        cnt.incrementAndGet();
-
-        return "value" + p1 + p2;
-    }
-
-    /**
-     * @param key Key.
-     * @return Value.
-     */
-    @CachePut("testCache")
-    public String simpleKeyPut(Integer key) {
-        assert key != null;
-
-        int cnt0 = cnt.incrementAndGet();
-
-        return "value" + key + (cnt0 % 2 == 0 ? "even" : "odd");
-    }
-
-    /**
-     * @param p1 Parameter 1.
-     * @param p2 Parameter 2.
-     * @return Value.
-     */
-    @CachePut("testCache")
-    public String complexKeyPut(Integer p1, String p2) {
-        assert p1 != null;
-        assert p2 != null;
-
-        int cnt0 = cnt.incrementAndGet();
-
-        return "value" + p1 + p2 + (cnt0 % 2 == 0 ? "even" : "odd");
-    }
-
-    /**
-     * @param key Key.
-     */
-    @CacheEvict("testCache")
-    public void simpleKeyEvict(Integer key) {
-        // No-op.
-    }
-
-    /**
-     * @param p1 Parameter 1.
-     * @param p2 Parameter 2.
-     */
-    @CacheEvict("testCache")
-    public void complexKeyEvict(Integer p1, String p2) {
-        // No-op.
-    }
-
-    /**
-     */
-    @CacheEvict(value = "testCache", allEntries = true)
-    public void evictAll() {
-        // No-op.
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/00f47d78/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringDynamicCacheTestService.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringDynamicCacheTestService.java b/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringDynamicCacheTestService.java
deleted file mode 100644
index 510d24d..0000000
--- a/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringDynamicCacheTestService.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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.spring;
-
-import java.util.concurrent.atomic.AtomicInteger;
-import org.springframework.cache.annotation.CacheEvict;
-import org.springframework.cache.annotation.CachePut;
-import org.springframework.cache.annotation.Cacheable;
-
-/**
- * Test service.
- */
-public class GridSpringDynamicCacheTestService {
-    /** */
-    private final AtomicInteger cnt = new AtomicInteger();
-
-    /**
-     * @param key Key.
-     * @return Value.
-     */
-    @Cacheable("dynamicCache")
-    public String cacheable(Integer key) {
-        assert key != null;
-
-        cnt.incrementAndGet();
-
-        return "value" + key;
-    }
-
-    /**
-     * @param key Key.
-     * @return Value.
-     */
-    @CachePut("dynamicCache")
-    public String cachePut(Integer key) {
-        assert key != null;
-
-        cnt.incrementAndGet();
-
-        return "value" + key;
-    }
-
-    /**
-     * @param key Key.
-     */
-    @CacheEvict("dynamicCache")
-    public void cacheEvict(Integer key) {
-        cnt.incrementAndGet();
-    }
-
-    /**
-     */
-    @CacheEvict(value = "dynamicCache", allEntries = true)
-    public void cacheEvictAll() {
-        cnt.incrementAndGet();
-    }
-
-    /**
-     * @return Calls count.
-     */
-    public int called() {
-        return cnt.get();
-    }
-
-    /**
-     */
-    public void reset() {
-        cnt.set(0);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/00f47d78/modules/spring/src/test/java/org/apache/ignite/spring/SpringCacheManagerContextInjectionTest.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/spring/SpringCacheManagerContextInjectionTest.java b/modules/spring/src/test/java/org/apache/ignite/spring/SpringCacheManagerContextInjectionTest.java
deleted file mode 100644
index 1554198..0000000
--- a/modules/spring/src/test/java/org/apache/ignite/spring/SpringCacheManagerContextInjectionTest.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- *  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.spring;
-
-import org.apache.ignite.Ignite;
-import org.apache.ignite.TestInjectionLifecycleBean;
-import org.apache.ignite.cache.spring.SpringCacheManager;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.IgnitionEx;
-import org.apache.ignite.lifecycle.LifecycleBean;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.springframework.beans.factory.BeanFactory;
-import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-/**
- *
- */
-public class SpringCacheManagerContextInjectionTest extends GridCommonAbstractTest {
-    /**
-     * @throws Exception If failed.
-     */
-    public void testBeanInjectionUsingConfigPath() throws Exception {
-        new AnnotationConfigApplicationContext(TestPathConfiguration.class);
-
-        Ignite grid = IgnitionEx.grid("springInjectionTest");
-
-        IgniteConfiguration cfg = grid.configuration();
-
-        LifecycleBean[] beans = cfg.getLifecycleBeans();
-
-        assertEquals(2, beans.length);
-
-        TestInjectionLifecycleBean bean1 = (TestInjectionLifecycleBean)beans[0];
-        TestInjectionLifecycleBean bean2 = (TestInjectionLifecycleBean)beans[1];
-
-        bean1.checkState();
-        bean2.checkState();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testBeanInjectionUsingConfiguration() throws Exception {
-        BeanFactory factory = new AnnotationConfigApplicationContext(TestCfgConfiguration.class);
-
-        TestInjectionLifecycleBean bean1 = (TestInjectionLifecycleBean)factory.getBean("bean1");
-        TestInjectionLifecycleBean bean2 = (TestInjectionLifecycleBean)factory.getBean("bean2");
-
-        bean1.checkState();
-        bean2.checkState();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        stopAllGrids();
-
-        super.afterTest();
-    }
-
-    /** */
-    @SuppressWarnings("WeakerAccess")
-    @Configuration
-    static class TestPathConfiguration {
-        /** */
-        @Bean(name = "mgr")
-        public SpringCacheManager springCacheManager() {
-            SpringCacheManager mgr = new SpringCacheManager();
-
-            mgr.setConfigurationPath("org/apache/ignite/spring-injection-test.xml");
-
-            return mgr;
-        }
-    }
-
-    /** */
-    @SuppressWarnings("WeakerAccess")
-    @Configuration
-    static class TestCfgConfiguration {
-        /** */
-        @Bean(name = "mgr")
-        public SpringCacheManager springCacheManager() {
-            IgniteConfiguration cfg = new IgniteConfiguration();
-
-            cfg.setLocalHost("127.0.0.1");
-
-            cfg.setGridName("scmt");
-
-            cfg.setLifecycleBeans(bean1(), bean2());
-
-            SpringCacheManager mgr = new SpringCacheManager();
-
-            mgr.setConfiguration(cfg);
-
-            return mgr;
-        }
-
-        /** */
-        @Bean(name = "bean1")
-        LifecycleBean bean1() {
-            return new TestInjectionLifecycleBean();
-        }
-
-        /** */
-        @Bean(name = "bean2")
-        LifecycleBean bean2() {
-            return new TestInjectionLifecycleBean();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/00f47d78/modules/spring/src/test/java/org/apache/ignite/spring/spring-caching.xml
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/spring/spring-caching.xml b/modules/spring/src/test/java/org/apache/ignite/spring/spring-caching.xml
deleted file mode 100644
index 784cf01..0000000
--- a/modules/spring/src/test/java/org/apache/ignite/spring/spring-caching.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xmlns:cache="http://www.springframework.org/schema/cache"
-       xsi:schemaLocation="
-        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
-        http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd">
-    <!--
-        Test service with cacheable methods.
-    -->
-    <bean id="testService" class="org.apache.ignite.spring.GridSpringCacheTestService"/>
-
-    <!--
-        Test service with cacheable methods (dynamic cache).
-    -->
-    <bean id="dynamicTestService" class="org.apache.ignite.spring.GridSpringDynamicCacheTestService"/>
-
-    <!--
-        Cache manager.
-    -->
-    <bean id="cacheManager" class="org.apache.ignite.cache.spring.SpringCacheManager">
-        <property name="gridName" value="testGrid"/>
-        <property name="dynamicCacheConfiguration">
-            <bean class="org.apache.ignite.configuration.CacheConfiguration">
-                <property name="backups" value="2"/>
-            </bean>
-        </property>
-    </bean>
-
-    <!--
-        Key generator.
-    -->
-    <bean id="keyGenerator" class="org.apache.ignite.spring.GridSpringCacheTestKeyGenerator"/>
-
-    <!--
-        Enable annotation-driver configuration for caching.
-    -->
-    <cache:annotation-driven key-generator="keyGenerator"/>
-</beans>

http://git-wip-us.apache.org/repos/asf/ignite/blob/00f47d78/modules/spring/src/test/java/org/apache/ignite/testsuites/IgniteSpringTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/testsuites/IgniteSpringTestSuite.java b/modules/spring/src/test/java/org/apache/ignite/testsuites/IgniteSpringTestSuite.java
index 9ae3423..cd5645d 100644
--- a/modules/spring/src/test/java/org/apache/ignite/testsuites/IgniteSpringTestSuite.java
+++ b/modules/spring/src/test/java/org/apache/ignite/testsuites/IgniteSpringTestSuite.java
@@ -25,10 +25,10 @@ import org.apache.ignite.internal.GridFactorySelfTest;
 import org.apache.ignite.internal.GridSpringBeanSerializationSelfTest;
 import org.apache.ignite.internal.IgniteDynamicCacheConfigTest;
 import org.apache.ignite.p2p.GridP2PUserVersionChangeSelfTest;
-import org.apache.ignite.spring.GridSpringCacheManagerSelfTest;
+import org.apache.ignite.cache.spring.GridSpringCacheManagerSelfTest;
 import org.apache.ignite.spring.IgniteExcludeInConfigurationTest;
 import org.apache.ignite.spring.IgniteStartFromStreamConfigurationTest;
-import org.apache.ignite.spring.SpringCacheManagerContextInjectionTest;
+import org.apache.ignite.cache.spring.SpringCacheManagerContextInjectionTest;
 import org.apache.ignite.spring.injection.GridServiceInjectionSpringResourceTest;
 import org.apache.ignite.transactions.spring.GridSpringTransactionManagerSelfTest;
 import org.apache.ignite.transactions.spring.SpringTransactionManagerContextInjectionTest;


[06/19] ignite git commit: IGNITE-2310 Lock cache partition for affinityRun/affinityCall execution

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunTest.java
new file mode 100644
index 0000000..168b25c
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunTest.java
@@ -0,0 +1,852 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cache.query.ScanQuery;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.cache.query.SqlQuery;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.compute.ComputeJobMasterLeaveAware;
+import org.apache.ignite.compute.ComputeTaskSession;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
+import org.apache.ignite.lang.IgniteBiPredicate;
+import org.apache.ignite.lang.IgniteCallable;
+import org.apache.ignite.lang.IgniteRunnable;
+import org.apache.ignite.resources.IgniteInstanceResource;
+import org.apache.ignite.resources.LoggerResource;
+import org.apache.ignite.testframework.GridTestUtils;
+
+/**
+ * Test to validate https://issues.apache.org/jira/browse/IGNITE-2310
+ */
+public class IgniteCacheLockPartitionOnAffinityRunTest extends IgniteCacheLockPartitionOnAffinityRunAbstractTest {
+    /**
+     * @param ignite Ignite.
+     * @param log Logger.
+     * @param orgId Organization id.
+     * @return Count of found Person object with specified orgId
+     * @throws Exception If failed.
+     */
+    private static int getPersonsCountFromPartitionMapCheckBothCaches(final IgniteEx ignite, IgniteLogger log,
+        int orgId) throws Exception {
+
+        assertEquals(1, getOrganizationCountFromPartitionMap(ignite, log, orgId));
+
+        return getPersonsCountFromPartitionMap(ignite, log, orgId);
+    }
+
+    /**
+     * @param ignite Ignite.
+     * @param log Logger.
+     * @param orgId Organization id.
+     * @return Count of found Person object with specified orgId
+     * @throws Exception If failed.
+     */
+    private static int getOrganizationCountFromPartitionMap(final IgniteEx ignite, IgniteLogger log,
+        int orgId) throws Exception {
+        int part = ignite.affinity(Organization.class.getSimpleName()).partition(orgId);
+
+        GridCacheAdapter<?, ?> cacheAdapterOrg = ignite.context().cache()
+            .internalCache(Organization.class.getSimpleName());
+
+        GridDhtLocalPartition pOrgs = cacheAdapterOrg.context().topology()
+            .localPartition(part, AffinityTopologyVersion.NONE, false);
+
+        int cnt = 0;
+        for (GridCacheMapEntry e : pOrgs.entries()) {
+            Integer k = (Integer)e.keyValue(false);
+            Organization org = e.val.value(ignite.context().cacheObjects().contextForCache(
+                cacheAdapterOrg.cacheCfg), false);
+
+            if (org != null && org.getId() == orgId)
+                ++cnt;
+        }
+
+        return cnt;
+    }
+
+    /**
+     * @param ignite Ignite.
+     * @param log Logger.
+     * @param orgId Organization id.
+     * @return Count of found Person object with specified orgId
+     * @throws Exception If failed.
+     */
+    private static int getPersonsCountFromPartitionMap(final IgniteEx ignite, IgniteLogger log, int orgId)
+        throws Exception {
+        int part = ignite.affinity(Organization.class.getSimpleName()).partition(orgId);
+
+        GridCacheAdapter<?, ?> cacheAdapterPers = ignite.context().cache()
+            .internalCache(Person.class.getSimpleName());
+
+        GridDhtLocalPartition pPers = cacheAdapterPers.context().topology()
+            .localPartition(part, AffinityTopologyVersion.NONE, false);
+
+        int cnt = 0;
+        for (GridCacheMapEntry e : pPers.entries()) {
+            Person.Key k = (Person.Key)e.keyValue(false);
+            Person p = e.val.value(ignite.context().cacheObjects().contextForCache(
+                cacheAdapterPers.cacheCfg), false);
+
+            if (p != null && p.getOrgId() == orgId && k.orgId == orgId)
+                ++cnt;
+        }
+
+        return cnt;
+    }
+
+    /**
+     * @param ignite Ignite.
+     * @param log Logger.
+     * @param orgId Organization id.
+     * @return Count of found Person object with specified orgId
+     */
+    private static int getPersonsCountBySqlFieldLocalQuery(final IgniteEx ignite, IgniteLogger log, int orgId) {
+        List res = ignite.cache(Person.class.getSimpleName())
+            .query(new SqlFieldsQuery(
+                String.format("SELECT p.id FROM \"%s\".Person as p " +
+                        "WHERE p.orgId = " + orgId,
+                    Person.class.getSimpleName())).setLocal(true))
+            .getAll();
+
+        return res.size();
+    }
+
+    /**
+     * @param ignite Ignite.
+     * @param log Logger.
+     * @param orgId Organization id.
+     * @return Count of found Person object with specified orgId
+     */
+    private static int getPersonsCountBySqlFieledLocalQueryJoinOrgs(final IgniteEx ignite, IgniteLogger log,
+        int orgId) {
+        List res = ignite.cache(Person.class.getSimpleName())
+            .query(new SqlFieldsQuery(
+                String.format("SELECT p.id FROM \"%s\".Person as p, \"%s\".Organization as o " +
+                        "WHERE p.orgId = o.id " +
+                        "AND p.orgId = " + orgId,
+                    Person.class.getSimpleName(),
+                    Organization.class.getSimpleName())).setLocal(true))
+            .getAll();
+
+        return res.size();
+    }
+
+    /**
+     * @param ignite Ignite.
+     * @param log Logger.
+     * @param orgId Organization id.
+     * @return Count of found Person object with specified orgId
+     */
+    private static int getPersonsCountBySqlLocalQuery(final IgniteEx ignite, IgniteLogger log, int orgId) {
+        List res = ignite.cache(Person.class.getSimpleName())
+            .query(new SqlQuery<Person.Key, Person>(Person.class, "orgId = ?").setArgs(orgId).setLocal(true))
+            .getAll();
+
+        return res.size();
+    }
+
+    /**
+     * @param ignite Ignite.
+     * @param log Logger.
+     * @param orgId Organization id.
+     * @return Count of found Person object with specified orgId
+     */
+    private static int getPersonsCountByScanLocalQuery(final IgniteEx ignite, IgniteLogger log, final int orgId) {
+        List res = ignite.cache(Person.class.getSimpleName())
+            .query(new ScanQuery<>(new IgniteBiPredicate<Person.Key, Person>() {
+                @Override public boolean apply(Person.Key key, Person person) {
+                    return person.getOrgId() == orgId;
+                }
+            }).setLocal(true)).getAll();
+
+        return res.size();
+    }
+
+    /**
+     * @param ignite Ignite.
+     * @param log Logger.
+     * @param orgId Organization id.
+     * @return Count of found Person object with specified orgId
+     * @throws Exception If failed.
+     */
+    private static int getPersonsCountSingleCache(final IgniteEx ignite, IgniteLogger log, final int orgId)
+        throws Exception {
+        int sqlCnt = getPersonsCountBySqlLocalQuery(ignite, log, orgId);
+        int sqlFieldCnt = getPersonsCountBySqlFieldLocalQuery(ignite, log, orgId);
+        int scanCnt = getPersonsCountByScanLocalQuery(ignite, log, orgId);
+        int partCnt = getPersonsCountFromPartitionMap(ignite, log, orgId);
+
+        assertEquals(PERS_AT_ORG_CNT, partCnt);
+        assertEquals(partCnt, sqlCnt);
+        assertEquals(partCnt, sqlFieldCnt);
+        assertEquals(partCnt, scanCnt);
+
+        return partCnt;
+    }
+
+    /**
+     * @param ignite Ignite.
+     * @param log Logger.
+     * @param orgId Organization id.
+     * @return Count of found Person object with specified orgId
+     * @throws Exception If failed.
+     */
+    private static int getPersonsCountMultipleCache(final IgniteEx ignite, IgniteLogger log, final int orgId)
+        throws Exception {
+        int sqlFieldCnt = getPersonsCountBySqlFieledLocalQueryJoinOrgs(ignite, log, orgId);
+        int partCnt = getPersonsCountFromPartitionMapCheckBothCaches(ignite, log, orgId);
+
+        assertEquals(partCnt, sqlFieldCnt);
+
+        return partCnt;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        // Workaround for initial update job metadata.
+        grid(0).compute().affinityCall(
+            Arrays.asList(Person.class.getSimpleName(), Organization.class.getSimpleName()),
+            0,
+            new TestAffinityCall(new PersonsCountGetter() {
+                @Override public int getPersonsCount(IgniteEx ignite, IgniteLogger log, int orgId) throws Exception {
+                    return PERS_AT_ORG_CNT;
+                }
+            }, 0));
+
+        grid(0).compute().affinityRun(
+            Arrays.asList(Person.class.getSimpleName(), Organization.class.getSimpleName()),
+            0,
+            new TestAffinityRun(new PersonsCountGetter() {
+                @Override public int getPersonsCount(IgniteEx ignite, IgniteLogger log, int orgId) throws Exception {
+                    return PERS_AT_ORG_CNT;
+                }
+            }, 0));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testSingleCache() throws Exception {
+        final PersonsCountGetter personsCntGetter = new PersonsCountGetter() {
+            @Override public int getPersonsCount(IgniteEx ignite, IgniteLogger log, int orgId) throws Exception {
+                return getPersonsCountSingleCache(ignite, log, orgId);
+            }
+        };
+
+        // Run restart threads: start re-balancing.
+        beginNodesRestart();
+
+        IgniteInternalFuture<Long> affFut = null;
+
+        try {
+            final AtomicInteger threadNum = new AtomicInteger(0);
+            affFut = GridTestUtils.runMultiThreadedAsync(new Runnable() {
+                @Override public void run() {
+                    if (threadNum.getAndIncrement() % 2 == 0) {
+                        while (System.currentTimeMillis() < endTime) {
+                            for (final int orgId : orgIds) {
+                                if (System.currentTimeMillis() >= endTime)
+                                    break;
+
+                                grid(0).compute().affinityRun(Person.class.getSimpleName(),
+                                    new Person(0, orgId).createKey(),
+                                    new TestAffinityRun(personsCntGetter, orgId));
+                            }
+                        }
+                    }
+                    else {
+                        while (System.currentTimeMillis() < endTime) {
+                            for (final int orgId : orgIds) {
+                                if (System.currentTimeMillis() >= endTime)
+                                    break;
+
+                                int personsCnt = grid(0).compute().affinityCall(Person.class.getSimpleName(),
+                                    new Person(0, orgId).createKey(),
+                                    new TestAffinityCall(personsCntGetter, orgId));
+
+                                assertEquals(PERS_AT_ORG_CNT, personsCnt);
+                            }
+                        }
+                    }
+                }
+            }, AFFINITY_THREADS_CNT, "affinity-run");
+        }
+        finally {
+            if (affFut != null)
+                affFut.get();
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testMultipleCaches() throws Exception {
+        final PersonsCountGetter personsCntGetter = new PersonsCountGetter() {
+            @Override public int getPersonsCount(IgniteEx ignite, IgniteLogger log, int orgId) throws Exception {
+                return getPersonsCountMultipleCache(ignite, log, orgId);
+            }
+        };
+        // Run restart threads: start re-balancing
+        beginNodesRestart();
+
+        IgniteInternalFuture<Long> affFut = null;
+        try {
+            final AtomicInteger threadNum = new AtomicInteger(0);
+            affFut = GridTestUtils.runMultiThreadedAsync(new Runnable() {
+                @Override public void run() {
+                    if (threadNum.getAndIncrement() % 2 == 0) {
+                        while (System.currentTimeMillis() < endTime) {
+                            for (final int orgId : orgIds) {
+                                if (System.currentTimeMillis() >= endTime)
+                                    break;
+
+                                grid(0).compute().affinityRun(
+                                    Arrays.asList(Organization.class.getSimpleName(), Person.class.getSimpleName()),
+                                    new Integer(orgId),
+                                    new TestAffinityRun(personsCntGetter, orgId));
+                            }
+                        }
+                    }
+                    else {
+                        while (System.currentTimeMillis() < endTime) {
+                            for (final int orgId : orgIds) {
+                                if (System.currentTimeMillis() >= endTime)
+                                    break;
+
+                                int personsCnt = grid(0).compute().affinityCall(
+                                    Arrays.asList(Organization.class.getSimpleName(), Person.class.getSimpleName()),
+                                    new Integer(orgId),
+                                    new TestAffinityCall(personsCntGetter, orgId));
+
+                                assertEquals(PERS_AT_ORG_CNT, personsCnt);
+                            }
+                        }
+                    }
+
+                }
+            }, AFFINITY_THREADS_CNT, "affinity-run");
+        }
+        finally {
+            if (affFut != null)
+                affFut.get();
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testCheckReservePartitionException() throws Exception {
+        int orgId = primaryKey(grid(1).cache(Organization.class.getSimpleName()));
+
+        try {
+            grid(0).compute().affinityRun(
+                Arrays.asList(Organization.class.getSimpleName(), OTHER_CACHE_NAME),
+                new Integer(orgId),
+                new IgniteRunnable() {
+                    @Override public void run() {
+                        // No-op.
+                    }
+                });
+
+            fail("Exception is expected");
+        }
+        catch (Exception e) {
+            assertTrue(e.getMessage()
+                .startsWith("Failed partition reservation. Partition is not primary on the node."));
+        }
+
+        try {
+            grid(0).compute().affinityCall(
+                Arrays.asList(Organization.class.getSimpleName(), OTHER_CACHE_NAME),
+                new Integer(orgId),
+                new IgniteCallable<Object>() {
+                    @Override public Object call() throws Exception {
+                        return null;
+                    }
+                });
+
+            fail("Exception is expected");
+        }
+        catch (Exception e) {
+            assertTrue(e.getMessage()
+                .startsWith("Failed partition reservation. Partition is not primary on the node."));
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testReleasePartitionJobCompletesNormally() throws Exception {
+        final int orgId = primaryKey(grid(1).cache(Organization.class.getSimpleName()));
+
+        grid(0).compute().affinityRun(
+            Arrays.asList(Organization.class.getSimpleName(), Person.class.getSimpleName()),
+            new Integer(orgId),
+            new IgniteRunnable() {
+                @IgniteInstanceResource
+                IgniteEx ignite;
+
+                @Override public void run() {
+                    try {
+                        checkPartitionsReservations(ignite, orgId, 1);
+                    }
+                    catch (Exception e) {
+                        e.printStackTrace();
+                        fail("Unexpected exception");
+                    }
+                }
+            });
+
+        checkPartitionsReservations(grid(1), orgId, 0);
+
+        grid(0).compute().affinityCall(
+            Arrays.asList(Organization.class.getSimpleName(), Person.class.getSimpleName()),
+            new Integer(orgId),
+            new IgniteCallable<Object>() {
+                @IgniteInstanceResource
+                IgniteEx ignite;
+
+                @Override public Object call() {
+                    try {
+                        checkPartitionsReservations(ignite, orgId, 1);
+                    }
+                    catch (Exception e) {
+                        e.printStackTrace();
+                        fail("Unexpected exception");
+                    }
+                    return null;
+                }
+            });
+
+        checkPartitionsReservations(grid(1), orgId, 0);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testReleasePartitionJobThrowsException() throws Exception {
+        final int orgId = primaryKey(grid(1).cache(Organization.class.getSimpleName()));
+
+        try {
+            grid(0).compute().affinityRun(
+                Arrays.asList(Organization.class.getSimpleName(), Person.class.getSimpleName()),
+                new Integer(orgId),
+                new IgniteRunnable() {
+                    @IgniteInstanceResource
+                    IgniteEx ignite;
+
+                    @Override public void run() {
+                        try {
+                            checkPartitionsReservations(ignite, orgId, 1);
+                        }
+                        catch (Exception e) {
+                            e.printStackTrace();
+                            fail("Unexpected exception");
+
+                        }
+                        throw new RuntimeException("Test job throws exception");
+                    }
+                });
+
+            fail("Exception must be thrown");
+        }
+        catch (Exception e) {
+            checkPartitionsReservations(grid(1), orgId, 0);
+        }
+
+        try {
+            grid(0).compute().affinityCall(
+                Arrays.asList(Organization.class.getSimpleName(), Person.class.getSimpleName()),
+                new Integer(orgId),
+                new IgniteCallable<Object>() {
+                    @IgniteInstanceResource
+                    IgniteEx ignite;
+
+                    @Override public Object call() {
+                        try {
+                            checkPartitionsReservations(ignite, orgId, 1);
+                        }
+                        catch (Exception e) {
+                            e.printStackTrace();
+                            fail("Unexpected exception");
+                        }
+                        throw new RuntimeException("Test job throws exception");
+                    }
+                });
+
+            fail("Exception must be thrown");
+        }
+        catch (Exception e) {
+            checkPartitionsReservations(grid(1), orgId, 0);
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testReleasePartitionJobThrowsError() throws Exception {
+        final int orgId = primaryKey(grid(1).cache(Organization.class.getSimpleName()));
+
+        try {
+            grid(0).compute().affinityRun(
+                Arrays.asList(Organization.class.getSimpleName(), Person.class.getSimpleName()),
+                new Integer(orgId),
+                new IgniteRunnable() {
+                    @IgniteInstanceResource
+                    IgniteEx ignite;
+
+                    @Override public void run() {
+                        try {
+                            checkPartitionsReservations(ignite, orgId, 1);
+                        }
+                        catch (Exception e) {
+                            e.printStackTrace();
+                            fail("Unexpected exception");
+                        }
+                        throw new Error("Test job throws error");
+                    }
+                });
+
+            fail("Error must be thrown");
+        }
+        catch (Throwable e) {
+            checkPartitionsReservations(grid(1), orgId, 0);
+        }
+
+        try {
+            grid(0).compute().affinityCall(
+                Arrays.asList(Organization.class.getSimpleName(), Person.class.getSimpleName()),
+                new Integer(orgId),
+                new IgniteCallable<Object>() {
+                    @IgniteInstanceResource
+                    IgniteEx ignite;
+
+                    @Override public Object call() {
+                        try {
+                            checkPartitionsReservations(ignite, orgId, 1);
+                        }
+                        catch (Exception e) {
+                            e.printStackTrace();
+                            fail("Unexpected exception");
+                        }
+                        throw new Error("Test job throws error");
+                    }
+                });
+
+            fail("Error must be thrown");
+        }
+        catch (Throwable e) {
+            checkPartitionsReservations(grid(1), orgId, 0);
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testReleasePartitionJobUnmarshalingFails() throws Exception {
+        final int orgId = primaryKey(grid(1).cache(Organization.class.getSimpleName()));
+
+        try {
+            grid(0).compute().affinityRun(
+                Arrays.asList(Organization.class.getSimpleName(), Person.class.getSimpleName()),
+                new Integer(orgId),
+                new JobFailUnmarshaling());
+            fail("Unmarshaling exception must be thrown");
+        }
+        catch (Exception e) {
+            checkPartitionsReservations(grid(1), orgId, 0);
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testReleasePartitionJobMasterLeave() throws Exception {
+        final int orgId = primaryKey(grid(0).cache(Organization.class.getSimpleName()));
+
+        try {
+            grid(1).compute().withAsync().affinityRun(
+                Arrays.asList(Organization.class.getSimpleName(), Person.class.getSimpleName()),
+                new Integer(orgId),
+                new IgniteRunnable() {
+                    @IgniteInstanceResource
+                    private Ignite ignite;
+
+                    @Override public void run() {
+                        try {
+                            checkPartitionsReservations((IgniteEx)ignite, orgId, 1);
+                        }
+                        catch (Exception e) {
+                            e.printStackTrace();
+                            fail("Unexpected exception");
+                        }
+
+                        try {
+                            Thread.sleep(1000);
+                        }
+                        catch (InterruptedException e) {
+                            // No-op.
+                        }
+                    }
+                });
+
+            stopGrid(1, true);
+
+            Thread.sleep(3000);
+
+            awaitPartitionMapExchange();
+
+            checkPartitionsReservations(grid(0), orgId, 0);
+        }
+        finally {
+            startGrid(1);
+
+            awaitPartitionMapExchange();
+        }
+
+
+        try {
+            grid(1).compute().withAsync().affinityCall(
+                Arrays.asList(Organization.class.getSimpleName(), Person.class.getSimpleName()),
+                new Integer(orgId),
+                new IgniteCallable<Object>() {
+                    @IgniteInstanceResource
+                    private Ignite ignite;
+
+                    @Override public Object call() {
+                        try {
+                            checkPartitionsReservations((IgniteEx)ignite, orgId, 1);
+                        }
+                        catch (Exception e) {
+                            e.printStackTrace();
+                            fail("Unexpected exception");
+                        }
+
+                        try {
+                            Thread.sleep(1000);
+                        }
+                        catch (InterruptedException e) {
+                            // No-op.
+                        }
+                        return null;
+                    }
+                });
+
+            stopGrid(1, true);
+
+            Thread.sleep(3000);
+
+            awaitPartitionMapExchange();
+
+            checkPartitionsReservations(grid(0), orgId, 0);
+        }
+        finally {
+            startGrid(1);
+
+            awaitPartitionMapExchange();
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testReleasePartitionJobImplementMasterLeave() throws Exception {
+        final int orgId = primaryKey(grid(0).cache(Organization.class.getSimpleName()));
+
+        try {
+            grid(1).compute().withAsync().affinityRun(
+                Arrays.asList(Organization.class.getSimpleName(), Person.class.getSimpleName()),
+                new Integer(orgId),
+                new RunnableWithMasterLeave() {
+                    @IgniteInstanceResource
+                    private Ignite ignite;
+
+                    @Override public void onMasterNodeLeft(ComputeTaskSession ses) throws IgniteException {
+                        // No-op.
+                    }
+
+                    @Override public void run() {
+                        try {
+                            checkPartitionsReservations((IgniteEx)ignite, orgId, 1);
+                        }
+                        catch (Exception e) {
+                            e.printStackTrace();
+                            fail("Unexpected exception");
+                        }
+
+                        try {
+                            Thread.sleep(1000);
+                        }
+                        catch (InterruptedException e) {
+                            // No-op.
+                        }
+                    }
+                });
+
+            stopGrid(1, true);
+
+            Thread.sleep(3000);
+
+            awaitPartitionMapExchange();
+
+            checkPartitionsReservations(grid(0), orgId, 0);
+        }
+        finally {
+            startGrid(1);
+            awaitPartitionMapExchange();
+        }
+    }
+
+    /** */
+    private interface PersonsCountGetter {
+        /**
+         * @param ignite Ignite.
+         * @param log Logger.
+         * @param orgId Org id.
+         * @return Count of found Person object with specified orgId
+         * @throws Exception If failed.
+         */
+        int getPersonsCount(IgniteEx ignite, IgniteLogger log, int orgId) throws Exception;
+    }
+
+    /** */
+    interface RunnableWithMasterLeave extends IgniteRunnable, ComputeJobMasterLeaveAware {
+    }
+
+    /** */
+    private static class TestAffinityCall implements IgniteCallable<Integer> {
+        /** Persons count getter. */
+        PersonsCountGetter personsCntGetter;
+
+        /** Org id. */
+        int orgId;
+
+        /** */
+        @IgniteInstanceResource
+        private IgniteEx ignite;
+
+        /** */
+        @LoggerResource
+        private IgniteLogger log;
+
+        /** */
+        public TestAffinityCall() {
+            // No-op.
+        }
+
+        /**
+         * @param personsCntGetter Object to count Person.
+         * @param orgId Organization Id.
+         */
+        public TestAffinityCall(PersonsCountGetter personsCntGetter, int orgId) {
+            this.personsCntGetter = personsCntGetter;
+            this.orgId = orgId;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Integer call() throws Exception {
+            log.info("Begin call. orgId=" + orgId);
+            return personsCntGetter.getPersonsCount(ignite, log, orgId);
+        }
+    }
+
+    /** */
+    private static class TestAffinityRun implements IgniteRunnable {
+        /** Persons count getter. */
+        PersonsCountGetter personsCntGetter;
+
+        /** Org id. */
+        int orgId;
+
+        /** */
+        @IgniteInstanceResource
+        private IgniteEx ignite;
+
+        /** */
+        @LoggerResource
+        private IgniteLogger log;
+
+        /** */
+        public TestAffinityRun() {
+            // No-op.
+        }
+
+        /**
+         * @param personsCntGetter Object to count Person.
+         * @param orgId Organization Id.
+         */
+        public TestAffinityRun(PersonsCountGetter personsCntGetter, int orgId) {
+            this.personsCntGetter = personsCntGetter;
+            this.orgId = orgId;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void run() {
+            try {
+                log.info("Begin run. orgId=" + orgId);
+                int cnt = personsCntGetter.getPersonsCount(ignite, log, orgId);
+                assertEquals(PERS_AT_ORG_CNT, cnt);
+            }
+            catch (Exception e) {
+                throw new IgniteException(e);
+            }
+        }
+    }
+
+    /** */
+    static class JobFailUnmarshaling implements Externalizable, IgniteRunnable {
+        /**
+         * Default constructor (required by Externalizable).
+         */
+        public JobFailUnmarshaling() {
+            // No-op.
+        }
+
+        /** {@inheritDoc} */
+        @Override public void writeExternal(ObjectOutput out) throws IOException {
+            //No-op.
+        }
+
+        /** {@inheritDoc} */
+        @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+            throw new IOException("Test job unmarshaling fails");
+        }
+
+        /** {@inheritDoc} */
+        @Override public void run() {
+            fail("Must not be executed");
+        }
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunTxCacheOpTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunTxCacheOpTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunTxCacheOpTest.java
new file mode 100644
index 0000000..3e9f9d6
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunTxCacheOpTest.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.cache.CacheAtomicityMode;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+
+/**
+ * Test to validate https://issues.apache.org/jira/browse/IGNITE-2310.
+ */
+public class IgniteCacheLockPartitionOnAffinityRunTxCacheOpTest
+    extends IgniteCacheLockPartitionOnAffinityRunAtomicCacheOpTest {
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return TRANSACTIONAL;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunWithCollisionSpiTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunWithCollisionSpiTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunWithCollisionSpiTest.java
new file mode 100644
index 0000000..c0b896a
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunWithCollisionSpiTest.java
@@ -0,0 +1,204 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.lang.IgniteFuture;
+import org.apache.ignite.lang.IgniteRunnable;
+import org.apache.ignite.resources.LoggerResource;
+import org.apache.ignite.spi.IgniteSpiAdapter;
+import org.apache.ignite.spi.IgniteSpiContext;
+import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.IgniteSpiMultipleInstancesSupport;
+import org.apache.ignite.spi.collision.CollisionContext;
+import org.apache.ignite.spi.collision.CollisionExternalListener;
+import org.apache.ignite.spi.collision.CollisionJobContext;
+import org.apache.ignite.spi.collision.CollisionSpi;
+import org.apache.ignite.spi.collision.jobstealing.JobStealingCollisionSpi;
+import org.apache.ignite.spi.failover.always.AlwaysFailoverSpi;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Test to validate https://issues.apache.org/jira/browse/IGNITE-2310
+ */
+public class IgniteCacheLockPartitionOnAffinityRunWithCollisionSpiTest
+    extends IgniteCacheLockPartitionOnAffinityRunAbstractTest {
+
+    private static volatile boolean cancelAllJobs = false;
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        CollisionSpi colSpi = new AlwaysCancelCollisionSpi();
+
+        cfg.setCollisionSpi(colSpi);
+
+        return cfg;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPartitionReservation() throws Exception {
+        int orgId = 0;
+        cancelAllJobs = true;
+        // Workaround for initial update job metadata.
+        try {
+            grid(0).compute().affinityRun(
+                Arrays.asList(Organization.class.getSimpleName(), Person.class.getSimpleName()),
+                new Integer(orgId),
+                new TestRun(orgId));
+        } catch (Exception e) {
+            // No-op. Swallow exceptions on run (e.g. job canceling etc.).
+            // The test checks only correct partition release in case CollisionSpi is used.
+        }
+        // All partition must be released in spite of any exceptions during the job executions.
+        cancelAllJobs = false;
+        ClusterNode n = grid(0).context().affinity()
+                .mapKeyToNode(Organization.class.getSimpleName(), orgId);
+        checkPartitionsReservations((IgniteEx)grid(n), orgId, 0);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void _testJobFinishing() throws Exception {
+//        fail("Affinity run / call doesn't receive response where many job rejections happen.");
+        final AtomicInteger jobNum = new AtomicInteger(0);
+
+        cancelAllJobs = true;
+
+        IgniteInternalFuture<Long> affFut = null;
+        try {
+            affFut = GridTestUtils.runMultiThreadedAsync(new Runnable() {
+                @Override public void run() {
+                    while (System.currentTimeMillis() < endTime) {
+                        int n = 0;
+                        try {
+                            for (final int orgId : orgIds) {
+                                if (System.currentTimeMillis() >= endTime)
+                                    break;
+
+                                n = jobNum.getAndIncrement();
+
+                                log.info("+++ Job submitted " + n);
+                                grid(0).compute().affinityRun(
+                                    Arrays.asList(Organization.class.getSimpleName(), Person.class.getSimpleName()),
+                                    new Integer(orgId),
+                                    new TestRun(n));
+                            }
+                        }
+                        catch (Exception e) {
+                            log.info("+++ Job failed " + n + " " + e.toString());
+                            // No-op. Swallow exceptions on run (e.g. job canceling etc.).
+                        }
+                    }
+
+                }
+            }, AFFINITY_THREADS_CNT, "affinity-run");
+        }
+        finally {
+            if (affFut != null)
+                affFut.get();
+
+            stopRestartThread.set(true);
+
+            cancelAllJobs = false;
+
+            // Should not be timed out.
+            awaitPartitionMapExchange();
+        }
+    }
+
+    /**
+     *
+     */
+    private static class TestRun implements IgniteRunnable {
+        private int jobNum;
+
+        /** Ignite Logger. */
+        @LoggerResource
+        private IgniteLogger log;
+
+        /**
+         *
+         */
+        public TestRun() {
+
+        }
+
+        /**
+         * @param jobNum Job number.
+         */
+        public TestRun(int jobNum) {
+            this.jobNum = jobNum;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void run() {
+            // No-op.
+        }
+    }
+
+    /** */
+    @SuppressWarnings({"PublicInnerClass"})
+    @IgniteSpiMultipleInstancesSupport(true)
+    public static class AlwaysCancelCollisionSpi extends IgniteSpiAdapter implements CollisionSpi {
+        /** Grid logger. */
+        @LoggerResource
+        private IgniteLogger log;
+
+        /** {@inheritDoc} */
+        @Override public void onCollision(CollisionContext ctx) {
+            Collection<CollisionJobContext> waitJobs = ctx.waitingJobs();
+            if (cancelAllJobs) {
+                for (CollisionJobContext job : waitJobs)
+                    job.cancel();
+            } else {
+                for (CollisionJobContext job : waitJobs)
+                    job.activate();
+            }
+        }
+
+        /** {@inheritDoc} */
+        @Override public void spiStart(String gridName) throws IgniteSpiException {
+            // Start SPI start stopwatch.
+            startStopwatch();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void spiStop() throws IgniteSpiException {
+            // No-op.
+        }
+
+        /** {@inheritDoc} */
+        @Override public void setExternalCollisionListener(CollisionExternalListener lsnr) {
+            // No-op.
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheAffinityRunTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheAffinityRunTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheAffinityRunTestSuite.java
new file mode 100644
index 0000000..ef00fc3
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheAffinityRunTestSuite.java
@@ -0,0 +1,45 @@
+/*
+ * 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.testsuites;
+
+import junit.framework.TestSuite;
+import org.apache.ignite.internal.processors.cache.IgniteCacheLockPartitionOnAffinityRunAtomicCacheOpTest;
+import org.apache.ignite.internal.processors.cache.IgniteCacheLockPartitionOnAffinityRunTest;
+import org.apache.ignite.internal.processors.cache.IgniteCacheLockPartitionOnAffinityRunTxCacheOpTest;
+import org.apache.ignite.internal.processors.cache.IgniteCacheLockPartitionOnAffinityRunWithCollisionSpiTest;
+
+/**
+ * Compute and Cache tests for affinityRun/Call. These tests is extracted into separate suite
+ * because ones take a lot of time.
+ */
+public class IgniteCacheAffinityRunTestSuite extends TestSuite {
+    /**
+     * @return Test suite.
+     * @throws Exception Thrown in case of the failure.
+     */
+    public static TestSuite suite() throws Exception {
+        TestSuite suite = new TestSuite("Ignite Compute and Cache Affinity Run Test Suite");
+
+        suite.addTestSuite(IgniteCacheLockPartitionOnAffinityRunTest.class);
+        suite.addTestSuite(IgniteCacheLockPartitionOnAffinityRunWithCollisionSpiTest.class);
+        suite.addTestSuite(IgniteCacheLockPartitionOnAffinityRunAtomicCacheOpTest.class);
+        suite.addTestSuite(IgniteCacheLockPartitionOnAffinityRunTxCacheOpTest.class);
+
+        return suite;
+    }
+}
\ No newline at end of file


[05/19] ignite git commit: IGNITE-3332: IGFS: Optimized file unlock routine with help of a client callable. This closes #916.

Posted by an...@apache.org.
IGNITE-3332: IGFS: Optimized file unlock routine with help of a client callable. This closes #916.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8dd39a59
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8dd39a59
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8dd39a59

Branch: refs/heads/master
Commit: 8dd39a59b0b530af215473d2be3a9107f6ca71e1
Parents: bb0fb72
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Tue Aug 9 10:01:56 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Aug 9 10:01:56 2016 +0300

----------------------------------------------------------------------
 .../ignite/internal/binary/BinaryContext.java   |   2 +
 .../processors/igfs/IgfsFileAffinityRange.java  |  40 ++++--
 .../processors/igfs/IgfsMetaManager.java        |   9 ++
 .../internal/processors/igfs/IgfsUtils.java     |  34 +++++
 .../meta/IgfsClientMetaUnlockCallable.java      | 123 +++++++++++++++++++
 5 files changed, 197 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/8dd39a59/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
index d78c126..2646ac3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
@@ -60,6 +60,7 @@ import org.apache.ignite.internal.processors.igfs.client.IgfsClientSummaryCallab
 import org.apache.ignite.internal.processors.igfs.client.IgfsClientUpdateCallable;
 import org.apache.ignite.internal.processors.igfs.client.meta.IgfsClientMetaIdsForPathCallable;
 import org.apache.ignite.internal.processors.igfs.client.meta.IgfsClientMetaInfoForPathCallable;
+import org.apache.ignite.internal.processors.igfs.client.meta.IgfsClientMetaUnlockCallable;
 import org.apache.ignite.internal.processors.igfs.data.IgfsDataPutProcessor;
 import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaDirectoryCreateProcessor;
 import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaDirectoryListingAddProcessor;
@@ -160,6 +161,7 @@ public class BinaryContext {
 
         sysClss.add(IgfsClientMetaIdsForPathCallable.class.getName());
         sysClss.add(IgfsClientMetaInfoForPathCallable.class.getName());
+        sysClss.add(IgfsClientMetaUnlockCallable.class.getName());
 
         sysClss.add(IgfsClientAffinityCallable.class.getName());
         sysClss.add(IgfsClientDeleteCallable.class.getName());

http://git-wip-us.apache.org/repos/asf/ignite/blob/8dd39a59/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFileAffinityRange.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFileAffinityRange.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFileAffinityRange.java
index 953461c..194869e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFileAffinityRange.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFileAffinityRange.java
@@ -266,22 +266,40 @@ public class IgfsFileAffinityRange implements Message, Externalizable, Binaryliz
 
     /** {@inheritDoc} */
     @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
-        BinaryRawWriter out = writer.rawWriter();
-
-        BinaryUtils.writeIgniteUuid(out, affKey);
-        out.writeInt(status);
-        out.writeLong(startOff);
-        out.writeLong(endOff);
+        writeRawBinary(writer.rawWriter());
     }
 
     /** {@inheritDoc} */
     @Override public void readBinary(BinaryReader reader) throws BinaryObjectException {
-        BinaryRawReader in = reader.rawReader();
+        readRawBinary(reader.rawReader());
+    }
 
-        affKey = BinaryUtils.readIgniteUuid(in);
-        status = in.readInt();
-        startOff = in.readLong();
-        endOff = in.readLong();
+    /**
+     * Writes fields to provided writer.
+     *
+     * @param writer Writer.
+     * @throws BinaryObjectException If fails.
+     */
+    public void writeRawBinary(BinaryRawWriter writer) throws BinaryObjectException {
+        BinaryUtils.writeIgniteUuid(writer, affKey);
+
+        writer.writeInt(status);
+        writer.writeLong(startOff);
+        writer.writeLong(endOff);
+    }
+
+    /**
+     * Reads fields from provided reader.
+     *
+     * @param reader Reader.
+     * @throws BinaryObjectException If fails.
+     */
+    public void readRawBinary(BinaryRawReader reader) throws BinaryObjectException {
+        affKey = BinaryUtils.readIgniteUuid(reader);
+
+        status = reader.readInt();
+        startOff = reader.readLong();
+        endOff = reader.readLong();
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/8dd39a59/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java
index d1151c5..1364491 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java
@@ -50,6 +50,7 @@ import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx
 import org.apache.ignite.internal.processors.igfs.client.IgfsClientAbstractCallable;
 import org.apache.ignite.internal.processors.igfs.client.meta.IgfsClientMetaIdsForPathCallable;
 import org.apache.ignite.internal.processors.igfs.client.meta.IgfsClientMetaInfoForPathCallable;
+import org.apache.ignite.internal.processors.igfs.client.meta.IgfsClientMetaUnlockCallable;
 import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaDirectoryCreateProcessor;
 import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaDirectoryListingAddProcessor;
 import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaDirectoryListingRemoveProcessor;
@@ -664,6 +665,14 @@ public class IgfsMetaManager extends IgfsManager {
     public void unlock(final IgniteUuid fileId, final IgniteUuid lockId, final long modificationTime,
         final boolean updateSpace, final long space, @Nullable final IgfsFileAffinityRange affRange)
         throws IgniteCheckedException {
+
+        if(client) {
+            runClientTask(new IgfsClientMetaUnlockCallable(cfg.getName(), fileId, lockId, modificationTime,
+                updateSpace, space, affRange));
+
+            return;
+        }
+
         validTxState(false);
 
         if (busyLock.enterBusy()) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8dd39a59/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
index 3d86fbb..a79d965 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
@@ -744,6 +744,40 @@ public class IgfsUtils {
     }
 
     /**
+     * Write IgfsFileAffinityRange.
+     *
+     * @param writer Writer
+     * @param affRange affinity range.
+     */
+    public static void writeFileAffinityRange(BinaryRawWriter writer, @Nullable IgfsFileAffinityRange affRange) {
+        if (affRange != null) {
+            writer.writeBoolean(true);
+
+            affRange.writeRawBinary(writer);
+        }
+        else
+            writer.writeBoolean(false);
+    }
+
+    /**
+     * Read IgfsFileAffinityRange.
+     *
+     * @param reader Reader.
+     * @return File affinity range.
+     */
+    public static IgfsFileAffinityRange readFileAffinityRange(BinaryRawReader reader) {
+        if (reader.readBoolean()) {
+            IgfsFileAffinityRange affRange = new IgfsFileAffinityRange();
+
+            affRange.readRawBinary(reader);
+
+            return affRange;
+        }
+        else
+            return null;
+    }
+
+    /**
      * Parses the TRASH file name to extract the original path.
      *
      * @param name The TRASH short (entry) name.

http://git-wip-us.apache.org/repos/asf/ignite/blob/8dd39a59/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/meta/IgfsClientMetaUnlockCallable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/meta/IgfsClientMetaUnlockCallable.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/meta/IgfsClientMetaUnlockCallable.java
new file mode 100644
index 0000000..a2f4ab7
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/meta/IgfsClientMetaUnlockCallable.java
@@ -0,0 +1,123 @@
+/*
+ * 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.igfs.client.meta;
+
+import org.apache.ignite.binary.BinaryObjectException;
+import org.apache.ignite.binary.BinaryRawReader;
+import org.apache.ignite.binary.BinaryRawWriter;
+import org.apache.ignite.internal.binary.BinaryUtils;
+import org.apache.ignite.internal.processors.igfs.IgfsContext;
+import org.apache.ignite.internal.processors.igfs.IgfsFileAffinityRange;
+import org.apache.ignite.internal.processors.igfs.IgfsUtils;
+import org.apache.ignite.internal.processors.igfs.client.IgfsClientAbstractCallable;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.lang.IgniteUuid;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * IGFS client unlock callable.
+ */
+public class IgfsClientMetaUnlockCallable extends IgfsClientAbstractCallable<Void> {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** File id. */
+    private IgniteUuid fileId;
+
+    /** Lock id. */
+    private  IgniteUuid lockId;
+
+    /** Modification time. */
+    private long modificationTime;
+
+    /** Update space. */
+    private boolean updateSpace;
+
+    /** Space. */
+    private long space;
+
+    /** Aff range. */
+    private IgfsFileAffinityRange affRange;
+    /**
+     * Default constructor.
+     */
+    public IgfsClientMetaUnlockCallable() {
+        // NO-op.
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param igfsName IGFS name.
+     * @param fileId File ID.
+     * @param lockId Lock ID.
+     * @param modificationTime Modification time to write to file info.
+     * @param updateSpace Whether to update space.
+     * @param space Space.
+     * @param affRange Affinity range.
+     */
+    public IgfsClientMetaUnlockCallable(@Nullable String igfsName, IgniteUuid fileId, IgniteUuid lockId,
+        long modificationTime, boolean updateSpace, long space, final IgfsFileAffinityRange affRange) {
+        super(igfsName, null);
+
+        this.fileId = fileId;
+        this.lockId = lockId;
+        this.modificationTime = modificationTime;
+        this.updateSpace = updateSpace;
+        this.space = space;
+        this.affRange = affRange;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected Void call0(IgfsContext ctx) throws Exception {
+        ctx.meta().unlock(fileId, lockId, modificationTime, updateSpace, space, affRange);
+
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeBinary0(BinaryRawWriter writer) throws BinaryObjectException {
+        BinaryUtils.writeIgniteUuid(writer, fileId);
+        BinaryUtils.writeIgniteUuid(writer, lockId);
+        writer.writeLong(modificationTime);
+        writer.writeBoolean(updateSpace);
+
+        if (updateSpace)
+            writer.writeLong(space);
+
+        IgfsUtils.writeFileAffinityRange(writer, affRange);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readBinary0(BinaryRawReader reader) throws BinaryObjectException {
+        fileId = BinaryUtils.readIgniteUuid(reader);
+        lockId = BinaryUtils.readIgniteUuid(reader);
+        modificationTime = reader.readLong();
+        updateSpace = reader.readBoolean();
+
+        if (updateSpace)
+            space = reader.readLong();
+
+        affRange = IgfsUtils.readFileAffinityRange(reader);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(IgfsClientMetaUnlockCallable.class, this);
+    }
+}


[12/19] ignite git commit: Fixed copy constructor in ConnectorConfiguration

Posted by an...@apache.org.
Fixed copy constructor in ConnectorConfiguration


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e1262b2f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e1262b2f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e1262b2f

Branch: refs/heads/master
Commit: e1262b2f2f4fb57fa8a75f6008f9e005ad07b5df
Parents: d1a3904
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Tue Aug 9 15:56:49 2016 -0700
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Tue Aug 9 15:56:49 2016 -0700

----------------------------------------------------------------------
 .../org/apache/ignite/configuration/ConnectorConfiguration.java     | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e1262b2f/modules/core/src/main/java/org/apache/ignite/configuration/ConnectorConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/ConnectorConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/ConnectorConfiguration.java
index 0ef5f86..6e33b9c 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/ConnectorConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/ConnectorConfiguration.java
@@ -158,6 +158,7 @@ public class ConnectorConfiguration {
         sslClientAuth = cfg.isSslClientAuth();
         sslCtxFactory = cfg.getSslContextFactory();
         sslEnabled = cfg.isSslEnabled();
+        sslFactory = cfg.getSslFactory();
         idleQryCurTimeout = cfg.getIdleQueryCursorTimeout();
         idleQryCurCheckFreq = cfg.getIdleQueryCursorCheckFrequency();
     }


[02/19] ignite git commit: IGNITE-3631: IGFS: Now metadata co-location is used for PARTITIONED cache as well.

Posted by an...@apache.org.
IGNITE-3631: IGFS: Now metadata co-location is used for PARTITIONED cache as well.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/78a21f10
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/78a21f10
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/78a21f10

Branch: refs/heads/master
Commit: 78a21f100849dfbd2c3663a79c701e892a836618
Parents: 311428e
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Aug 5 15:05:32 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Aug 5 15:05:32 2016 +0300

----------------------------------------------------------------------
 .../org/apache/ignite/internal/processors/igfs/IgfsUtils.java     | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/78a21f10/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
index b9788f8..3a313ad 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
@@ -376,8 +376,7 @@ public class IgfsUtils {
                         ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
 
                         // Set co-located affinity mapper if needed.
-                        if (igfsCfg.isColocateMetadata() && ccfg.getCacheMode() == CacheMode.REPLICATED &&
-                            ccfg.getAffinityMapper() == null)
+                        if (igfsCfg.isColocateMetadata() && ccfg.getAffinityMapper() == null)
                             ccfg.setAffinityMapper(new IgfsColocatedMetadataAffinityKeyMapper());
 
                         return;


[07/19] ignite git commit: IGNITE-2310 Lock cache partition for affinityRun/affinityCall execution

Posted by an...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index a42eb98..8469a7c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -38,6 +38,7 @@ import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.binary.BinaryMarshaller;
 import org.apache.ignite.internal.binary.BinaryObjectEx;
 import org.apache.ignite.internal.processors.GridProcessorAdapter;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.CacheEntryImpl;
 import org.apache.ignite.internal.processors.cache.CacheObject;
 import org.apache.ignite.internal.processors.cache.CacheObjectContext;
@@ -145,6 +146,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
     /** */
     private final GridQueryIndexing idx;
 
+    /** */
+    private static final ThreadLocal<AffinityTopologyVersion> requestTopVer = new ThreadLocal<>();
+
     /**
      * @param ctx Kernal context.
      */
@@ -878,7 +882,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
                             sqlQry,
                             F.asList(params),
                             typeDesc,
-                            idx.backupFilter(null, null, null));
+                            idx.backupFilter(null, requestTopVer.get(), null));
 
                         sendQueryExecutedEvent(
                             sqlQry,
@@ -964,7 +968,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
                     Object[] args = qry.getArgs();
 
                     final GridQueryFieldsResult res = idx.queryFields(space, sql, F.asList(args),
-                        idx.backupFilter(null, null, null));
+                        idx.backupFilter(null, requestTopVer.get(), null));
 
                     sendQueryExecutedEvent(sql, args);
 
@@ -1815,6 +1819,20 @@ public class GridQueryProcessor extends GridProcessorAdapter {
     }
 
     /**
+     * @param ver Version.
+     */
+    public static void setRequestAffinityTopologyVersion(AffinityTopologyVersion ver) {
+        requestTopVer.set(ver);
+    }
+
+    /**
+     * @return Affinity topology version of the current request.
+     */
+    public static AffinityTopologyVersion getRequestAffinityTopologyVersion() {
+        return requestTopVer.get();
+    }
+
+    /**
      * Description of type property.
      */
     private static class ClassProperty extends GridQueryProperty {

http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java
index 415d632..00ea29e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java
@@ -73,6 +73,7 @@ import org.apache.ignite.internal.util.typedef.CO;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.internal.util.typedef.internal.A;
+import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.LT;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
@@ -110,6 +111,9 @@ class GridTaskWorker<T, R> extends GridWorker implements GridTimeoutObject {
     /** Split size threshold. */
     private static final int SPLIT_WARN_THRESHOLD = 1000;
 
+    /** Retry delay factor (ms). Retry delay = retryAttempt * RETRY_DELAY_MS */
+    private static final long RETRY_DELAY_MS = 10;
+
     /** {@code True} for internal tasks. */
     private boolean internal;
 
@@ -192,7 +196,19 @@ class GridTaskWorker<T, R> extends GridWorker implements GridTimeoutObject {
     private final Object affKey;
 
     /** */
-    private final String affCache;
+    private final int affPartId;
+
+    /** */
+    private final String affCacheName;
+
+    /** */
+    private final int[] affCacheIds;
+
+    /** */
+    private AffinityTopologyVersion mapTopVer;
+
+    /** */
+    private int retryAttemptCnt;
 
     /** */
     private final UUID subjId;
@@ -308,12 +324,27 @@ class GridTaskWorker<T, R> extends GridWorker implements GridTimeoutObject {
         if (task instanceof AffinityTask) {
             AffinityTask affTask = (AffinityTask)task;
 
+            assert affTask.affinityCacheNames() != null : affTask;
+            assert affTask.partition() >= 0 : affTask;
+
+            affPartId = affTask.partition();
+            affCacheName = F.first(affTask.affinityCacheNames());
             affKey = affTask.affinityKey();
-            affCache = affTask.affinityCacheName();
+            mapTopVer = affTask.topologyVersion();
+
+            affCacheIds = new int[affTask.affinityCacheNames().size()];
+            int i = 0;
+            for (String cacheName : affTask.affinityCacheNames()) {
+                affCacheIds[i] = CU.cacheId(cacheName);
+                ++i;
+            }
         }
         else {
+            affPartId = -1;
+            affCacheName = null;
             affKey = null;
-            affCache = null;
+            mapTopVer = null;
+            affCacheIds = null;
         }
     }
 
@@ -469,7 +500,7 @@ class GridTaskWorker<T, R> extends GridWorker implements GridTimeoutObject {
 
             // Nodes are ignored by affinity tasks.
             final List<ClusterNode> shuffledNodes =
-                affKey == null ? getTaskTopology() : Collections.<ClusterNode>emptyList();
+                affCacheIds == null ? getTaskTopology() : Collections.<ClusterNode>emptyList();
 
             // Load balancer.
             ComputeLoadBalancer balancer = ctx.loadBalancing().getLoadBalancer(ses, shuffledNodes);
@@ -818,6 +849,7 @@ class GridTaskWorker<T, R> extends GridWorker implements GridTimeoutObject {
                     return;
                 }
 
+                boolean retry = false;
                 synchronized (mux) {
                     // If task is not waiting for responses,
                     // then there is no point to proceed.
@@ -829,54 +861,76 @@ class GridTaskWorker<T, R> extends GridWorker implements GridTimeoutObject {
                         return;
                     }
 
-                    switch (plc) {
-                        // Start reducing all results received so far.
-                        case REDUCE: {
-                            state = State.REDUCING;
+                    if (res.retry()) {
+                        // Retry is used only with affinity call / run.
+                        assert affCacheIds != null;
+                        retry = true;
 
-                            break;
-                        }
+                        mapTopVer = U.max(res.getRetryTopologyVersion(), ctx.discovery().topologyVersionEx());
+                        affFut = ctx.cache().context().exchange().affinityReadyFuture(mapTopVer);
 
-                        // Keep waiting if there are more responses to come,
-                        // otherwise, reduce.
-                        case WAIT: {
-                            assert results.size() <= this.jobRes.size();
+                        if (affFut != null && !affFut.isDone()) {
+                            waitForAffTop = true;
 
-                            // If there are more results to wait for.
-                            // If result cache is disabled, then we reduce
-                            // when both collections are empty.
-                            if (results.size() == this.jobRes.size()) {
-                                plc = ComputeJobResultPolicy.REDUCE;
-
-                                // All results are received, proceed to reduce method.
+                            jobRes.resetResponse();
+                        }
+                    } else {
+                        switch (plc) {
+                            // Start reducing all results received so far.
+                            case REDUCE: {
                                 state = State.REDUCING;
+
+                                break;
                             }
 
-                            break;
-                        }
+                            // Keep waiting if there are more responses to come,
+                            // otherwise, reduce.
+                            case WAIT: {
+                                assert results.size() <= this.jobRes.size();
+
+                                // If there are more results to wait for.
+                                // If result cache is disabled, then we reduce
+                                // when both collections are empty.
+                                if (results.size() == this.jobRes.size()) {
+                                    plc = ComputeJobResultPolicy.REDUCE;
 
-                        case FAILOVER: {
-                            if (affKey != null) {
-                                AffinityTopologyVersion topVer = ctx.discovery().topologyVersionEx();
+                                    // All results are received, proceed to reduce method.
+                                    state = State.REDUCING;
+                                }
 
-                                affFut = ctx.cache().context().exchange().affinityReadyFuture(topVer);
+                                break;
                             }
 
-                            if (affFut != null && !affFut.isDone()) {
-                                waitForAffTop = true;
+                            case FAILOVER: {
+                                if (affCacheIds != null) {
+                                    mapTopVer = ctx.discovery().topologyVersionEx();
 
-                                jobRes.resetResponse();
-                            }
-                            else if (!failover(res, jobRes, getTaskTopology()))
-                                plc = null;
+                                    affFut = ctx.cache().context().exchange().affinityReadyFuture(mapTopVer);
+                                }
+
+                                if (affFut != null && !affFut.isDone()) {
+                                    waitForAffTop = true;
 
-                            break;
+                                    jobRes.resetResponse();
+                                }
+                                else if (!failover(res, jobRes, getTaskTopology()))
+                                    plc = null;
+
+                                break;
+                            }
                         }
                     }
                 }
 
                 // Outside of synchronization.
-                if (plc != null && !waitForAffTop) {
+                if (retry && !waitForAffTop) {
+                    // Handle retry
+                    retryAttemptCnt++;
+
+                    final long wait = retryAttemptCnt * RETRY_DELAY_MS;
+                    sendRetryRequest(wait, jobRes, res);
+                }
+                else if (plc != null && !waitForAffTop && !retry) {
                     // Handle failover.
                     if (plc == FAILOVER)
                         sendFailoverRequest(jobRes);
@@ -928,6 +982,36 @@ class GridTaskWorker<T, R> extends GridWorker implements GridTimeoutObject {
     }
 
     /**
+     * @param waitms Waitms.
+     * @param jRes Job result.
+     * @param resp Job responce.
+     */
+    private void sendRetryRequest(final long waitms, final GridJobResultImpl jRes, final GridJobExecuteResponse resp) {
+        ctx.timeout().schedule(new Runnable() {
+            @Override public void run() {
+                ctx.closure().runLocalSafe(new Runnable() {
+                    @Override public void run() {
+                        try {
+                            ClusterNode newNode = ctx.affinity().mapPartitionToNode(affCacheName, affPartId,
+                                mapTopVer);
+
+                            if(!checkTargetNode(resp, jRes, newNode))
+                                return;
+
+                            sendRequest(jRes);
+                        }
+                        catch (Exception e) {
+                            U.error(log, "Failed to re-map job or retry request [ses=" + ses + "]", e);
+
+                            finishTask(null, e);
+                        }
+                    }
+                }, false);
+            }
+        }, waitms, -1);
+    }
+
+    /**
      * @param jobRes Job result.
      * @param results Existing job results.
      * @return Job result policy.
@@ -1083,53 +1167,63 @@ class GridTaskWorker<T, R> extends GridWorker implements GridTimeoutObject {
         try {
             ctx.resource().invokeAnnotated(dep, jobRes.getJob(), ComputeJobBeforeFailover.class);
 
-            // Map to a new node.
-            ClusterNode node = ctx.failover().failover(ses, jobRes, new ArrayList<>(top), affKey, affCache);
+            ClusterNode node = ctx.failover().failover(ses, jobRes, new ArrayList<>(top), affPartId,
+                affKey, affCacheName, mapTopVer);
 
-            if (node == null) {
-                String msg = "Failed to failover a job to another node (failover SPI returned null) [job=" +
-                    jobRes.getJob() + ", node=" + jobRes.getNode() + ']';
+            return checkTargetNode(res, jobRes, node);
+        }
+        // Catch Throwable to protect against bad user code.
+        catch (Throwable e) {
+            String errMsg = "Failed to failover job due to undeclared user exception [job=" +
+                jobRes.getJob() + ", err=" + e + ']';
 
-                if (log.isDebugEnabled())
-                    log.debug(msg);
+            U.error(log, errMsg, e);
 
-                Throwable e = new ClusterTopologyCheckedException(msg, jobRes.getException());
+            finishTask(null, new ComputeUserUndeclaredException(errMsg, e));
 
-                finishTask(null, e);
+            if (e instanceof Error)
+                throw (Error)e;
 
-                return false;
-            }
+            return false;
+        }
+    }
+
+    /**
+     * @param res Execution response.
+     * @param jobRes Job result.
+     * @param node New target node.
+     * @return {@code True} if new target node is not null.
+     */
+    private boolean checkTargetNode(GridJobExecuteResponse res, GridJobResultImpl jobRes, ClusterNode node) {
+        if (node == null) {
+            String msg = "Failed to failover a job to another node (failover SPI returned null) [job=" +
+                jobRes.getJob() + ", node=" + jobRes.getNode() + ']';
 
             if (log.isDebugEnabled())
-                log.debug("Resolved job failover [newNode=" + node + ", oldNode=" + jobRes.getNode() +
-                    ", job=" + jobRes.getJob() + ", resMsg=" + res + ']');
+                log.debug(msg);
+
+            Throwable e = new ClusterTopologyCheckedException(msg, jobRes.getException());
+
+            finishTask(null, e);
+
+            return false;
+        }
 
+        if (log.isDebugEnabled())
+            log.debug("Resolved job failover [newNode=" + node + ", oldNode=" + jobRes.getNode() +
+                ", job=" + jobRes.getJob() + ", resMsg=" + res + ']');
+
+        synchronized (mux) {
             jobRes.setNode(node);
             jobRes.resetResponse();
 
             if (!resCache) {
-                synchronized (mux) {
                     // Store result back in map before sending.
                     this.jobRes.put(res.getJobId(), jobRes);
-                }
             }
-
-            return true;
         }
-        // Catch Throwable to protect against bad user code.
-        catch (Throwable e) {
-            String errMsg = "Failed to failover job due to undeclared user exception [job=" +
-                jobRes.getJob() + ", err=" + e + ']';
 
-            U.error(log, errMsg, e);
-
-            finishTask(null, new ComputeUserUndeclaredException(errMsg, e));
-
-            if (e instanceof Error)
-                throw (Error)e;
-
-            return false;
-        }
+        return true;
     }
 
     /**
@@ -1227,7 +1321,7 @@ class GridTaskWorker<T, R> extends GridWorker implements GridTimeoutObject {
                 ctx.resource().invokeAnnotated(dep, res.getJob(), ComputeJobAfterSend.class);
 
                 GridJobExecuteResponse fakeRes = new GridJobExecuteResponse(node.id(), ses.getId(),
-                    res.getJobContext().getJobId(), null, null, null, null, null, null, false);
+                    res.getJobContext().getJobId(), null, null, null, null, null, null, false, null);
 
                 fakeRes.setFakeException(new ClusterTopologyException("Failed to send job due to node failure: " + node));
 
@@ -1272,7 +1366,10 @@ class GridTaskWorker<T, R> extends GridWorker implements GridTimeoutObject {
                         forceLocDep,
                         ses.isFullSupport(),
                         internal,
-                        subjId);
+                        subjId,
+                        affCacheIds,
+                        affPartId,
+                        mapTopVer);
 
                     if (loc)
                         ctx.job().processJobExecuteRequest(ctx.discovery().localNode(), req);
@@ -1319,7 +1416,7 @@ class GridTaskWorker<T, R> extends GridWorker implements GridTimeoutObject {
             }
 
             GridJobExecuteResponse fakeRes = new GridJobExecuteResponse(node.id(), ses.getId(),
-                res.getJobContext().getJobId(), null, null, null, null, null, null, false);
+                res.getJobContext().getJobId(), null, null, null, null, null, null, false, null);
 
             if (fakeErr == null)
                 fakeErr = U.convertException(e);
@@ -1351,7 +1448,7 @@ class GridTaskWorker<T, R> extends GridWorker implements GridTimeoutObject {
                         // Artificial response in case if a job is waiting for a response from
                         // non-existent node.
                         GridJobExecuteResponse fakeRes = new GridJobExecuteResponse(nodeId, ses.getId(),
-                            jr.getJobContext().getJobId(), null, null, null, null, null, null, false);
+                            jr.getJobContext().getJobId(), null, null, null, null, null, null, false, null);
 
                         fakeRes.setFakeException(new ClusterTopologyException("Node has left grid: " + nodeId));
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index 269795b..a480b87 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@ -9602,4 +9602,14 @@ public abstract class IgniteUtils {
 
         return "<failed to find active thread " + threadId + '>';
     }
+
+    /**
+     * @param t0 Comparable object.
+     * @param t1 Comparable object.
+     * @param <T> Comparable type.
+     * @return Maximal object o t0 and t1.
+     */
+    public static <T extends Comparable<? super T>> T max(T t0, T t1) {
+        return t0.compareTo(t1) > 0 ? t0 : t1;
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/core/src/main/java/org/apache/ignite/spi/failover/FailoverContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/failover/FailoverContext.java b/modules/core/src/main/java/org/apache/ignite/spi/failover/FailoverContext.java
index 1108ad1..b126db1 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/failover/FailoverContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/failover/FailoverContext.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.spi.failover;
 
+import java.util.Collection;
 import java.util.List;
 import org.apache.ignite.IgniteCompute;
 import org.apache.ignite.IgniteException;
@@ -58,14 +59,24 @@ public interface FailoverContext {
     public ClusterNode getBalancedNode(List<ClusterNode> top) throws IgniteException;
 
     /**
-     * Gets affinity key for {@link IgniteCompute#affinityRun(String, Object, IgniteRunnable)}
-     * and {@link IgniteCompute#affinityCall(String, Object, IgniteCallable)}.
+     * Gets affinity key for {@link IgniteCompute#affinityRun(String, Object, IgniteRunnable)},
+     * {@link IgniteCompute#affinityRun(Collection, Object, IgniteRunnable)},
+     * {@link IgniteCompute#affinityCall(String, Object, IgniteCallable)}
+     * and {@link IgniteCompute#affinityCall(Collection, Object, IgniteCallable)}.
      *
      * @return Affinity key.
      */
     @Nullable public Object affinityKey();
 
     /**
+     * Gets partition for {@link IgniteCompute#affinityRun(Collection, int, IgniteRunnable)}
+     * and {@link IgniteCompute#affinityCall(Collection, int, IgniteCallable)}.
+     *
+     * @return Partition number.
+     */
+    public int partition();
+
+    /**
      * Returns affinity cache name {@link IgniteCompute#affinityRun(String, Object, IgniteRunnable)}
      * and {@link IgniteCompute#affinityCall(String, Object, IgniteCallable)}.
      *

http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/core/src/main/java/org/apache/ignite/spi/failover/always/AlwaysFailoverSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/failover/always/AlwaysFailoverSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/failover/always/AlwaysFailoverSpi.java
index 77b3745..63c990e 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/failover/always/AlwaysFailoverSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/failover/always/AlwaysFailoverSpi.java
@@ -23,9 +23,12 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
+import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.managers.failover.GridFailoverContextImpl;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
@@ -189,7 +192,7 @@ public class AlwaysFailoverSpi extends IgniteSpiAdapter implements FailoverSpi,
             return null;
         }
 
-        if (ctx.affinityKey() != null) {
+        if (ctx.partition() >= 0) {
             Integer affCallAttempt = ctx.getJobResult().getJobContext().getAttribute(AFFINITY_CALL_ATTEMPT);
 
             if (affCallAttempt == null)
@@ -205,7 +208,15 @@ public class AlwaysFailoverSpi extends IgniteSpiAdapter implements FailoverSpi,
             else {
                 ctx.getJobResult().getJobContext().setAttribute(AFFINITY_CALL_ATTEMPT, affCallAttempt + 1);
 
-                return ignite.affinity(ctx.affinityCacheName()).mapKeyToNode(ctx.affinityKey());
+                try {
+                    return ((IgniteEx)ignite).context().affinity().mapPartitionToNode(ctx.affinityCacheName(), ctx.partition(),
+                        ((GridFailoverContextImpl)ctx).affinityTopologyVersion());
+                }
+                catch (IgniteCheckedException e) {
+                    U.error(log, "Failed to get map job to node on failover: " + ctx, e);
+
+                    return null;
+                }
             }
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/core/src/test/java/org/apache/ignite/internal/GridJobMasterLeaveAwareSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridJobMasterLeaveAwareSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridJobMasterLeaveAwareSelfTest.java
index a7cab3f..a484ec3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridJobMasterLeaveAwareSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridJobMasterLeaveAwareSelfTest.java
@@ -464,7 +464,7 @@ public class GridJobMasterLeaveAwareSelfTest extends GridCommonAbstractTest {
 
                 ClusterNode node = F.first(prj.nodes());
 
-                comp.affinityRun(null, keyForNode(aff, node), new TestRunnable());
+                comp.affinityRun((String)null, keyForNode(aff, node), new TestRunnable());
 
                 return comp.future();
             }
@@ -483,7 +483,7 @@ public class GridJobMasterLeaveAwareSelfTest extends GridCommonAbstractTest {
 
                 ClusterNode node = F.first(prj.nodes());
 
-                comp.affinityCall(null, keyForNode(aff, node), new TestCallable());
+                comp.affinityCall((String)null, keyForNode(aff, node), new TestCallable());
 
                 return comp.future();
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionLocalJobMultipleArgumentsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionLocalJobMultipleArgumentsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionLocalJobMultipleArgumentsSelfTest.java
index 356e002..fc94663 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionLocalJobMultipleArgumentsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionLocalJobMultipleArgumentsSelfTest.java
@@ -88,7 +88,7 @@ public class GridProjectionLocalJobMultipleArgumentsSelfTest extends GridCommonA
         Collection<Integer> res = new ArrayList<>();
 
         for (int i : F.asList(1, 2, 3)) {
-            res.add(grid().compute().affinityCall(null, i, new IgniteCallable<Integer>() {
+            res.add(grid().compute().affinityCall((String)null, i, new IgniteCallable<Integer>() {
                 @Override public Integer call() {
                     ids.add(this);
 
@@ -106,7 +106,7 @@ public class GridProjectionLocalJobMultipleArgumentsSelfTest extends GridCommonA
      */
     public void testAffinityRun() throws Exception {
         for (int i : F.asList(1, 2, 3)) {
-            grid().compute().affinityRun(null, i, new IgniteRunnable() {
+            grid().compute().affinityRun((String)null, i, new IgniteRunnable() {
                 @Override public void run() {
                     ids.add(this);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/core/src/test/java/org/apache/ignite/internal/GridTaskFailoverAffinityRunTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridTaskFailoverAffinityRunTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridTaskFailoverAffinityRunTest.java
index f804cb3..7997560 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridTaskFailoverAffinityRunTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridTaskFailoverAffinityRunTest.java
@@ -137,7 +137,7 @@ public class GridTaskFailoverAffinityRunTest extends GridCommonAbstractTest {
                 Collection<IgniteFuture<?>> futs = new ArrayList<>(1000);
 
                 for (int i = 0; i < 1000; i++) {
-                    comp.affinityCall(null, i, new TestJob());
+                    comp.affinityCall((String)null, i, new TestJob());
 
                     IgniteFuture<?> fut0 = comp.future();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/core/src/test/java/org/apache/ignite/internal/IgniteComputeEmptyClusterGroupTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteComputeEmptyClusterGroupTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteComputeEmptyClusterGroupTest.java
index 48039a5..b595fee 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteComputeEmptyClusterGroupTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteComputeEmptyClusterGroupTest.java
@@ -82,7 +82,7 @@ public class IgniteComputeEmptyClusterGroupTest extends GridCommonAbstractTest {
 
         IgniteCompute comp = ignite(0).compute(empty).withAsync();
 
-        comp.affinityRun(null, 1, new FailRunnable());
+        comp.affinityRun((String)null, 1, new FailRunnable());
 
         checkFutureFails(comp);
 
@@ -90,7 +90,7 @@ public class IgniteComputeEmptyClusterGroupTest extends GridCommonAbstractTest {
 
         checkFutureFails(comp);
 
-        comp.affinityCall(null, 1, new FailCallable());
+        comp.affinityCall((String)null, 1, new FailCallable());
 
         checkFutureFails(comp);
 
@@ -112,7 +112,7 @@ public class IgniteComputeEmptyClusterGroupTest extends GridCommonAbstractTest {
         GridTestUtils.assertThrows(log, new Callable<Void>() {
             @Override
             public Void call() throws Exception {
-                comp.affinityRun(null, 1, new FailRunnable());
+                comp.affinityRun((String)null, 1, new FailRunnable());
 
                 return null;
             }
@@ -129,7 +129,7 @@ public class IgniteComputeEmptyClusterGroupTest extends GridCommonAbstractTest {
         GridTestUtils.assertThrows(log, new Callable<Void>() {
             @Override
             public Void call() throws Exception {
-                comp.affinityCall(null, 1, new FailCallable());
+                comp.affinityCall((String)null, 1, new FailCallable());
 
                 return null;
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/core/src/test/java/org/apache/ignite/internal/binary/GridBinaryAffinityKeySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/binary/GridBinaryAffinityKeySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/binary/GridBinaryAffinityKeySelfTest.java
index 2b54f6b..d5f084d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/binary/GridBinaryAffinityKeySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/binary/GridBinaryAffinityKeySelfTest.java
@@ -178,7 +178,7 @@ public class GridBinaryAffinityKeySelfTest extends GridCommonAbstractTest {
         for (int i = 0; i < 1000; i++) {
             nodeId.set(null);
 
-            grid(0).compute().affinityRun(null, new TestObject(i), new IgniteRunnable() {
+            grid(0).compute().affinityRun((String)null, new TestObject(i), new IgniteRunnable() {
                 @IgniteInstanceResource
                 private Ignite ignite;
 
@@ -189,7 +189,7 @@ public class GridBinaryAffinityKeySelfTest extends GridCommonAbstractTest {
 
             assertEquals(aff.mapKeyToNode(i).id(), nodeId.get());
 
-            grid(0).compute().affinityRun(null, new AffinityKey(0, i), new IgniteRunnable() {
+            grid(0).compute().affinityRun((String)null, new AffinityKey(0, i), new IgniteRunnable() {
                 @IgniteInstanceResource
                 private Ignite ignite;
 
@@ -211,7 +211,7 @@ public class GridBinaryAffinityKeySelfTest extends GridCommonAbstractTest {
         for (int i = 0; i < 1000; i++) {
             nodeId.set(null);
 
-            grid(0).compute().affinityCall(null, new TestObject(i), new IgniteCallable<Object>() {
+            grid(0).compute().affinityCall((String)null, new TestObject(i), new IgniteCallable<Object>() {
                 @IgniteInstanceResource
                 private Ignite ignite;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractUsersAffinityMapperSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractUsersAffinityMapperSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractUsersAffinityMapperSelfTest.java
index c84a2d0..706d8aa 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractUsersAffinityMapperSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractUsersAffinityMapperSelfTest.java
@@ -121,7 +121,7 @@ public abstract class GridCacheAbstractUsersAffinityMapperSelfTest extends GridC
         startGrid(1);
 
         for (int i = 0; i < KEY_CNT; i++)
-            grid(i % 2).compute().affinityRun(null, new TestAffinityKey(1, "1"), new NoopClosure());
+            grid(i % 2).compute().affinityRun((String)null, new TestAffinityKey(1, "1"), new NoopClosure());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartStopConcurrentTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartStopConcurrentTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartStopConcurrentTest.java
index 084be02..f953c47 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartStopConcurrentTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartStopConcurrentTest.java
@@ -88,7 +88,7 @@ public class IgniteDynamicCacheStartStopConcurrentTest extends GridCommonAbstrac
 
             checkTopologyVersion(new AffinityTopologyVersion(NODES, minorVer));
 
-            ignite(0).compute().affinityRun(null, 1, new IgniteRunnable() {
+            ignite(0).compute().affinityRun((String)null, 1, new IgniteRunnable() {
                 @Override public void run() {
                     // No-op.
                 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/core/src/test/java/org/apache/ignite/spi/failover/GridFailoverTestContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/failover/GridFailoverTestContext.java b/modules/core/src/test/java/org/apache/ignite/spi/failover/GridFailoverTestContext.java
index a8a2edf..97a3e0b 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/failover/GridFailoverTestContext.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/failover/GridFailoverTestContext.java
@@ -22,6 +22,7 @@ import java.util.Random;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.compute.ComputeJobResult;
 import org.apache.ignite.compute.ComputeTaskSession;
+import org.jetbrains.annotations.Nullable;
 
 /**
  * Failover test context.
@@ -74,6 +75,11 @@ public class GridFailoverTestContext implements FailoverContext {
     }
 
     /** {@inheritDoc} */
+    @Nullable @Override public int partition() {
+        return -1;
+    }
+
+    /** {@inheritDoc} */
     @Override public String affinityCacheName() {
         return null;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunAbstractTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunAbstractTest.java
new file mode 100644
index 0000000..28d297d
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunAbstractTest.java
@@ -0,0 +1,412 @@
+package org.apache.ignite.internal.processors.cache;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.Callable;
+import java.util.concurrent.atomic.AtomicBoolean;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.affinity.AffinityFunctionContext;
+import org.apache.ignite.cache.affinity.AffinityKeyMapped;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.IgniteInterruptedCheckedException;
+import org.apache.ignite.internal.binary.BinaryMarshaller;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
+import org.apache.ignite.internal.util.lang.GridAbsPredicate;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
+import org.apache.ignite.spi.failover.always.AlwaysFailoverSpi;
+import org.apache.ignite.testframework.GridTestUtils;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+
+/**
+ */
+public class IgniteCacheLockPartitionOnAffinityRunAbstractTest extends GridCacheAbstractSelfTest {
+    /** Count of affinity run threads. */
+    protected static final int AFFINITY_THREADS_CNT = 10;
+
+    /** Count of collocated objects. */
+    protected static final int PERS_AT_ORG_CNT = 10_000;
+
+    /** Name of the cache with special affinity function (all partition are placed on the first node). */
+    protected static final String OTHER_CACHE_NAME = "otherCache";
+
+    /** Grid count. */
+    protected static final int GRID_CNT = 4;
+
+    /** Count of restarted nodes. */
+    protected static final int RESTARTED_NODE_CNT = 2;
+
+    /** Count of objects. */
+    protected static final int ORGS_COUNT_PER_NODE = 2;
+
+    /** Test duration. */
+    protected static final long TEST_DURATION = 5 * 60_000;
+
+    /** Test timeout. */
+    protected static final long TEST_TIMEOUT = TEST_DURATION + 2 * 60_000;
+
+    /** Timeout between restart of a node. */
+    protected static final long RESTART_TIMEOUT = 3_000;
+
+    /** Max failover attempts. */
+    protected static final int MAX_FAILOVER_ATTEMPTS = 100;
+
+    /** Organization ids. */
+    protected static List<Integer> orgIds;
+
+    /** Test end time. */
+    protected static long endTime;
+
+    /** Node restart thread future. */
+    protected static IgniteInternalFuture<?> nodeRestartFut;
+
+    /** Stop a test flag . */
+    protected final AtomicBoolean stopRestartThread = new AtomicBoolean();
+
+    /** {@inheritDoc} */
+    @Override protected long getTestTimeout() {
+        return TEST_TIMEOUT;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
+
+        cfg.setMarshaller(new BinaryMarshaller());
+
+        AlwaysFailoverSpi failSpi = new AlwaysFailoverSpi();
+        failSpi.setMaximumFailoverAttempts(MAX_FAILOVER_ATTEMPTS);
+        cfg.setFailoverSpi(failSpi);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected Class<?>[] indexedTypes() {
+        return new Class<?>[] {
+            Integer.class, Organization.class,
+            Person.Key.class, Person.class,
+            Integer.class, Integer.class
+        };
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return ATOMIC;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected int gridCount() {
+        return GRID_CNT;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return PARTITIONED;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        super.beforeTestsStarted();
+
+        info("Fill caches begin...");
+
+        fillCaches();
+
+        info("Caches are filled");
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        grid(0).destroyCache(Organization.class.getSimpleName());
+        grid(0).destroyCache(Person.class.getSimpleName());
+        grid(0).destroyCache(OTHER_CACHE_NAME);
+        super.afterTestsStopped();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopRestartThread.set(true);
+        if (nodeRestartFut != null) {
+            nodeRestartFut.get();
+            nodeRestartFut = null;
+        }
+
+        Thread.sleep(3_000);
+
+        awaitPartitionMapExchange();
+
+        super.afterTest();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        endTime = System.currentTimeMillis() + TEST_DURATION;
+
+        super.beforeTest();
+    }
+
+    /**
+     * @param cacheName Cache name.
+     * @throws Exception If failed.
+     */
+    private void createCacheWithAffinity(String cacheName) throws Exception {
+        CacheConfiguration ccfg = cacheConfiguration(grid(0).name());
+        ccfg.setName(cacheName);
+
+        ccfg.setAffinity(new DummyAffinity());
+
+        grid(0).createCache(ccfg);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    private void fillCaches() throws Exception {
+        grid(0).createCache(Organization.class.getSimpleName());
+        grid(0).createCache(Person.class.getSimpleName());
+
+        createCacheWithAffinity(OTHER_CACHE_NAME);
+
+        awaitPartitionMapExchange();
+
+        orgIds = new ArrayList<>(ORGS_COUNT_PER_NODE * RESTARTED_NODE_CNT);
+
+        for (int i = GRID_CNT - RESTARTED_NODE_CNT; i < GRID_CNT; ++i)
+            orgIds.addAll(primaryKeys(grid(i).cache(Organization.class.getSimpleName()), ORGS_COUNT_PER_NODE));
+
+        try (
+            IgniteDataStreamer<Integer, Organization> orgStreamer =
+                grid(0).dataStreamer(Organization.class.getSimpleName());
+            IgniteDataStreamer<Person.Key, Person> persStreamer =
+                grid(0).dataStreamer(Person.class.getSimpleName())) {
+
+            int persId = 0;
+            for (int orgId : orgIds) {
+                Organization org = new Organization(orgId);
+                orgStreamer.addData(orgId, org);
+
+                for (int persCnt = 0; persCnt < PERS_AT_ORG_CNT; ++persCnt, ++persId) {
+                    Person pers = new Person(persId, orgId);
+                    persStreamer.addData(pers.createKey(), pers);
+                }
+            }
+        }
+
+        awaitPartitionMapExchange();
+    }
+
+    /**
+     *
+     */
+    protected void beginNodesRestart() {
+        stopRestartThread.set(false);
+        nodeRestartFut = GridTestUtils.runAsync(new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                int restartGrid = GRID_CNT - RESTARTED_NODE_CNT;
+                while (!stopRestartThread.get() && System.currentTimeMillis() < endTime) {
+                    log.info("Restart grid: " + restartGrid);
+                    stopGrid(restartGrid);
+                    Thread.sleep(500);
+                    startGrid(restartGrid);
+
+                    GridTestUtils.waitForCondition(new GridAbsPredicate() {
+                        @Override public boolean apply() {
+                            return !stopRestartThread.get();
+                        }
+                    }, RESTART_TIMEOUT);
+
+                    restartGrid++;
+                    if (restartGrid >= GRID_CNT)
+                        restartGrid = GRID_CNT - RESTARTED_NODE_CNT;
+                    awaitPartitionMapExchange();
+                }
+                return null;
+            }
+        }, "restart-node");
+    }
+
+    /**
+     * @param ignite Ignite.
+     * @param orgId Org id.
+     * @param expReservations Expected reservations.
+     * @throws Exception If failed.
+     */
+    protected static void checkPartitionsReservations(final IgniteEx ignite, int orgId,
+        final int expReservations) throws Exception {
+        int part = ignite.affinity(Organization.class.getSimpleName()).partition(orgId);
+
+        final GridDhtLocalPartition pPers = ignite.context().cache()
+            .internalCache(Person.class.getSimpleName()).context().topology()
+            .localPartition(part, AffinityTopologyVersion.NONE, false);
+
+        assertNotNull(pPers);
+
+        final GridDhtLocalPartition pOrgs = ignite.context().cache()
+            .internalCache(Organization.class.getSimpleName()).context().topology()
+            .localPartition(part, AffinityTopologyVersion.NONE, false);
+
+        assertNotNull(pOrgs);
+        GridTestUtils.waitForCondition(new GridAbsPredicate() {
+            @Override public boolean apply() {
+                return expReservations == pOrgs.reservations() && expReservations == pPers.reservations();
+            }
+        }, 1000L);
+        assertEquals("Unexpected reservations count", expReservations, pOrgs.reservations());
+        assertEquals("Unexpected reservations count", expReservations, pPers.reservations());
+    }
+
+    /** */
+    private static class DummyAffinity extends RendezvousAffinityFunction {
+        /**
+         * Default constructor.
+         */
+        public DummyAffinity() {
+            // No-op.
+        }
+
+        /** {@inheritDoc} */
+        @Override public List<List<ClusterNode>> assignPartitions(AffinityFunctionContext affCtx) {
+            List<ClusterNode> nodes = affCtx.currentTopologySnapshot();
+
+            List<List<ClusterNode>> assign = new ArrayList<>(partitions());
+
+            for (int i = 0; i < partitions(); ++i)
+                assign.add(Collections.singletonList(nodes.get(0)));
+
+            return assign;
+        }
+    }
+
+
+    /**
+     * Test class Organization.
+     */
+    public static class Organization implements Serializable {
+        /** */
+        @QuerySqlField(index = true)
+        private final int id;
+
+        /**
+         * @param id ID.
+         */
+        Organization(int id) {
+            this.id = id;
+        }
+
+        /**
+         * @return id.
+         */
+        int getId() {
+            return id;
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return S.toString(Organization.class, this);
+        }
+    }
+
+    /**
+     * Test class Organization.
+     */
+    public static class Person implements Serializable {
+        /** */
+        @QuerySqlField
+        private final int id;
+
+        /** */
+        @QuerySqlField(index = true)
+        private final int orgId;
+
+        /**
+         * @param id ID.
+         * @param orgId Organization ID.
+         */
+        Person(int id, int orgId) {
+            this.id = id;
+            this.orgId = orgId;
+        }
+
+        /**
+         * @return id.
+         */
+        int getId() {
+            return id;
+        }
+
+        /**
+         * @return organization id.
+         */
+        int getOrgId() {
+            return orgId;
+        }
+
+        /**
+         * @return Affinity key.
+         */
+        public Person.Key createKey() {
+            return new Person.Key(id, orgId);
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return S.toString(Person.class, this);
+        }
+
+        /**
+         *
+         */
+        static class Key implements Serializable {
+            /** Id. */
+            private final int id;
+
+            /** Org id. */
+            @AffinityKeyMapped
+            protected final int orgId;
+
+            /**
+             * @param id Id.
+             * @param orgId Org id.
+             */
+            private Key(int id, int orgId) {
+                this.id = id;
+                this.orgId = orgId;
+            }
+
+            /** {@inheritDoc} */
+            @Override public boolean equals(Object o) {
+                if (this == o)
+                    return true;
+                if (o == null || getClass() != o.getClass())
+                    return false;
+
+                Person.Key key = (Person.Key)o;
+
+                return id == key.id && orgId == key.orgId;
+            }
+
+            /** {@inheritDoc} */
+            @Override public int hashCode() {
+                int res = id;
+                res = 31 * res + orgId;
+                return res;
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunAtomicCacheOpTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunAtomicCacheOpTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunAtomicCacheOpTest.java
new file mode 100644
index 0000000..fb90c7e
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunAtomicCacheOpTest.java
@@ -0,0 +1,329 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.util.lang.GridAbsPredicate;
+import org.apache.ignite.lang.IgniteRunnable;
+import org.apache.ignite.resources.IgniteInstanceResource;
+import org.apache.ignite.resources.LoggerResource;
+import org.apache.ignite.testframework.GridTestUtils;
+
+/**
+ * Test to validate https://issues.apache.org/jira/browse/IGNITE-2310
+ */
+public class IgniteCacheLockPartitionOnAffinityRunAtomicCacheOpTest extends IgniteCacheLockPartitionOnAffinityRunAbstractTest {
+    /** Atomic cache. */
+    private static final String ATOMIC_CACHE = "atomic";
+    /** Transact cache. */
+    private static final String TRANSACT_CACHE = "transact";
+    /** Transact cache. */
+    private static final long TEST_TIMEOUT = 10 * 60_000;
+    /** Keys count. */
+    private static int KEYS_CNT = 100;
+    /** Keys count. */
+    private static int PARTS_CNT = 16;
+    /** Key. */
+    private static AtomicInteger key = new AtomicInteger(0);
+
+    /** {@inheritDoc} */
+    @Override protected long getTestTimeout() {
+        return TEST_TIMEOUT;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beginNodesRestart() {
+        stopRestartThread.set(false);
+        nodeRestartFut = GridTestUtils.runAsync(new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                while (!stopRestartThread.get() && System.currentTimeMillis() < endTime) {
+                    log.info("Restart nodes");
+                    for (int i = GRID_CNT - RESTARTED_NODE_CNT; i < GRID_CNT; ++i)
+                        stopGrid(i);
+                    Thread.sleep(500);
+                    for (int i = GRID_CNT - RESTARTED_NODE_CNT; i < GRID_CNT; ++i)
+                        startGrid(i);
+
+                    GridTestUtils.waitForCondition(new GridAbsPredicate() {
+                        @Override public boolean apply() {
+                            return !stopRestartThread.get();
+                        }
+                    }, RESTART_TIMEOUT);
+                }
+                return null;
+            }
+        }, "restart-node");
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception {
+        CacheConfiguration ccfg = super.cacheConfiguration(gridName);
+        ccfg.setBackups(0);
+
+        return  ccfg;
+    }
+
+    /**
+     * @param cacheName Cache name.
+     * @param mode Atomicity mode.
+     * @throws Exception If failed.
+     */
+    private void createCache(String cacheName, CacheAtomicityMode mode) throws Exception {
+        CacheConfiguration ccfg = cacheConfiguration(grid(0).name());
+        ccfg.setName(cacheName);
+
+        ccfg.setAtomicityMode(mode);
+
+        ccfg.setAffinity(new RendezvousAffinityFunction(false, PARTS_CNT));
+
+        grid(0).createCache(ccfg);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        key.set(0);
+        createCache(ATOMIC_CACHE, CacheAtomicityMode.ATOMIC);
+        createCache(TRANSACT_CACHE, CacheAtomicityMode.TRANSACTIONAL);
+
+        awaitPartitionMapExchange();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        grid(0).destroyCache(ATOMIC_CACHE);
+        grid(0).destroyCache(TRANSACT_CACHE);
+
+        super.afterTest();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testNotReservedAtomicCacheOp() throws Exception {
+        notReservedCacheOp(ATOMIC_CACHE);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testNotReservedTxCacheOp() throws Exception {
+        notReservedCacheOp(TRANSACT_CACHE);
+    }
+
+    /**
+     * @param cacheName Cache name.
+     * @throws Exception If failed.
+     */
+    private void notReservedCacheOp(final String cacheName) throws Exception {
+        // Workaround for initial update job metadata.
+        grid(0).compute().affinityRun(
+            Arrays.asList(Person.class.getSimpleName(), Organization.class.getSimpleName()),
+            new Integer(orgIds.get(0)),
+            new NotReservedCacheOpAffinityRun(0, 0, cacheName));
+
+        // Run restart threads: start re-balancing
+        beginNodesRestart();
+
+        grid(0).cache(cacheName).clear();
+
+        IgniteInternalFuture<Long> affFut = null;
+        try {
+            affFut = GridTestUtils.runMultiThreadedAsync(new Runnable() {
+                @Override public void run() {
+                    for (int i = 0; i < PARTS_CNT; ++i) {
+                        grid(0).compute().affinityRun(
+                            Arrays.asList(Organization.class.getSimpleName(), Person.class.getSimpleName()),
+                            new Integer(i),
+                            new NotReservedCacheOpAffinityRun(i, key.getAndIncrement() * KEYS_CNT, cacheName));
+                    }
+                }
+            }, AFFINITY_THREADS_CNT, "affinity-run");
+        }
+        finally {
+            if (affFut != null)
+                affFut.get();
+
+            stopRestartThread.set(true);
+            nodeRestartFut.get();
+
+            Thread.sleep(5000);
+
+            log.info("Final await. Timed out if failed");
+            awaitPartitionMapExchange();
+
+            IgniteCache cache = grid(0).cache(cacheName);
+            cache.clear();
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testReservedPartitionCacheOp() throws Exception {
+        // Workaround for initial update job metadata.
+        grid(0).cache(Person.class.getSimpleName()).clear();
+        grid(0).compute().affinityRun(
+            Arrays.asList(Person.class.getSimpleName(), Organization.class.getSimpleName()),
+            0,
+            new ReservedPartitionCacheOpAffinityRun(0, 0));
+
+        // Run restart threads: start re-balancing
+        beginNodesRestart();
+
+        IgniteInternalFuture<Long> affFut = null;
+        try {
+            affFut = GridTestUtils.runMultiThreadedAsync(new Runnable() {
+                @Override public void run() {
+                    for (int i = 0; i < PARTS_CNT; ++i) {
+                        if (System.currentTimeMillis() >= endTime)
+                            break;
+
+                        grid(0).compute().affinityRun(
+                            Arrays.asList(Organization.class.getSimpleName(), Person.class.getSimpleName()),
+                            new Integer(i),
+                            new ReservedPartitionCacheOpAffinityRun(i, key.getAndIncrement() * KEYS_CNT));
+                    }
+                }
+            }, AFFINITY_THREADS_CNT, "affinity-run");
+        }
+        finally {
+            if (affFut != null)
+                affFut.get();
+
+            stopRestartThread.set(true);
+            nodeRestartFut.get();
+
+            Thread.sleep(5000);
+
+            log.info("Final await. Timed out if failed");
+            awaitPartitionMapExchange();
+
+            IgniteCache cache = grid(0).cache(Person.class.getSimpleName());
+            cache.clear();
+        }
+    }
+
+    /** */
+    private static class NotReservedCacheOpAffinityRun implements IgniteRunnable {
+        /** Org id. */
+        int orgId;
+
+        /** Begin of key. */
+        int keyBegin;
+
+        /** Cache name. */
+        private String cacheName;
+
+        /** */
+        @IgniteInstanceResource
+        private IgniteEx ignite;
+
+        /** */
+        @LoggerResource
+        private IgniteLogger log;
+
+        /** */
+        public NotReservedCacheOpAffinityRun() {
+            // No-op.
+        }
+
+        /**
+         * @param orgId Organization.
+         * @param keyBegin Begin key value.
+         * @param cacheName Cache name.
+         */
+        public NotReservedCacheOpAffinityRun(int orgId, int keyBegin, String cacheName) {
+            this.orgId = orgId;
+            this.keyBegin = keyBegin;
+            this.cacheName = cacheName;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void run() {
+            log.info("Begin run " + keyBegin);
+            IgniteCache cache = ignite.cache(cacheName);
+            Map<Integer, Integer> vals = new HashMap<>();
+
+            for (int i = 0; i < KEYS_CNT; ++i)
+                cache.put(i + keyBegin, i + keyBegin);
+//                vals.put(i + keyBegin, i + keyBegin);
+
+//            cache.putAll(vals);
+            log.info("End run " + keyBegin);
+        }
+    }
+
+    /** */
+    private static class ReservedPartitionCacheOpAffinityRun implements IgniteRunnable {
+        /** Org id. */
+        int orgId;
+
+        /** Begin of key. */
+        int keyBegin;
+
+        /** */
+        @IgniteInstanceResource
+        private IgniteEx ignite;
+
+        /** */
+        @LoggerResource
+        private IgniteLogger log;
+
+        /** */
+        public ReservedPartitionCacheOpAffinityRun() {
+            // No-op.
+        }
+
+        /**
+         * @param orgId Organization Id.
+         * @param keyBegin Begin key value;
+         */
+        public ReservedPartitionCacheOpAffinityRun(int orgId, int keyBegin) {
+            this.orgId = orgId;
+            this.keyBegin = keyBegin;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void run() {
+            log.info("Begin run " + keyBegin);
+            IgniteCache cache = ignite.cache(Person.class.getSimpleName());
+            Map<Person.Key, Person> pers = new HashMap<>();
+
+            for (int i = 0; i < KEYS_CNT; ++i) {
+                Person p = new Person(i + keyBegin, orgId);
+//                pers.put(p.createKey(), p);
+                cache.put(p.createKey(), p);
+            }
+
+//            cache.putAll(pers);
+        }
+    }
+}
\ No newline at end of file


[13/19] ignite git commit: Revert "version changed to: 1.6.4"

Posted by an...@apache.org.
Revert "version changed to: 1.6.4"

This reverts commit d945a5dd89b01f05a59e2b02fb86c1007736aff9.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/151dfa78
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/151dfa78
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/151dfa78

Branch: refs/heads/master
Commit: 151dfa7878d7d013cd93fac9d627bbdeb1ef8e18
Parents: e1262b2
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Aug 10 09:48:29 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Aug 10 09:48:29 2016 +0300

----------------------------------------------------------------------
 RELEASE_NOTES.txt                               | 312 ++++---------------
 examples/pom-standalone-lgpl.xml                |   7 -
 examples/pom-standalone.xml                     |   7 -
 examples/pom.xml                                |   2 +-
 examples/schema-import/pom-standalone.xml       |   7 -
 examples/schema-import/pom.xml                  |   2 +-
 modules/aop/pom.xml                             |   2 +-
 modules/apache-license-gen/pom.xml              |   2 +-
 modules/aws/pom.xml                             |   2 +-
 modules/benchmarks/pom.xml                      |   2 +-
 modules/camel/pom.xml                           |   2 +-
 modules/cassandra/pom.xml                       |   2 +-
 modules/clients/pom.xml                         |   2 +-
 modules/cloud/pom.xml                           |   2 +-
 modules/codegen/pom.xml                         |   2 +-
 modules/core/pom.xml                            |   4 +-
 modules/extdata/p2p/pom.xml                     |   2 +-
 .../extdata/uri/modules/uri-dependency/pom.xml  |   2 +-
 modules/extdata/uri/pom.xml                     |   2 +-
 modules/flink/pom.xml                           |   2 +-
 modules/flume/pom.xml                           |   2 +-
 modules/gce/pom.xml                             |   2 +-
 modules/geospatial/pom.xml                      |   2 +-
 modules/hadoop/pom.xml                          |   2 +-
 modules/hibernate/pom.xml                       |   2 +-
 modules/indexing/pom.xml                        |   2 +-
 modules/jcl/pom.xml                             |   2 +-
 modules/jms11/pom.xml                           |   2 +-
 modules/jta/pom.xml                             |   2 +-
 modules/kafka/pom.xml                           |   2 +-
 modules/log4j/pom.xml                           |   2 +-
 modules/log4j2/pom.xml                          |   2 +-
 modules/mesos/pom.xml                           |   2 +-
 modules/mqtt/pom.xml                            |   2 +-
 modules/osgi-karaf/pom.xml                      |   2 +-
 modules/osgi-paxlogging/pom.xml                 |   2 +-
 modules/osgi/pom.xml                            |   2 +-
 modules/rest-http/pom.xml                       |   2 +-
 modules/scalar-2.10/pom.xml                     |   2 +-
 modules/scalar/pom.xml                          |   2 +-
 modules/schedule/pom.xml                        |   2 +-
 modules/schema-import-db/pom.xml                |   2 +-
 modules/schema-import/pom.xml                   |   2 +-
 modules/slf4j/pom.xml                           |   2 +-
 modules/spark-2.10/pom.xml                      |   2 +-
 modules/spark/pom.xml                           |   2 +-
 modules/spring/pom.xml                          |   2 +-
 modules/ssh/pom.xml                             |   2 +-
 modules/storm/pom.xml                           |   2 +-
 modules/tools/pom.xml                           |   2 +-
 modules/twitter/pom.xml                         |   2 +-
 modules/urideploy/pom.xml                       |   2 +-
 modules/visor-console-2.10/pom.xml              |   2 +-
 modules/visor-console/pom.xml                   |   2 +-
 modules/visor-plugins/pom.xml                   |   2 +-
 modules/web-agent/pom.xml                       |   2 +-
 modules/web-console/pom.xml                     |   2 +-
 modules/web/ignite-appserver-test/pom.xml       |   2 +-
 modules/web/ignite-websphere-test/pom.xml       |   2 +-
 modules/web/pom.xml                             |   2 +-
 modules/yardstick/pom.xml                       |   2 +-
 modules/yarn/pom.xml                            |   2 +-
 modules/zookeeper/pom.xml                       |   2 +-
 pom.xml                                         |   4 +-
 64 files changed, 129 insertions(+), 328 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index 67b18ad..cef51bd 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -1,23 +1,8 @@
-GridGain In-Memory Data Fabric Professional Edition Release Notes
-=======================================
+Apache Ignite Release Notes
+===========================
 
-GridGain In-Memory Data Fabric Professional Edition 1.6.4
-------------------------------------
-* Fixed a bug in GridCacheTtlManager.
-* Added basic implementation of address resolver.
-
-GridGain In-Memory Data Fabric Professional Edition 1.6.3
-------------------------------------
-* .NET: Fixed a bug in IBinaryObjectBuilder causing type name to be lost.
-
-GridGain In-Memory Data Fabric Professional Edition 1.6.2
-------------------------------------
-* Fixed CountDownLatch recreation.
-* CPP: Fixed string deserialization performance issue.
-* .NET: Added NuGet distribution.
-
-GridGain In-Memory Data Fabric Professional Edition 1.6.1
-------------------------------------
+Apache Ignite In-Memory Data Fabric 1.6
+---------------------------------------
 Ignite .NET:
 * Added LINQ Provider for cache SQL queries
 * Added native configuration mechanism (C#, app.config, web.config - instead of Spring XML)
@@ -35,218 +20,77 @@ Ignite C++:
 * Simplified Autotools build process for C++ client.
 
 Ignite:
+* Added ability to get partition 'updateCntr' with continuous query public API.
+* Added asynchronous execution of ContinuousQuery's remote filter and local listener.
+* Added backup partitions storing to local store default behavior.
+* Added cache deadlock detection.
 * Added Cache Store implementation backed by Cassandra DB.
+* Added method to get versioned cache entry.
 * Added ODBC driver for Ignite.
+* Added support for join timeout while registering local addresses with IP finder in TcpDiscoverySpi.
+* Added support for JTA transactions via synchronization callback.
 * Added Web Console for Ignite.
-* ODBC: Added decimal type support.
-
-Changes in GridGain In-Memory Data Fabric Professional Edition 1.5.30
-------------------------------------
-* Ignite Cache: new API that lets calculating size per particular partition.
-* Visor CMD: Added skip confirm in batch mode. Improved kill command.
-* Hadoop: Implemented new weight-based map-reduce planner (IgniteHadoopWeightedMapReducePlanner).
-* .NET: Added ability to implement custom affintiy functions.
-* Added support of EXPIRED events to continuous queries.
-* Data Streamer: ability to set timeout for a number of methods.
-* Fixed NPE in Ignite Services internals that happened when a service was executed before system cache was started.
-* Fixed NPE in OptimizedMarshaller when pool of streams is used.
-* Fixed the issue when it wasn't possible to deserialize an object on Java side if the object was placed in the cache on C++ or .Net side.
-* Fixed SQL indexes processing under Java 8.
-
-GridGain In-Memory Data Fabric Professional Edition 1.5.29
-------------------------------------
-* Binary objects: performance improvements.
-* IGFS: Performance and usability improvements.
-* Fixed issue with unnecessary discovery messages resend that may cause slow discovery message delivery.
-* Fixed possible IO message loss during reconnect.
-* Additional system properties for troubleshooting logging.
-* Fixed issue when job ID was generated in a non unique way.
-
-GridGain In-Memory Data Fabric Professional Edition 1.5.28
-------------------------------------
-* IGFS: Usability improvements.
-* Fixed performance degradation when a cache is preloaded from many IgniteDataStreamers in parallel from the same node.
-* Fixed issue with service redeployment after topology change.
-
-GridGain In-Memory Data Fabric Professional Edition 1.5.27
-------------------------------------
-* IGFS: Fixed a problem with native libraries loading.
-* REST HTTP: Updated from json-lib 2.4 to Jackson 2.7.5.
-* External addresses are now registered in IP finder.
-* Client node's addresses are now not registered in IP finder.
-
-GridGain In-Memory Data Fabric Professional Edition 1.5.26
-------------------------------------
-* IGFS: Performance improvements.
-* Spark: added IgniteRDD.withKeepBinary() method for full support of binary objects.
-* Added Cassandra-based persistent store implementation.
-* Continuous queries: warning will be printed on client nodes instead of exception trace if the remote filter is not in classpath.
-* Fixed missing IgniteCountdownLatch updates that can lead to a deadlock or wrong behavior.
-* Fixed local store conflict resolving with keepBinary flag set to false.
-* Fixed addresses duplication at IP finder.
-* ZookeeperIpFinder now properly handles reconnects.
-
-GridGain In-Memory Data Fabric Professional Edition 1.5.25
-------------------------------------
-* IGFS: Performance improvements for client mode.
-* Hadoop: fixed inefficient memory usage during mapper output processing.
-* Fixed marshalling of arrays of primitives types when their are being placed into a cache.
-* Spark: added transformer closure to savePairs(..) and saveValues(..) methods of IgniteRDD.
-* Spark: fixed support for java.sql.Date in queries executed from IgniteRDD.
-
-GridGain In-Memory Data Fabric Professional Edition 1.5.24
-------------------------------------
-* IGFS: Added user name mapper to properly deal with security in complex Hadoop environments.
-* Validating that the same IgniteConfiguration instance is not used more than once.
-* Fixed marshalling of Void type with Binary marshaller.
-* Fixed metrics calculation for OFFHEAP_TIRED mode.
-* ScanQuery and localEntries now honor keepBinary flag.
-* Zookeeper module dependencies set fixed.
-
-GridGain In-Memory Data Fabric Professional Edition 1.5.23
-------------------------------------
-* IGFS: Improved error logging for operations in DUAL mode.
-* Added Ignition.getOrStart method.
-* Spark: support BigDecimal for queries executed from IgniteRDD.
-* Mesos integration: added possibility to configure http server timeout.
-* Fixed a bug with Ignite API usage during node stop.
-* Fixed a bug with 'keepBinary' handling for CacheInterceptor.
-* Fixed a bug with CacheEntryEvent cleanup for filtered events.
-* Fixed a bug with broken synchronization between cache entry expiration and update.
-
-GridGain In-Memory Data Fabric Professional Edition 1.5.22
-------------------------------------
-* Fixed UTF-16 surrogate pairs marshalling.
-* Fixed local store behavior at cross cache transactions.
-* Fixed memory leak in IgniteH2Indexing.
-* Added backup partitions storing to local store default behavior.
-* ScanQueries over local partitions performance optimisation.
-* Visor CMD: Added ability to attach custom scripts to alerts.
-* WebSession: fixed a bug causing invalidated session to be returned from HttpServletRequest.getSession() call.
-* Hadoop: fixed a bug causing exception during job resource unpacking.
-
-GridGain In-Memory Data Fabric Professional Edition 1.5.21
-------------------------------------
-* Web sessions: minor fix to prevent NullPointerException in some special case.
-
-GridGain In-Memory Data Fabric Professional Edition 1.5.20
-------------------------------------
-* Web sessions: user session classes are no longer needed on server nodes.
-
-GridGain In-Memory Data Fabric Professional Edition 1.5.19
-------------------------------------
-* Added cache deadlock detection.
 * Fixed a bug causing object deserialization when local store is configured for cache.
 * Fixed a problem with incorrect classloader picked in OSGI environment.
-* Hadoop: fixed a bug causing exception during MR planning when input split file doesn't exist.
-
-GridGain In-Memory Data Fabric Professional Edition 1.5.18
-------------------------------------
-* Fixed potential thread starvation during cache rebalancing.
-* Fixed deadlock in services deployment when Spring is used.
-* Mesos integration: added possibility to load Ignite package from file system.
-
-GridGain In-Memory Data Fabric Professional Edition 1.5.17
-------------------------------------
-* Performance optimization for transactions that do not acquire locks.
-* Optimized memory usage on server nodes to allow more client connections.
-* Added support for join timeout while registering local addresses with IP finder in TcpDiscoverySpi.
-
-GridGain In-Memory Data Fabric Professional Edition 1.5.16
-------------------------------------
-* Added asynchronous execution of ContinuousQuery's remote filter and local listener.
-
-GridGain In-Memory Data Fabric Professional Edition 1.5.15
-------------------------------------
-* Fixed discovery and node start procedure issues that may cause slowdowns during larger topologies start (>100 nodes).
-
-GridGain In-Memory Data Fabric Professional Edition 1.5.14
-------------------------------------
 * Fixed a race condition when evicted offheap data was not delivered to query engine leading to query timeout.
-
-GridGain In-Memory Data Fabric Professional Edition 1.5.12
-------------------------------------
-* Improved marshaller behavior during cluster topology change.
-* .NET: Added ability to use Java-based remote filters in continuous queries.
-
-GridGain In-Memory Data Fabric Professional Edition 1.5.11
-------------------------------------
-* Fixed cluster stability with 500+ clients.
+* Fixed an issue in ContinuousQueries that caused missing of notifications.
 * Fixed background cache partition map exchange not to flood network.
-* Fixed BinaryObjectOffHeapImpl leak to public code.
 * Fixed BinaryContext to honor custom loader set through IgniteConfiguration.
-* Fixed continuous query not to call listener with empty set of events.
-* IGFS: Massive performance and stability fixes.
-* Many stability and fault-tolerance fixes.
-
-GridGain In-Memory Data Fabric Professional Edition 1.5.10
-------------------------------------
-* Fixed continuous query listener notification handling.
-
-GridGain In-Memory Data Fabric Community Edition 1.5.9
----------------------------------------
-* Fixed issue with AWS dependencies.
-* Fixed excessive thread stack usage in case of high contention on cache entries.
+* Fixed BinaryObjectOffHeapImpl leak to public code.
+* Fixed cluster stability with 500+ clients.
 * Fixed continuous queries to send filter factory instead of filter.
-* Fixed NPE during rebalancing.
-* Fixed system caches not to use user-defined TransactionConfiguration.
+* Fixed continuous query deployment in case originating node has left.
+* Fixed issues with continuous query.
+* Fixed deadlock in services deployment when Spring is used.
+* Fixed discovery and node start procedure issues that may cause slowdowns during larger topologies start (>100 nodes).
+* Fixed eviction policy notification if swap or off heap is enabled and an entry is not loaded during preloading.
+* Fixed excessive thread stack usage in case of high contention on cache entries.
+* Fixed execution of Splunk MapReduce jobs on top of Ignite MR.
 * Fixed GridClosureProcessor internal closures to be deserialized by BinaryMarshaller.
-* Fixed web session clustering with WebLogic.
-* Fixed value copying in entry processor with OptimizedMarshaller.
-* Fixed continuous query listener notification during concurrent key put.
-* Fixed service proxy not to make remote call for methods declared in java.lang.Object.
-* Added support for JTA transactions via synchronization callback.
-
-GridGain In-Memory Data Fabric Community Edition 1.5.8
----------------------------------------
+* Fixed issue with AWS dependencies.
 * Fixed java proxies deserialization with optimized marshaller.
-* Fixed excessive thread stack usage in case of high contention on cache entries.
-* Fixed SKIP_STORE flag behavior for transaction entry.
-* Fixed thread safety for TcpDiscoveryMulticastIpFinder.
-* IGFS: Fixed file properties when running over secondary file system.
-* IGFS: Fixed issues with Kerberized HDFS.
-
-GridGain In-Memory Data Fabric Community Edition 1.5.7
----------------------------------------
-* Added method to get versioned cache entry.
-* Added ability to get partition 'updateCntr' with continuous query public API.
-* Fixed several ClassNotFoundException in OSGi environment.
-* Fixed continuous query notification with single node topology.
-* Fixed continuous query notification with cache listeners.
-* Fixed continuous query deployment in case originating node has left.
+* Fixed local store behavior at cross cache transactions.
+* Fixed marshalling of Java collection and maps for BinaryMarshaller.
+* Fixed memory leak in IgniteH2Indexing.
+* Fixed NPE during rebalancing.
 * Fixed NPE in GridMergeIndex.
-* Fixed race condition on load cache on changing topology.
 * Fixed OOME when OFFHEAP_TIERED mode is used.
+* Fixed potential thread starvation during cache rebalancing.
+* Fixed race condition on load cache on changing topology.
+* Fixed race in marshalling logic that could arise when several nodes are running on the same host.
+* Fixed redeployment issues happened with ScanQueries filters.
+* Fixed service proxy not to make remote call for methods declared in java.lang.Object.
+* Fixed several ClassNotFoundException in OSGi environment.
+* Fixed SKIP_STORE flag behavior for transaction entry.
 * Fixed support for classes with equal simple name for binary marshaller.
-
-GridGain In-Memory Data Fabric Community Edition 1.5.6
----------------------------------------
-* Support of package-private implementations for Ignite Services.
-* Fixed unintentional deserialization of BinaryObjects in OFFHEAP mode with peer class loading enabled.
-
-GridGain In-Memory Data Fabric Community Edition 1.5.5
----------------------------------------
+* Fixed system caches not to use user-defined TransactionConfiguration.
 * Fixed the issue when CacheStore was updated even if EntryProcessor didn't update an entry.
-* Fixed execution of Splunk MapReduce jobs on top of Ignite MR.
-
-GridGain In-Memory Data Fabric Community Edition 1.5.4
----------------------------------------
-* Passed update notifier flag to discovery data to be sure that all cluster nodes have the same notifier status as the first node.
+* Fixed thread safety for TcpDiscoveryMulticastIpFinder.
+* Fixed unintentional deserialization of BinaryObjects in OFFHEAP mode with peer class loading enabled.
+* Fixed UTF-16 surrogate pairs marshalling.
+* Fixed value copying in entry processor with OptimizedMarshaller.
+* Fixed web session clustering with WebLogic.
+* Hadoop: fixed a bug causing exception during MR planning when input split file doesn't exist.
+* IGFS: Added configuration flag to disable default path modes under "/ignite" folder.
+* IGFS: Added pluggable factory interface for Hadoop FileSystem creation.
+* IGFS: Fixed file properties when running over secondary file system.
+* IGFS: Fixed issues with Kerberized HDFS.
+* IGFS: Massive performance and stability fixes.
+* Improved marshaller behavior during cluster topology change.
+* Mesos integration: added possibility to load Ignite package from file system.
 * Optimized cache 'get' operations on affinity node.
+* Optimized memory usage on server nodes to allow more client connections.
+* Passed update notifier flag to discovery data to be sure that all cluster nodes have the same notifier status as the first node.
+* Performance optimization for transactions that do not acquire locks.
+* ScanQueries over local partitions performance optimisation.
+* Support of package-private implementations for Ignite Services.
 * Supported Ignite Compute tasks cancellation for Ignite.NET.
-* Fixed race in marshalling logic that could arise when several nodes are running on the same host.
-* Fixed marshalling of Java collection and maps for BinaryMarshaller.
-* Fixed eviction policy notification if swap or off heap is enabled and an entry is not loaded during preloading.
-* Fixed redeployment issues happened with ScanQueries filters.
-* Fixed an issue in ContinuousQueries that caused missing of notifications.
-
-GridGain In-Memory Data Fabric Community Edition 1.5.3
----------------------------------------
-* IGFS: Added pluggable factory interface for Hadoop FileSystem creation.
-* IGFS: Added configuration flag to disable default path modes under "/ignite" folder.
-* IGFS: Various stability fixes.
+* Visor CMD: Added ability to attach custom scripts to alerts.
+* Web sessions: minor fix to prevent NullPointerException in some special case.
+* Web sessions: user session classes are no longer needed on server nodes.
+* A lot of stability and fault-tolerance fixes.
 
-GridGain In-Memory Data Fabric Community Edition 1.5.1
+Apache Ignite In-Memory Data Fabric 1.5
 ---------------------------------------
 * Ignite.NET: Initial Release.
 * Ignite C++: Initial Release.
@@ -269,12 +113,14 @@ GridGain In-Memory Data Fabric Community Edition 1.5.1
 
 Complete list of closed issues: https://issues.apache.org/jira/issues/?jql=project%20%3D%20IGNITE%20AND%20fixVersion%20%3D%201.5%20AND%20status%20%3D%20closed
 
-GridGain In-Memory Data Fabric Community Edition 1.4.1
+Apache Ignite In-Memory Data Fabric 1.4
 ---------------------------------------
 * Added SSL support to communication and discovery.
 * Added support for log4j2.
 * Added versioned entry to cache API.
 * Added client node based JDBC driver implementation.
+* Fixed consistency issue for custom events processing within discovery.
+* Fixed race in cache swap/unswap logic.
 * Fixed IGNITE_HOME resolution with JBoss.
 * Fixed configuration file resolution on classpath.
 * Fixed MBean registration for caches.
@@ -285,39 +131,21 @@ GridGain In-Memory Data Fabric Community Edition 1.4.1
 * Fixed affinity routing in compute grid.
 * Many stability and fault-tolerance fixes.
 
-GridGain In-Memory Data Fabric Community Edition 1.3.3
----------------------------------------
-
-* Added SSL support to communication and discovery.
-* Fixed IGNITE_HOME resolution with JBoss.
-* Fixed configuration file resolution on classpath.
-* Fixed MBean registration for caches.
-* Many stability and fault-tolerance fixes.
-
-GridGain In-Memory Data Fabric Community Edition 1.3.1
+Apache Ignite In-Memory Data Fabric 1.3
 ---------------------------------------
 
 * Added auto-retries for cache operations in recoverable cases.
 * Added integration with Apache YARN.
+* Added auto detection and dropping of slow client nodes.
 * Fixed several issues with JTA integration.
 * Fixed several issues with Hibernate L2 cache.
+* Fixed issue with GAR files in source release.
 * Stability fixes for TCP discovery SPI.
 * Stability fixes for onheap and offheap SQL queries.
 * Bug fixes in In-Memory Accelerator For Apache Hadoop.
 * Many stability and fault-tolerance fixes.
 
-GridGain In-Memory Data Fabric Community Edition 1.1.4
----------------------------------------
-
-* Added dropping of slow clients.
-* Fixed several connectivity issues.
-
-GridGain In-Memory Data Fabric Community Edition 1.1.3
----------------------------------------
-
-* Fixed cache store configuration validation.
-
-GridGain In-Memory Data Fabric Community Edition 1.1.2
+Apache Ignite In-Memory Data Fabric 1.2
 ---------------------------------------
 
 * Added client mode to TCP discovery SPI.
@@ -329,13 +157,7 @@ GridGain In-Memory Data Fabric Community Edition 1.1.2
 * Bug fixes in In-Memory Accelerator For Apache Hadoop.
 * Many stability and fault-tolerance fixes.
 
-GridGain In-Memory Data Fabric Community Edition 1.0.5
----------------------------------------
-
-* Fixed unnecessary value sending for near cache with near lock response
-* Optimized getOrCreateCache methods for case when cache is already started locally
-
-GridGain In-Memory Data Fabric Community Edition 1.0.4
+Apache Ignite In-Memory Data Fabric 1.1
 ---------------------------------------
 
 * Added Google Compute Engine TCP discovery IP finder.
@@ -355,7 +177,7 @@ GridGain In-Memory Data Fabric Community Edition 1.0.4
 * Made deployment scanners for URI-based deployment pluggable.
 * Many stability and fault-tolerance fixes.
 
-GridGain In-Memory Data Fabric Community Edition 1.0
+Apache Ignite In-Memory Data Fabric 1.0
 ---------------------------------------
 
 * Simplified query API.
@@ -371,7 +193,7 @@ GridGain In-Memory Data Fabric Community Edition 1.0
 * Added ability to automatically exclude LGPL optional dependencies during build.
 
 
-GridGain In-Memory Data Fabric Community Edition 1.0 RC3
+Apache Ignite In-Memory Data Fabric 1.0 RC3
 -------------------------------------------
 
 This is the first release of Apache Ignite project. The source code in large part is based

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/examples/pom-standalone-lgpl.xml
----------------------------------------------------------------------
diff --git a/examples/pom-standalone-lgpl.xml b/examples/pom-standalone-lgpl.xml
index 73bbc69..7e7ccc2 100644
--- a/examples/pom-standalone-lgpl.xml
+++ b/examples/pom-standalone-lgpl.xml
@@ -26,13 +26,6 @@
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
 
-    <repositories>
-        <repository>
-            <id>GridGain External Repository</id>
-            <url>http://www.gridgainsystems.com/nexus/content/repositories/external</url>
-        </repository>
-    </repositories>
-
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/examples/pom-standalone.xml
----------------------------------------------------------------------
diff --git a/examples/pom-standalone.xml b/examples/pom-standalone.xml
index b01d67a..6247ced 100644
--- a/examples/pom-standalone.xml
+++ b/examples/pom-standalone.xml
@@ -26,13 +26,6 @@
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
 
-    <repositories>
-        <repository>
-            <id>GridGain External Repository</id>
-            <url>http://www.gridgainsystems.com/nexus/content/repositories/external</url>
-        </repository>
-    </repositories>
-
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/examples/pom.xml
----------------------------------------------------------------------
diff --git a/examples/pom.xml b/examples/pom.xml
index 203e1d3..979a46f 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -28,7 +28,7 @@
     </parent>
 
     <artifactId>ignite-examples</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/examples/schema-import/pom-standalone.xml
----------------------------------------------------------------------
diff --git a/examples/schema-import/pom-standalone.xml b/examples/schema-import/pom-standalone.xml
index 95c8a9d..e443728 100644
--- a/examples/schema-import/pom-standalone.xml
+++ b/examples/schema-import/pom-standalone.xml
@@ -26,13 +26,6 @@
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
 
-    <repositories>
-        <repository>
-            <id>GridGain External Repository</id>
-            <url>http://www.gridgainsystems.com/nexus/content/repositories/external</url>
-        </repository>
-    </repositories>
-
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     </properties>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/examples/schema-import/pom.xml
----------------------------------------------------------------------
diff --git a/examples/schema-import/pom.xml b/examples/schema-import/pom.xml
index 6c5a957..b6e36ef 100644
--- a/examples/schema-import/pom.xml
+++ b/examples/schema-import/pom.xml
@@ -35,7 +35,7 @@
     </properties>
 
     <artifactId>ignite-schema-import-demo</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/aop/pom.xml
----------------------------------------------------------------------
diff --git a/modules/aop/pom.xml b/modules/aop/pom.xml
index a3b2727..eaebaf2 100644
--- a/modules/aop/pom.xml
+++ b/modules/aop/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-aop</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/apache-license-gen/pom.xml
----------------------------------------------------------------------
diff --git a/modules/apache-license-gen/pom.xml b/modules/apache-license-gen/pom.xml
index cdf15fb..53b1a8f 100644
--- a/modules/apache-license-gen/pom.xml
+++ b/modules/apache-license-gen/pom.xml
@@ -31,7 +31,7 @@
 
     <groupId>org.apache.ignite</groupId>
     <artifactId>ignite-apache-license-gen</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <build>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/aws/pom.xml
----------------------------------------------------------------------
diff --git a/modules/aws/pom.xml b/modules/aws/pom.xml
index 04e9585..2aee655 100644
--- a/modules/aws/pom.xml
+++ b/modules/aws/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-aws</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/benchmarks/pom.xml
----------------------------------------------------------------------
diff --git a/modules/benchmarks/pom.xml b/modules/benchmarks/pom.xml
index 28c2ed1..00315a8 100644
--- a/modules/benchmarks/pom.xml
+++ b/modules/benchmarks/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-benchmarks</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <properties>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/camel/pom.xml
----------------------------------------------------------------------
diff --git a/modules/camel/pom.xml b/modules/camel/pom.xml
index 52ba091..f40ff62 100644
--- a/modules/camel/pom.xml
+++ b/modules/camel/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-camel</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <properties>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/cassandra/pom.xml
----------------------------------------------------------------------
diff --git a/modules/cassandra/pom.xml b/modules/cassandra/pom.xml
index 77a4414..dc8b08c 100644
--- a/modules/cassandra/pom.xml
+++ b/modules/cassandra/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-cassandra</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <properties>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/clients/pom.xml
----------------------------------------------------------------------
diff --git a/modules/clients/pom.xml b/modules/clients/pom.xml
index bb53662..fa25d18 100644
--- a/modules/clients/pom.xml
+++ b/modules/clients/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-clients</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/cloud/pom.xml
----------------------------------------------------------------------
diff --git a/modules/cloud/pom.xml b/modules/cloud/pom.xml
index 6ebc61c..8232d00 100644
--- a/modules/cloud/pom.xml
+++ b/modules/cloud/pom.xml
@@ -29,7 +29,7 @@
     </parent>
 
     <artifactId>ignite-cloud</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <properties>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/codegen/pom.xml
----------------------------------------------------------------------
diff --git a/modules/codegen/pom.xml b/modules/codegen/pom.xml
index ef21c6b..aff0d3a 100644
--- a/modules/codegen/pom.xml
+++ b/modules/codegen/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-codegen</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <properties>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/core/pom.xml
----------------------------------------------------------------------
diff --git a/modules/core/pom.xml b/modules/core/pom.xml
index d287967..5e32caf 100644
--- a/modules/core/pom.xml
+++ b/modules/core/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-core</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <repositories>
@@ -42,7 +42,7 @@
     </repositories>
 
     <properties>
-        <ignite.update.notifier.product>gridgain-community</ignite.update.notifier.product>
+        <ignite.update.notifier.product>apache-ignite</ignite.update.notifier.product>
 
         <!-- Imports:
                 - com.sun.jmx.mbeanserver => only used from TCKMBeanServerBuilder which has no usages within Ignite's

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/extdata/p2p/pom.xml
----------------------------------------------------------------------
diff --git a/modules/extdata/p2p/pom.xml b/modules/extdata/p2p/pom.xml
index 820c0b6..9bebf74 100644
--- a/modules/extdata/p2p/pom.xml
+++ b/modules/extdata/p2p/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-extdata-p2p</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/extdata/uri/modules/uri-dependency/pom.xml
----------------------------------------------------------------------
diff --git a/modules/extdata/uri/modules/uri-dependency/pom.xml b/modules/extdata/uri/modules/uri-dependency/pom.xml
index 344178f..1d9da24 100644
--- a/modules/extdata/uri/modules/uri-dependency/pom.xml
+++ b/modules/extdata/uri/modules/uri-dependency/pom.xml
@@ -27,7 +27,7 @@
     <artifactId>ignite-extdata-uri-dep</artifactId>
     <packaging>jar</packaging>
 
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <modelVersion>4.0.0</modelVersion>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/extdata/uri/pom.xml
----------------------------------------------------------------------
diff --git a/modules/extdata/uri/pom.xml b/modules/extdata/uri/pom.xml
index f5b524c..1cef7f9 100644
--- a/modules/extdata/uri/pom.xml
+++ b/modules/extdata/uri/pom.xml
@@ -32,7 +32,7 @@
     </parent>
 
     <artifactId>ignite-extdata-uri</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/flink/pom.xml
----------------------------------------------------------------------
diff --git a/modules/flink/pom.xml b/modules/flink/pom.xml
index 6c52d9e..118c175 100644
--- a/modules/flink/pom.xml
+++ b/modules/flink/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-flink</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <properties>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/flume/pom.xml
----------------------------------------------------------------------
diff --git a/modules/flume/pom.xml b/modules/flume/pom.xml
index 6fead3f..f9d36e9 100644
--- a/modules/flume/pom.xml
+++ b/modules/flume/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-flume</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/gce/pom.xml
----------------------------------------------------------------------
diff --git a/modules/gce/pom.xml b/modules/gce/pom.xml
index 8338425..8c7bed4 100644
--- a/modules/gce/pom.xml
+++ b/modules/gce/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-gce</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/geospatial/pom.xml
----------------------------------------------------------------------
diff --git a/modules/geospatial/pom.xml b/modules/geospatial/pom.xml
index b0076e2..eeef657 100644
--- a/modules/geospatial/pom.xml
+++ b/modules/geospatial/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-geospatial</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/hadoop/pom.xml
----------------------------------------------------------------------
diff --git a/modules/hadoop/pom.xml b/modules/hadoop/pom.xml
index c5168c6..a3f40e5 100644
--- a/modules/hadoop/pom.xml
+++ b/modules/hadoop/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-hadoop</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/hibernate/pom.xml
----------------------------------------------------------------------
diff --git a/modules/hibernate/pom.xml b/modules/hibernate/pom.xml
index 6c687ab..b0ea68d 100644
--- a/modules/hibernate/pom.xml
+++ b/modules/hibernate/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-hibernate</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/indexing/pom.xml
----------------------------------------------------------------------
diff --git a/modules/indexing/pom.xml b/modules/indexing/pom.xml
index d533dfa..d667531 100644
--- a/modules/indexing/pom.xml
+++ b/modules/indexing/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-indexing</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/jcl/pom.xml
----------------------------------------------------------------------
diff --git a/modules/jcl/pom.xml b/modules/jcl/pom.xml
index 293a34d..fbc9441 100644
--- a/modules/jcl/pom.xml
+++ b/modules/jcl/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-jcl</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/jms11/pom.xml
----------------------------------------------------------------------
diff --git a/modules/jms11/pom.xml b/modules/jms11/pom.xml
index dafbbdf..a4222a0 100644
--- a/modules/jms11/pom.xml
+++ b/modules/jms11/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-jms11</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/jta/pom.xml
----------------------------------------------------------------------
diff --git a/modules/jta/pom.xml b/modules/jta/pom.xml
index ed6a06e..64ad26d 100644
--- a/modules/jta/pom.xml
+++ b/modules/jta/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-jta</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/kafka/pom.xml
----------------------------------------------------------------------
diff --git a/modules/kafka/pom.xml b/modules/kafka/pom.xml
index bd585c9..07d031e 100644
--- a/modules/kafka/pom.xml
+++ b/modules/kafka/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-kafka</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/log4j/pom.xml
----------------------------------------------------------------------
diff --git a/modules/log4j/pom.xml b/modules/log4j/pom.xml
index b70a578..f74e59b 100644
--- a/modules/log4j/pom.xml
+++ b/modules/log4j/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-log4j</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/log4j2/pom.xml
----------------------------------------------------------------------
diff --git a/modules/log4j2/pom.xml b/modules/log4j2/pom.xml
index 2485aa3..ac99196 100644
--- a/modules/log4j2/pom.xml
+++ b/modules/log4j2/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-log4j2</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/mesos/pom.xml
----------------------------------------------------------------------
diff --git a/modules/mesos/pom.xml b/modules/mesos/pom.xml
index 514a2b0..660b046 100644
--- a/modules/mesos/pom.xml
+++ b/modules/mesos/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-mesos</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <properties>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/mqtt/pom.xml
----------------------------------------------------------------------
diff --git a/modules/mqtt/pom.xml b/modules/mqtt/pom.xml
index 391d7fe..ae984eb 100644
--- a/modules/mqtt/pom.xml
+++ b/modules/mqtt/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-mqtt</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/osgi-karaf/pom.xml
----------------------------------------------------------------------
diff --git a/modules/osgi-karaf/pom.xml b/modules/osgi-karaf/pom.xml
index dbc1fb3..f4e0113 100644
--- a/modules/osgi-karaf/pom.xml
+++ b/modules/osgi-karaf/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-osgi-karaf</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <packaging>pom</packaging>
 
     <build>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/osgi-paxlogging/pom.xml
----------------------------------------------------------------------
diff --git a/modules/osgi-paxlogging/pom.xml b/modules/osgi-paxlogging/pom.xml
index 9b3a3ff..779c9a9 100644
--- a/modules/osgi-paxlogging/pom.xml
+++ b/modules/osgi-paxlogging/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-osgi-paxlogging</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <packaging>jar</packaging>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/osgi/pom.xml
----------------------------------------------------------------------
diff --git a/modules/osgi/pom.xml b/modules/osgi/pom.xml
index f9bf6f4..041fbd1 100644
--- a/modules/osgi/pom.xml
+++ b/modules/osgi/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-osgi</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/rest-http/pom.xml
----------------------------------------------------------------------
diff --git a/modules/rest-http/pom.xml b/modules/rest-http/pom.xml
index 72ff61c..860c64d 100644
--- a/modules/rest-http/pom.xml
+++ b/modules/rest-http/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-rest-http</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <properties>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/scalar-2.10/pom.xml
----------------------------------------------------------------------
diff --git a/modules/scalar-2.10/pom.xml b/modules/scalar-2.10/pom.xml
index 2328302..06f43b9 100644
--- a/modules/scalar-2.10/pom.xml
+++ b/modules/scalar-2.10/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-scalar_2.10</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/scalar/pom.xml
----------------------------------------------------------------------
diff --git a/modules/scalar/pom.xml b/modules/scalar/pom.xml
index d4c37cc..e42c710 100644
--- a/modules/scalar/pom.xml
+++ b/modules/scalar/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-scalar</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/schedule/pom.xml
----------------------------------------------------------------------
diff --git a/modules/schedule/pom.xml b/modules/schedule/pom.xml
index 09cf3c5..e06f051 100644
--- a/modules/schedule/pom.xml
+++ b/modules/schedule/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-schedule</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <properties>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/schema-import-db/pom.xml
----------------------------------------------------------------------
diff --git a/modules/schema-import-db/pom.xml b/modules/schema-import-db/pom.xml
index 910ad85..b34281b 100644
--- a/modules/schema-import-db/pom.xml
+++ b/modules/schema-import-db/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-schema-import-db</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
 
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/schema-import/pom.xml
----------------------------------------------------------------------
diff --git a/modules/schema-import/pom.xml b/modules/schema-import/pom.xml
index b0ab2eb..271e513 100644
--- a/modules/schema-import/pom.xml
+++ b/modules/schema-import/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-schema-import</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/slf4j/pom.xml
----------------------------------------------------------------------
diff --git a/modules/slf4j/pom.xml b/modules/slf4j/pom.xml
index bbc0b70..85195b0 100644
--- a/modules/slf4j/pom.xml
+++ b/modules/slf4j/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-slf4j</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/spark-2.10/pom.xml
----------------------------------------------------------------------
diff --git a/modules/spark-2.10/pom.xml b/modules/spark-2.10/pom.xml
index b970e3d..c02599b 100644
--- a/modules/spark-2.10/pom.xml
+++ b/modules/spark-2.10/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-spark_2.10</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/spark/pom.xml
----------------------------------------------------------------------
diff --git a/modules/spark/pom.xml b/modules/spark/pom.xml
index 6b631d3..4bde34f 100644
--- a/modules/spark/pom.xml
+++ b/modules/spark/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-spark</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/spring/pom.xml
----------------------------------------------------------------------
diff --git a/modules/spring/pom.xml b/modules/spring/pom.xml
index bb96d4c..397b209 100644
--- a/modules/spring/pom.xml
+++ b/modules/spring/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-spring</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/ssh/pom.xml
----------------------------------------------------------------------
diff --git a/modules/ssh/pom.xml b/modules/ssh/pom.xml
index 7e41bbc..aec0948 100644
--- a/modules/ssh/pom.xml
+++ b/modules/ssh/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-ssh</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/storm/pom.xml
----------------------------------------------------------------------
diff --git a/modules/storm/pom.xml b/modules/storm/pom.xml
index eb96c60..712f910 100644
--- a/modules/storm/pom.xml
+++ b/modules/storm/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-storm</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <properties>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/tools/pom.xml
----------------------------------------------------------------------
diff --git a/modules/tools/pom.xml b/modules/tools/pom.xml
index cd6f2a7..4f65542 100644
--- a/modules/tools/pom.xml
+++ b/modules/tools/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-tools</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <properties>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/twitter/pom.xml
----------------------------------------------------------------------
diff --git a/modules/twitter/pom.xml b/modules/twitter/pom.xml
index 9c86d9b..8f0d917 100644
--- a/modules/twitter/pom.xml
+++ b/modules/twitter/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-twitter</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/urideploy/pom.xml
----------------------------------------------------------------------
diff --git a/modules/urideploy/pom.xml b/modules/urideploy/pom.xml
index a57315a..a621017 100644
--- a/modules/urideploy/pom.xml
+++ b/modules/urideploy/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-urideploy</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/visor-console-2.10/pom.xml
----------------------------------------------------------------------
diff --git a/modules/visor-console-2.10/pom.xml b/modules/visor-console-2.10/pom.xml
index a86567e..a1d2987 100644
--- a/modules/visor-console-2.10/pom.xml
+++ b/modules/visor-console-2.10/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-visor-console_2.10</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/visor-console/pom.xml
----------------------------------------------------------------------
diff --git a/modules/visor-console/pom.xml b/modules/visor-console/pom.xml
index 7c6e71b..3dd9bd8 100644
--- a/modules/visor-console/pom.xml
+++ b/modules/visor-console/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-visor-console</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/visor-plugins/pom.xml
----------------------------------------------------------------------
diff --git a/modules/visor-plugins/pom.xml b/modules/visor-plugins/pom.xml
index 7e0b127..d095650 100644
--- a/modules/visor-plugins/pom.xml
+++ b/modules/visor-plugins/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-visor-plugins</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/web-agent/pom.xml
----------------------------------------------------------------------
diff --git a/modules/web-agent/pom.xml b/modules/web-agent/pom.xml
index 8170160..d87084f 100644
--- a/modules/web-agent/pom.xml
+++ b/modules/web-agent/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-web-agent</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
 
     <properties>
         <maven.build.timestamp.format>yyMMddHHmmss</maven.build.timestamp.format>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/web-console/pom.xml
----------------------------------------------------------------------
diff --git a/modules/web-console/pom.xml b/modules/web-console/pom.xml
index 382da80..5c5cac0 100644
--- a/modules/web-console/pom.xml
+++ b/modules/web-console/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-web-console</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
 
     <build>
         <plugins>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/web/ignite-appserver-test/pom.xml
----------------------------------------------------------------------
diff --git a/modules/web/ignite-appserver-test/pom.xml b/modules/web/ignite-appserver-test/pom.xml
index fb9fbe2..045bbfa 100644
--- a/modules/web/ignite-appserver-test/pom.xml
+++ b/modules/web/ignite-appserver-test/pom.xml
@@ -30,7 +30,7 @@
 
     <artifactId>ignite-appserver-test</artifactId>
     <packaging>jar</packaging>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/web/ignite-websphere-test/pom.xml
----------------------------------------------------------------------
diff --git a/modules/web/ignite-websphere-test/pom.xml b/modules/web/ignite-websphere-test/pom.xml
index b2e665c..9127560 100644
--- a/modules/web/ignite-websphere-test/pom.xml
+++ b/modules/web/ignite-websphere-test/pom.xml
@@ -30,7 +30,7 @@
 
     <artifactId>ignite-websphere-test</artifactId>
     <packaging>war</packaging>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/web/pom.xml
----------------------------------------------------------------------
diff --git a/modules/web/pom.xml b/modules/web/pom.xml
index cf02a42..710c803 100644
--- a/modules/web/pom.xml
+++ b/modules/web/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-web</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/yardstick/pom.xml
----------------------------------------------------------------------
diff --git a/modules/yardstick/pom.xml b/modules/yardstick/pom.xml
index 58529a4..51d714e 100644
--- a/modules/yardstick/pom.xml
+++ b/modules/yardstick/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-yardstick</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <properties>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/yarn/pom.xml
----------------------------------------------------------------------
diff --git a/modules/yarn/pom.xml b/modules/yarn/pom.xml
index 0a4e694..884176a 100644
--- a/modules/yarn/pom.xml
+++ b/modules/yarn/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-yarn</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <properties>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/modules/zookeeper/pom.xml
----------------------------------------------------------------------
diff --git a/modules/zookeeper/pom.xml b/modules/zookeeper/pom.xml
index 57fcb5b..41c381b 100644
--- a/modules/zookeeper/pom.xml
+++ b/modules/zookeeper/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-zookeeper</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/151dfa78/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 8f8e041..2c7bad1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -32,12 +32,12 @@
 
     <groupId>org.apache.ignite</groupId>
     <artifactId>apache-ignite</artifactId>
-    <version>1.6.4</version>
+    <version>1.7.0-SNAPSHOT</version>
     <packaging>pom</packaging>
 
     <properties>
         <!--fix <attachartifact>...< /> at apache-release profile if changed-->
-        <ignite.zip.pattern>gridgain-professional-${ignite.edition}-${project.version}</ignite.zip.pattern>
+        <ignite.zip.pattern>${project.artifactId}-${ignite.edition}-${project.version}-bin</ignite.zip.pattern>
     </properties>
 
     <scm>


[14/19] ignite git commit: Merge remote-tracking branch 'remotes/community/ignite-1.6.5' into ignite-1.7.2

Posted by an...@apache.org.
Merge remote-tracking branch 'remotes/community/ignite-1.6.5' into ignite-1.7.2

# Conflicts:
#	modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/47da1990
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/47da1990
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/47da1990

Branch: refs/heads/master
Commit: 47da19903b0e851ae4cd0f9ee593fd0f031ea2b6
Parents: 8dd39a5 151dfa7
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Wed Aug 10 12:04:49 2016 +0300
Committer: tledkov-gridgain <tl...@gridgain.com>
Committed: Wed Aug 10 12:04:49 2016 +0300

----------------------------------------------------------------------
 .../ignite/codegen/MessageCodeGenerator.java    |   6 +-
 .../java/org/apache/ignite/IgniteCompute.java   |  69 +-
 .../configuration/ConnectorConfiguration.java   |   1 +
 .../ignite/internal/GridJobExecuteRequest.java  | 148 +++-
 .../ignite/internal/GridJobExecuteResponse.java |  42 +-
 .../ignite/internal/IgniteComputeImpl.java      | 120 ++-
 .../failover/GridFailoverContextImpl.java       |  27 +-
 .../managers/failover/GridFailoverManager.java  |  17 +-
 .../affinity/GridAffinityProcessor.java         |  18 +
 .../processors/cache/GridCacheSwapManager.java  |  22 +-
 .../distributed/dht/GridDhtCacheAdapter.java    |  19 +-
 .../distributed/dht/GridDhtLocalPartition.java  |  33 +-
 .../cache/distributed/dht/GridReservable.java   |   5 +-
 .../cache/query/GridCacheQueryManager.java      |  10 +-
 .../processors/closure/AffinityTask.java        |  17 +-
 .../closure/GridClosureProcessor.java           | 142 +++-
 .../processors/job/GridJobProcessor.java        | 139 ++-
 .../internal/processors/job/GridJobWorker.java  | 203 +++--
 .../processors/query/GridQueryProcessor.java    |  22 +-
 .../processors/task/GridTaskWorker.java         | 235 +++--
 .../ignite/internal/util/IgniteUtils.java       |  10 +
 .../ignite/spi/failover/FailoverContext.java    |  15 +-
 .../spi/failover/always/AlwaysFailoverSpi.java  |  15 +-
 .../GridJobMasterLeaveAwareSelfTest.java        |   4 +-
 ...ectionLocalJobMultipleArgumentsSelfTest.java |   4 +-
 .../GridTaskFailoverAffinityRunTest.java        |   2 +-
 .../IgniteComputeEmptyClusterGroupTest.java     |   8 +-
 .../binary/GridBinaryAffinityKeySelfTest.java   |   6 +-
 ...acheAbstractUsersAffinityMapperSelfTest.java |   2 +-
 ...niteDynamicCacheStartStopConcurrentTest.java |   2 +-
 .../spi/failover/GridFailoverTestContext.java   |   6 +
 .../ignite/testframework/IgniteTestSuite.java   | 191 +++++
 .../apache/ignite/testsuites/IgniteIgnore.java  |  35 +
 .../testsuites/IgniteIgnoredTestSuite.java      |  63 ++
 ...eLockPartitionOnAffinityRunAbstractTest.java | 413 +++++++++
 ...PartitionOnAffinityRunAtomicCacheOpTest.java | 329 +++++++
 ...niteCacheLockPartitionOnAffinityRunTest.java | 852 +++++++++++++++++++
 ...LockPartitionOnAffinityRunTxCacheOpTest.java |  33 +
 ...titionOnAffinityRunWithCollisionSpiTest.java | 204 +++++
 .../IgniteCacheAffinityRunTestSuite.java        |  45 +
 .../apache/ignite/cache/spring/SpringCache.java |  44 +-
 .../ignite/cache/spring/SpringCacheManager.java |   7 +-
 .../spring/GridSpringCacheManagerSelfTest.java  | 438 ++++++++++
 .../cache/spring/GridSpringCacheTestKey.java    |  61 ++
 .../spring/GridSpringCacheTestKeyGenerator.java |  40 +
 .../spring/GridSpringCacheTestService.java      | 181 ++++
 .../GridSpringDynamicCacheTestService.java      |  85 ++
 .../SpringCacheManagerContextInjectionTest.java | 125 +++
 .../ignite/cache/spring/spring-caching.xml      |  57 ++
 .../spring/GridSpringCacheManagerSelfTest.java  | 342 --------
 .../ignite/spring/GridSpringCacheTestKey.java   |  61 --
 .../spring/GridSpringCacheTestKeyGenerator.java |  40 -
 .../spring/GridSpringCacheTestService.java      | 125 ---
 .../GridSpringDynamicCacheTestService.java      |  85 --
 .../SpringCacheManagerContextInjectionTest.java | 126 ---
 .../org/apache/ignite/spring/spring-caching.xml |  57 --
 .../testsuites/IgniteSpringTestSuite.java       |   4 +-
 57 files changed, 4284 insertions(+), 1128 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/47da1990/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/47da1990/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/47da1990/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/47da1990/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index 0dd542e,8469a7c..d73b6ca
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@@ -889,8 -967,8 +893,8 @@@ public class GridQueryProcessor extend
                      String sql = qry.getSql();
                      Object[] args = qry.getArgs();
  
 -                    final GridQueryFieldsResult res = idx.queryFields(space, sql, F.asList(args),
 -                        idx.backupFilter(null, requestTopVer.get(), null));
 +                    final GridQueryFieldsResult res = idx.queryLocalSqlFields(space, sql, F.asList(args),
-                         idx.backupFilter(null, null), qry.isEnforceJoinOrder());
++                        idx.backupFilter(null, requestTopVer.get(), null), qry.isEnforceJoinOrder());
  
                      sendQueryExecutedEvent(sql, args);
  

http://git-wip-us.apache.org/repos/asf/ignite/blob/47da1990/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/47da1990/modules/spring/src/test/java/org/apache/ignite/testsuites/IgniteSpringTestSuite.java
----------------------------------------------------------------------


[08/19] ignite git commit: IGNITE-2310 Lock cache partition for affinityRun/affinityCall execution

Posted by an...@apache.org.
IGNITE-2310 Lock cache partition for affinityRun/affinityCall execution


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/01800101
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/01800101
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/01800101

Branch: refs/heads/master
Commit: 018001011daff723d120834da7b4f57bad7f8f71
Parents: 00f47d7
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Fri May 27 15:16:27 2016 +0300
Committer: tledkov-gridgain <tl...@gridgain.com>
Committed: Tue Aug 9 12:50:23 2016 +0300

----------------------------------------------------------------------
 .../ignite/codegen/MessageCodeGenerator.java    |   6 +-
 .../java/org/apache/ignite/IgniteCompute.java   |  69 +-
 .../ignite/internal/GridJobExecuteRequest.java  | 148 +++-
 .../ignite/internal/GridJobExecuteResponse.java |  42 +-
 .../ignite/internal/IgniteComputeImpl.java      | 120 ++-
 .../failover/GridFailoverContextImpl.java       |  27 +-
 .../managers/failover/GridFailoverManager.java  |  17 +-
 .../affinity/GridAffinityProcessor.java         |  18 +
 .../processors/cache/GridCacheSwapManager.java  |  22 +-
 .../distributed/dht/GridDhtCacheAdapter.java    |  19 +-
 .../distributed/dht/GridDhtLocalPartition.java  |  33 +-
 .../cache/distributed/dht/GridReservable.java   |   5 +-
 .../cache/query/GridCacheQueryManager.java      |  10 +-
 .../processors/closure/AffinityTask.java        |  17 +-
 .../closure/GridClosureProcessor.java           | 142 +++-
 .../processors/job/GridJobProcessor.java        | 139 ++-
 .../internal/processors/job/GridJobWorker.java  | 203 +++--
 .../processors/query/GridQueryProcessor.java    |  22 +-
 .../processors/task/GridTaskWorker.java         | 235 +++--
 .../ignite/internal/util/IgniteUtils.java       |  10 +
 .../ignite/spi/failover/FailoverContext.java    |  15 +-
 .../spi/failover/always/AlwaysFailoverSpi.java  |  15 +-
 .../GridJobMasterLeaveAwareSelfTest.java        |   4 +-
 ...ectionLocalJobMultipleArgumentsSelfTest.java |   4 +-
 .../GridTaskFailoverAffinityRunTest.java        |   2 +-
 .../IgniteComputeEmptyClusterGroupTest.java     |   8 +-
 .../binary/GridBinaryAffinityKeySelfTest.java   |   6 +-
 ...acheAbstractUsersAffinityMapperSelfTest.java |   2 +-
 ...niteDynamicCacheStartStopConcurrentTest.java |   2 +-
 .../spi/failover/GridFailoverTestContext.java   |   6 +
 ...eLockPartitionOnAffinityRunAbstractTest.java | 412 +++++++++
 ...PartitionOnAffinityRunAtomicCacheOpTest.java | 329 +++++++
 ...niteCacheLockPartitionOnAffinityRunTest.java | 852 +++++++++++++++++++
 ...LockPartitionOnAffinityRunTxCacheOpTest.java |  33 +
 ...titionOnAffinityRunWithCollisionSpiTest.java | 204 +++++
 .../IgniteCacheAffinityRunTestSuite.java        |  45 +
 36 files changed, 2961 insertions(+), 282 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java
----------------------------------------------------------------------
diff --git a/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java b/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java
index a6ae0da..5cfd9c5 100644
--- a/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java
+++ b/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java
@@ -744,14 +744,14 @@ public class MessageCodeGenerator {
         else if (type.isArray()) {
             Class<?> compType = type.getComponentType();
 
-            returnFalseIfReadFailed(name, "reader.readObjectArray", field, setExpr,
+            returnFalseIfReadFailed(name, "reader.readObjectArray", setExpr, field,
                 "MessageCollectionItemType." + typeEnum(compType),
                 compType.getSimpleName() + ".class");
         }
         else if (Collection.class.isAssignableFrom(type) && !Set.class.isAssignableFrom(type)) {
             assert colItemType != null;
 
-            returnFalseIfReadFailed(name, "reader.readCollection", field, setExpr,
+            returnFalseIfReadFailed(name, "reader.readCollection", setExpr, field,
                 "MessageCollectionItemType." + typeEnum(colItemType));
         }
         else if (Map.class.isAssignableFrom(type)) {
@@ -760,7 +760,7 @@ public class MessageCodeGenerator {
 
             boolean linked = type.equals(LinkedHashMap.class);
 
-            returnFalseIfReadFailed(name, "reader.readMap", field, setExpr,
+            returnFalseIfReadFailed(name, "reader.readMap", setExpr, field,
                 "MessageCollectionItemType." + typeEnum(mapKeyType),
                 "MessageCollectionItemType." + typeEnum(mapValType),
                 linked ? "true" : "false");

http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/core/src/main/java/org/apache/ignite/IgniteCompute.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCompute.java b/modules/core/src/main/java/org/apache/ignite/IgniteCompute.java
index f7d4bc5..212849a 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCompute.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCompute.java
@@ -38,6 +38,7 @@ import org.apache.ignite.resources.SpringResource;
 import org.apache.ignite.resources.TaskSessionResource;
 import org.apache.ignite.spi.failover.FailoverSpi;
 import org.apache.ignite.spi.loadbalancing.LoadBalancingSpi;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 /**
@@ -122,7 +123,8 @@ public interface IgniteCompute extends IgniteAsyncSupport {
 
     /**
      * Executes given job on the node where data for provided affinity key is located
-     * (a.k.a. affinity co-location).
+     * (a.k.a. affinity co-location). The data of the partition where affKey is stored
+     * will not be migrated from the target node while the job is executed.
      *
      * @param cacheName Name of the cache to use for affinity co-location.
      * @param affKey Affinity key.
@@ -134,7 +136,38 @@ public interface IgniteCompute extends IgniteAsyncSupport {
 
     /**
      * Executes given job on the node where data for provided affinity key is located
-     * (a.k.a. affinity co-location).
+     * (a.k.a. affinity co-location). The data of the partition where affKey is stored
+     * will not be migrated from the target node while the job is executed. The data
+     * of the extra caches' partitions with the same partition number also will not be migrated.
+     *
+     * @param cacheNames Names of the caches to to reserve the partition. The first cache uses for affinity co-location.
+     * @param affKey Affinity key.
+     * @param job Job which will be co-located on the node with given affinity key.
+     * @throws IgniteException If job failed.
+     */
+    @IgniteAsyncSupported
+    public void affinityRun(@NotNull Collection<String> cacheNames, Object affKey, IgniteRunnable job)
+        throws IgniteException;
+
+    /**
+     * Executes given job on the node where partition is located (the partition is primary on the node)
+     * The data of the partition will not be migrated from the target node
+     * while the job is executed. The data of the extra caches' partitions with the same partition number
+     * also will not be migrated.
+     *
+     * @param cacheNames Names of the caches to to reserve the partition. The first cache uses for affinity co-location.
+     * @param partId Partition number.
+     * @param job Job which will be co-located on the node with given affinity key.
+     * @throws IgniteException If job failed.
+     */
+    @IgniteAsyncSupported
+    public void affinityRun(@NotNull Collection<String> cacheNames, int partId, IgniteRunnable job)
+        throws IgniteException;
+
+    /**
+     * Executes given job on the node where data for provided affinity key is located
+     * (a.k.a. affinity co-location). The data of the partition where affKey is stored
+     * will not be migrated from the target node while the job is executed.
      *
      * @param cacheName Name of the cache to use for affinity co-location.
      * @param affKey Affinity key.
@@ -146,6 +179,38 @@ public interface IgniteCompute extends IgniteAsyncSupport {
     public <R> R affinityCall(@Nullable String cacheName, Object affKey, IgniteCallable<R> job) throws IgniteException;
 
     /**
+     * Executes given job on the node where data for provided affinity key is located
+     * (a.k.a. affinity co-location). The data of the partition where affKey is stored
+     * will not be migrated from the target node while the job is executed. The data
+     * of the extra caches' partitions with the same partition number also will not be migrated.
+     *
+     * @param cacheNames Names of the caches to to reserve the partition. The first cache uses for affinity co-location.
+     * @param affKey Affinity key.
+     * @param job Job which will be co-located on the node with given affinity key.
+     * @return Job result.
+     * @throws IgniteException If job failed.
+     */
+    @IgniteAsyncSupported
+    public <R> R affinityCall(@NotNull Collection<String> cacheNames, Object affKey, IgniteCallable<R> job)
+        throws IgniteException;
+
+    /**
+     * Executes given job on the node where partition is located (the partition is primary on the node)
+     * The data of the partition will not be migrated from the target node
+     * while the job is executed. The data of the extra caches' partitions with the same partition number
+     * also will not be migrated.
+     *
+     * @param cacheNames Names of the caches to to reserve the partition. The first cache uses for affinity co-location.
+     * @param partId Partition to reserve.
+     * @param job Job which will be co-located on the node with given affinity key.
+     * @return Job result.
+     * @throws IgniteException If job failed.
+     */
+    @IgniteAsyncSupported
+    public <R> R affinityCall(@NotNull Collection<String> cacheNames, int partId, IgniteCallable<R> job)
+        throws IgniteException;
+
+    /**
      * Executes given task on within the cluster group. For step-by-step explanation of task execution process
      * refer to {@link ComputeTask} documentation.
      *

http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java
index 28b4094..ed431d8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java
@@ -26,6 +26,7 @@ import java.util.UUID;
 import org.apache.ignite.compute.ComputeJob;
 import org.apache.ignite.compute.ComputeJobSibling;
 import org.apache.ignite.configuration.DeploymentMode;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.util.tostring.GridToStringExclude;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.internal.S;
@@ -136,6 +137,15 @@ public class GridJobExecuteRequest implements Message {
     @GridDirectCollection(UUID.class)
     private Collection<UUID> top;
 
+    /** */
+    private int[] idsOfCaches;
+
+    /** */
+    private int part;
+
+    /** */
+    private AffinityTopologyVersion topVer;
+
     /**
      * No-op constructor to support {@link Externalizable} interface.
      */
@@ -169,6 +179,9 @@ public class GridJobExecuteRequest implements Message {
      * @param sesFullSup {@code True} if session attributes are disabled.
      * @param internal {@code True} if internal job.
      * @param subjId Subject ID.
+     * @param cacheIds Caches' identifiers to reserve partition.
+     * @param part Partition to lock.
+     * @param topVer Affinity topology version of job mapping.
      */
     public GridJobExecuteRequest(
             IgniteUuid sesId,
@@ -195,7 +208,10 @@ public class GridJobExecuteRequest implements Message {
             boolean forceLocDep,
             boolean sesFullSup,
             boolean internal,
-            UUID subjId) {
+            UUID subjId,
+            @Nullable int[] cacheIds,
+            int part,
+            @Nullable AffinityTopologyVersion topVer) {
         this.top = top;
         assert sesId != null;
         assert jobId != null;
@@ -232,6 +248,9 @@ public class GridJobExecuteRequest implements Message {
         this.sesFullSup = sesFullSup;
         this.internal = internal;
         this.subjId = subjId;
+        this.idsOfCaches = cacheIds;
+        this.part = part;
+        this.topVer = topVer;
 
         this.cpSpi = cpSpi == null || cpSpi.isEmpty() ? null : cpSpi;
     }
@@ -421,6 +440,27 @@ public class GridJobExecuteRequest implements Message {
         return subjId;
     }
 
+    /**
+     * @return Caches' identifiers to reserve specified partition for job execution.
+     */
+    public int[] getCacheIds() {
+        return idsOfCaches;
+    }
+
+    /**
+     * @return Partitions to lock for job execution.
+     */
+    public int getPartition() {
+        return part;
+    }
+
+    /**
+     * @return Affinity version which was used to map job
+     */
+    public AffinityTopologyVersion getTopVer() {
+        return topVer;
+    }
+
     /** {@inheritDoc} */
     @Override public void onAckReceived() {
         // No-op.
@@ -469,96 +509,114 @@ public class GridJobExecuteRequest implements Message {
                 writer.incrementState();
 
             case 5:
-                if (!writer.writeBoolean("internal", internal))
+                if (!writer.writeIntArray("idsOfCaches", idsOfCaches))
                     return false;
 
                 writer.incrementState();
 
             case 6:
-                if (!writer.writeByteArray("jobAttrsBytes", jobAttrsBytes))
+                if (!writer.writeBoolean("internal", internal))
                     return false;
 
                 writer.incrementState();
 
             case 7:
-                if (!writer.writeByteArray("jobBytes", jobBytes))
+                if (!writer.writeByteArray("jobAttrsBytes", jobAttrsBytes))
                     return false;
 
                 writer.incrementState();
 
             case 8:
-                if (!writer.writeIgniteUuid("jobId", jobId))
+                if (!writer.writeByteArray("jobBytes", jobBytes))
                     return false;
 
                 writer.incrementState();
 
             case 9:
-                if (!writer.writeMap("ldrParticipants", ldrParticipants, MessageCollectionItemType.UUID, MessageCollectionItemType.IGNITE_UUID))
+                if (!writer.writeIgniteUuid("jobId", jobId))
                     return false;
 
                 writer.incrementState();
 
             case 10:
-                if (!writer.writeByteArray("sesAttrsBytes", sesAttrsBytes))
+                if (!writer.writeMap("ldrParticipants", ldrParticipants, MessageCollectionItemType.UUID, MessageCollectionItemType.IGNITE_UUID))
                     return false;
 
                 writer.incrementState();
 
             case 11:
-                if (!writer.writeBoolean("sesFullSup", sesFullSup))
+                if (!writer.writeInt("part", part))
                     return false;
 
                 writer.incrementState();
 
             case 12:
-                if (!writer.writeIgniteUuid("sesId", sesId))
+                if (!writer.writeByteArray("sesAttrsBytes", sesAttrsBytes))
                     return false;
 
                 writer.incrementState();
 
             case 13:
-                if (!writer.writeByteArray("siblingsBytes", siblingsBytes))
+                if (!writer.writeBoolean("sesFullSup", sesFullSup))
                     return false;
 
                 writer.incrementState();
 
             case 14:
-                if (!writer.writeLong("startTaskTime", startTaskTime))
+                if (!writer.writeIgniteUuid("sesId", sesId))
                     return false;
 
                 writer.incrementState();
 
             case 15:
-                if (!writer.writeUuid("subjId", subjId))
+                if (!writer.writeByteArray("siblingsBytes", siblingsBytes))
                     return false;
 
                 writer.incrementState();
 
             case 16:
-                if (!writer.writeString("taskClsName", taskClsName))
+                if (!writer.writeLong("startTaskTime", startTaskTime))
                     return false;
 
                 writer.incrementState();
 
             case 17:
-                if (!writer.writeString("taskName", taskName))
+                if (!writer.writeUuid("subjId", subjId))
                     return false;
 
                 writer.incrementState();
 
             case 18:
-                if (!writer.writeLong("timeout", timeout))
+                if (!writer.writeString("taskClsName", taskClsName))
                     return false;
 
                 writer.incrementState();
 
             case 19:
-                if (!writer.writeCollection("top", top, MessageCollectionItemType.UUID))
+                if (!writer.writeString("taskName", taskName))
                     return false;
 
                 writer.incrementState();
 
             case 20:
+                if (!writer.writeLong("timeout", timeout))
+                    return false;
+
+                writer.incrementState();
+
+            case 21:
+                if (!writer.writeCollection("top", top, MessageCollectionItemType.UUID))
+                    return false;
+
+                writer.incrementState();
+
+            case 22:
+                if (!writer.writeMessage("topVer", topVer))
+                    return false;
+
+                writer.incrementState();
+
+            case 23:
                 if (!writer.writeString("userVer", userVer))
                     return false;
 
@@ -622,7 +680,7 @@ public class GridJobExecuteRequest implements Message {
                 reader.incrementState();
 
             case 5:
-                internal = reader.readBoolean("internal");
+                idsOfCaches = reader.readIntArray("idsOfCaches");
 
                 if (!reader.isLastRead())
                     return false;
@@ -630,7 +688,7 @@ public class GridJobExecuteRequest implements Message {
                 reader.incrementState();
 
             case 6:
-                jobAttrsBytes = reader.readByteArray("jobAttrsBytes");
+                internal = reader.readBoolean("internal");
 
                 if (!reader.isLastRead())
                     return false;
@@ -638,7 +696,7 @@ public class GridJobExecuteRequest implements Message {
                 reader.incrementState();
 
             case 7:
-                jobBytes = reader.readByteArray("jobBytes");
+                jobAttrsBytes = reader.readByteArray("jobAttrsBytes");
 
                 if (!reader.isLastRead())
                     return false;
@@ -646,7 +704,7 @@ public class GridJobExecuteRequest implements Message {
                 reader.incrementState();
 
             case 8:
-                jobId = reader.readIgniteUuid("jobId");
+                jobBytes = reader.readByteArray("jobBytes");
 
                 if (!reader.isLastRead())
                     return false;
@@ -654,7 +712,7 @@ public class GridJobExecuteRequest implements Message {
                 reader.incrementState();
 
             case 9:
-                ldrParticipants = reader.readMap("ldrParticipants", MessageCollectionItemType.UUID, MessageCollectionItemType.IGNITE_UUID, false);
+                jobId = reader.readIgniteUuid("jobId");
 
                 if (!reader.isLastRead())
                     return false;
@@ -662,7 +720,7 @@ public class GridJobExecuteRequest implements Message {
                 reader.incrementState();
 
             case 10:
-                sesAttrsBytes = reader.readByteArray("sesAttrsBytes");
+                ldrParticipants = reader.readMap("ldrParticipants", MessageCollectionItemType.UUID, MessageCollectionItemType.IGNITE_UUID, false);
 
                 if (!reader.isLastRead())
                     return false;
@@ -670,7 +728,7 @@ public class GridJobExecuteRequest implements Message {
                 reader.incrementState();
 
             case 11:
-                sesFullSup = reader.readBoolean("sesFullSup");
+                part = reader.readInt("part");
 
                 if (!reader.isLastRead())
                     return false;
@@ -678,7 +736,7 @@ public class GridJobExecuteRequest implements Message {
                 reader.incrementState();
 
             case 12:
-                sesId = reader.readIgniteUuid("sesId");
+                sesAttrsBytes = reader.readByteArray("sesAttrsBytes");
 
                 if (!reader.isLastRead())
                     return false;
@@ -686,7 +744,7 @@ public class GridJobExecuteRequest implements Message {
                 reader.incrementState();
 
             case 13:
-                siblingsBytes = reader.readByteArray("siblingsBytes");
+                sesFullSup = reader.readBoolean("sesFullSup");
 
                 if (!reader.isLastRead())
                     return false;
@@ -694,7 +752,7 @@ public class GridJobExecuteRequest implements Message {
                 reader.incrementState();
 
             case 14:
-                startTaskTime = reader.readLong("startTaskTime");
+                sesId = reader.readIgniteUuid("sesId");
 
                 if (!reader.isLastRead())
                     return false;
@@ -702,7 +760,7 @@ public class GridJobExecuteRequest implements Message {
                 reader.incrementState();
 
             case 15:
-                subjId = reader.readUuid("subjId");
+                siblingsBytes = reader.readByteArray("siblingsBytes");
 
                 if (!reader.isLastRead())
                     return false;
@@ -710,7 +768,7 @@ public class GridJobExecuteRequest implements Message {
                 reader.incrementState();
 
             case 16:
-                taskClsName = reader.readString("taskClsName");
+                startTaskTime = reader.readLong("startTaskTime");
 
                 if (!reader.isLastRead())
                     return false;
@@ -718,7 +776,7 @@ public class GridJobExecuteRequest implements Message {
                 reader.incrementState();
 
             case 17:
-                taskName = reader.readString("taskName");
+                subjId = reader.readUuid("subjId");
 
                 if (!reader.isLastRead())
                     return false;
@@ -726,7 +784,7 @@ public class GridJobExecuteRequest implements Message {
                 reader.incrementState();
 
             case 18:
-                timeout = reader.readLong("timeout");
+                taskClsName = reader.readString("taskClsName");
 
                 if (!reader.isLastRead())
                     return false;
@@ -734,7 +792,7 @@ public class GridJobExecuteRequest implements Message {
                 reader.incrementState();
 
             case 19:
-                top = reader.readCollection("top", MessageCollectionItemType.UUID);
+                taskName = reader.readString("taskName");
 
                 if (!reader.isLastRead())
                     return false;
@@ -742,6 +800,30 @@ public class GridJobExecuteRequest implements Message {
                 reader.incrementState();
 
             case 20:
+                timeout = reader.readLong("timeout");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 21:
+                top = reader.readCollection("top", MessageCollectionItemType.UUID);
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 22:
+                topVer = reader.readMessage("topVer");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 23:
                 userVer = reader.readString("userVer");
 
                 if (!reader.isLastRead())
@@ -761,11 +843,11 @@ public class GridJobExecuteRequest implements Message {
 
     /** {@inheritDoc} */
     @Override public byte fieldsCount() {
-        return 21;
+        return 24;
     }
 
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(GridJobExecuteRequest.class, this);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteResponse.java
index bfbd859..9724bc0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteResponse.java
@@ -22,6 +22,7 @@ import java.nio.ByteBuffer;
 import java.util.Map;
 import java.util.UUID;
 import org.apache.ignite.IgniteException;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.util.tostring.GridToStringExclude;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.lang.IgniteUuid;
@@ -75,6 +76,9 @@ public class GridJobExecuteResponse implements Message {
     @GridDirectTransient
     private IgniteException fakeEx;
 
+    /** */
+    private AffinityTopologyVersion retry;
+
     /**
      * No-op constructor to support {@link Externalizable} interface. This
      * constructor is not meant to be used for other purposes.
@@ -94,6 +98,7 @@ public class GridJobExecuteResponse implements Message {
      * @param jobAttrsBytes Serialized job attributes.
      * @param jobAttrs Job attributes.
      * @param isCancelled Whether job was cancelled or not.
+     * @param retry Topology version for that partitions haven't been reserved on the affinity node.
      */
     public GridJobExecuteResponse(UUID nodeId,
         IgniteUuid sesId,
@@ -104,7 +109,8 @@ public class GridJobExecuteResponse implements Message {
         Object res,
         byte[] jobAttrsBytes,
         Map<Object, Object> jobAttrs,
-        boolean isCancelled)
+        boolean isCancelled,
+        AffinityTopologyVersion retry)
     {
         assert nodeId != null;
         assert sesId != null;
@@ -120,6 +126,7 @@ public class GridJobExecuteResponse implements Message {
         this.jobAttrsBytes = jobAttrsBytes;
         this.jobAttrs = jobAttrs;
         this.isCancelled = isCancelled;
+        this.retry = retry;
     }
 
     /**
@@ -206,6 +213,21 @@ public class GridJobExecuteResponse implements Message {
         this.fakeEx = fakeEx;
     }
 
+    /**
+     * @return {@code True} if need retry job.
+     */
+    public boolean retry() {
+        return retry != null;
+    }
+
+    /**
+     * @return Topology version for that specified partitions haven't been reserved
+     *          on the affinity node.
+     */
+    public AffinityTopologyVersion getRetryTopologyVersion() {
+        return retry != null ? retry : AffinityTopologyVersion.NONE;
+    }
+
     /** {@inheritDoc} */
     @Override public void onAckReceived() {
         // No-op.
@@ -260,6 +282,12 @@ public class GridJobExecuteResponse implements Message {
                 writer.incrementState();
 
             case 6:
+                if (!writer.writeMessage("retry", retry))
+                    return false;
+
+                writer.incrementState();
+
+            case 7:
                 if (!writer.writeIgniteUuid("sesId", sesId))
                     return false;
 
@@ -327,6 +355,14 @@ public class GridJobExecuteResponse implements Message {
                 reader.incrementState();
 
             case 6:
+                retry = reader.readMessage("retry");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 7:
                 sesId = reader.readIgniteUuid("sesId");
 
                 if (!reader.isLastRead())
@@ -346,11 +382,11 @@ public class GridJobExecuteResponse implements Message {
 
     /** {@inheritDoc} */
     @Override public byte fieldsCount() {
-        return 7;
+        return 8;
     }
 
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(GridJobExecuteResponse.class, this);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/core/src/main/java/org/apache/ignite/internal/IgniteComputeImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteComputeImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteComputeImpl.java
index 15ad15f..26c6797 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteComputeImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteComputeImpl.java
@@ -35,6 +35,7 @@ import org.apache.ignite.compute.ComputeTask;
 import org.apache.ignite.compute.ComputeTaskFuture;
 import org.apache.ignite.internal.cluster.ClusterGroupAdapter;
 import org.apache.ignite.internal.managers.deployment.GridDeployment;
+import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.A;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteCallable;
@@ -43,6 +44,7 @@ import org.apache.ignite.lang.IgniteFuture;
 import org.apache.ignite.lang.IgniteReducer;
 import org.apache.ignite.lang.IgniteRunnable;
 import org.apache.ignite.lang.IgniteUuid;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.internal.GridClosureCallMode.BALANCE;
@@ -109,7 +111,64 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
         guard();
 
         try {
-            saveOrGet(ctx.closure().affinityRun(cacheName, affKey, job, prj.nodes()));
+            // In case cache key is passed instead of affinity key.
+            final Object affKey0 = ctx.affinity().affinityKey(cacheName, affKey);
+            int partId = ctx.affinity().partition(cacheName, affKey0);
+
+            if (partId < 0)
+                throw new IgniteCheckedException("Failed map key to partition: [cache=" + cacheName + " key="
+                    + affKey + ']');
+
+            saveOrGet(ctx.closure().affinityRun(Collections.singletonList(cacheName), partId, affKey,
+                job, prj.nodes()));
+        }
+        catch (IgniteCheckedException e) {
+            throw U.convertException(e);
+        }
+        finally {
+            unguard();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void affinityRun(@NotNull Collection<String> cacheNames, Object affKey, IgniteRunnable job) {
+        A.notNull(affKey, "affKey");
+        A.notNull(job, "job");
+        A.ensure(!cacheNames.isEmpty(), "cachesNames mustn't be empty");
+
+        guard();
+
+        try {
+            final String cacheName = F.first(cacheNames);
+
+            // In case cache key is passed instead of affinity key.
+            final Object affKey0 = ctx.affinity().affinityKey(cacheName, affKey);
+            int partId = ctx.affinity().partition(cacheName, affKey0);
+
+            if (partId < 0)
+                throw new IgniteCheckedException("Failed map key to partition: [cache=" + cacheName + " key="
+                    + affKey + ']');
+
+            saveOrGet(ctx.closure().affinityRun(cacheNames, partId, affKey, job, prj.nodes()));
+        }
+        catch (IgniteCheckedException e) {
+            throw U.convertException(e);
+        }
+        finally {
+            unguard();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void affinityRun(@NotNull Collection<String> cacheNames, int partId, IgniteRunnable job) {
+        A.ensure(partId >= 0, "partId = " + partId);
+        A.notNull(job, "job");
+        A.ensure(!cacheNames.isEmpty(), "cachesNames mustn't be empty");
+
+        guard();
+
+        try {
+            saveOrGet(ctx.closure().affinityRun(cacheNames, partId, null, job, prj.nodes()));
         }
         catch (IgniteCheckedException e) {
             throw U.convertException(e);
@@ -127,7 +186,64 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
         guard();
 
         try {
-            return saveOrGet(ctx.closure().affinityCall(cacheName, affKey, job, prj.nodes()));
+            // In case cache key is passed instead of affinity key.
+            final Object affKey0 = ctx.affinity().affinityKey(cacheName, affKey);
+            int partId = ctx.affinity().partition(cacheName, affKey0);
+
+            if (partId < 0)
+                throw new IgniteCheckedException("Failed map key to partition: [cache=" + cacheName + " key="
+                    + affKey + ']');
+
+            return saveOrGet(ctx.closure().affinityCall(Collections.singletonList(cacheName), partId, affKey, job,
+                prj.nodes()));
+        }
+        catch (IgniteCheckedException e) {
+            throw U.convertException(e);
+        }
+        finally {
+            unguard();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public <R> R affinityCall(@NotNull Collection<String> cacheNames, Object affKey, IgniteCallable<R> job) {
+        A.notNull(affKey, "affKey");
+        A.notNull(job, "job");
+        A.ensure(!cacheNames.isEmpty(), "cachesNames mustn't be empty");
+
+        guard();
+
+        try {
+            final String cacheName = F.first(cacheNames);
+
+            // In case cache key is passed instead of affinity key.
+            final Object affKey0 = ctx.affinity().affinityKey(cacheName, affKey);
+            int partId = ctx.affinity().partition(cacheName, affKey0);
+
+            if (partId < 0)
+                throw new IgniteCheckedException("Failed map key to partition: [cache=" + cacheName + " key="
+                    + affKey + ']');
+
+            return saveOrGet(ctx.closure().affinityCall(cacheNames, partId, affKey, job, prj.nodes()));
+        }
+        catch (IgniteCheckedException e) {
+            throw U.convertException(e);
+        }
+        finally {
+            unguard();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public <R> R affinityCall(@NotNull Collection<String> cacheNames, int partId, IgniteCallable<R> job) {
+        A.ensure(partId >= 0, "partId = " + partId);
+        A.notNull(job, "job");
+        A.ensure(!cacheNames.isEmpty(), "cachesNames mustn't be empty");
+
+        guard();
+
+        try {
+            return saveOrGet(ctx.closure().affinityCall(cacheNames, partId, null, job, prj.nodes()));
         }
         catch (IgniteCheckedException e) {
             throw U.convertException(e);

http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/core/src/main/java/org/apache/ignite/internal/managers/failover/GridFailoverContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/failover/GridFailoverContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/failover/GridFailoverContextImpl.java
index 3985df7..ad77271 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/failover/GridFailoverContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/failover/GridFailoverContextImpl.java
@@ -23,6 +23,7 @@ import org.apache.ignite.compute.ComputeJobResult;
 import org.apache.ignite.compute.ComputeTaskSession;
 import org.apache.ignite.internal.GridTaskSessionImpl;
 import org.apache.ignite.internal.managers.loadbalancer.GridLoadBalancerManager;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.util.tostring.GridToStringExclude;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.spi.failover.FailoverContext;
@@ -42,26 +43,36 @@ public class GridFailoverContextImpl implements FailoverContext {
     @GridToStringExclude
     private final GridLoadBalancerManager loadMgr;
 
+    /** Partition key for affinityCall. */
+    private final int partId;
+
     /** Affinity key for affinityCall. */
     private final Object affKey;
 
     /** Affinity cache name for affinityCall. */
     private final String affCacheName;
 
+    /** Affinity topology version. */
+    private final AffinityTopologyVersion topVer;
+
     /**
      * Initializes failover context.
      *
      * @param taskSes Grid task session.
      * @param jobRes Failed job result.
      * @param loadMgr Load manager.
+     * @param partId Partition.
      * @param affKey Affinity key.
      * @param affCacheName Affinity cache name.
+     * @param topVer Affinity topology version.
      */
     public GridFailoverContextImpl(GridTaskSessionImpl taskSes,
         ComputeJobResult jobRes,
         GridLoadBalancerManager loadMgr,
+        int partId,
         @Nullable Object affKey,
-        @Nullable String affCacheName) {
+        @Nullable String affCacheName,
+        @Nullable AffinityTopologyVersion topVer) {
         assert taskSes != null;
         assert jobRes != null;
         assert loadMgr != null;
@@ -69,8 +80,10 @@ public class GridFailoverContextImpl implements FailoverContext {
         this.taskSes = taskSes;
         this.jobRes = jobRes;
         this.loadMgr = loadMgr;
+        this.partId = partId;
         this.affKey = affKey;
         this.affCacheName = affCacheName;
+        this.topVer = topVer;
     }
 
     /** {@inheritDoc} */
@@ -99,6 +112,18 @@ public class GridFailoverContextImpl implements FailoverContext {
     }
 
     /** {@inheritDoc} */
+    public int partition() {
+        return partId;
+    }
+
+    /**
+     * @return Affinity topology version.
+     */
+    @Nullable public AffinityTopologyVersion affinityTopologyVersion() {
+        return topVer;
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(GridFailoverContextImpl.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/core/src/main/java/org/apache/ignite/internal/managers/failover/GridFailoverManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/failover/GridFailoverManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/failover/GridFailoverManager.java
index fa22b62..52edd1d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/failover/GridFailoverManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/failover/GridFailoverManager.java
@@ -24,6 +24,7 @@ import org.apache.ignite.compute.ComputeJobResult;
 import org.apache.ignite.internal.GridKernalContext;
 import org.apache.ignite.internal.GridTaskSessionImpl;
 import org.apache.ignite.internal.managers.GridManagerAdapter;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.spi.failover.FailoverSpi;
 import org.jetbrains.annotations.Nullable;
 
@@ -58,16 +59,26 @@ public class GridFailoverManager extends GridManagerAdapter<FailoverSpi> {
      * @param taskSes Task session.
      * @param jobRes Job result.
      * @param top Collection of all topology nodes.
+     * @param affPartId Partition number.
      * @param affKey Affinity key.
      * @param affCacheName Affinity cache name.
+     * @param topVer Affinity topology version.
      * @return New node to route this job to.
      */
     public ClusterNode failover(GridTaskSessionImpl taskSes,
         ComputeJobResult jobRes,
         List<ClusterNode> top,
+        int affPartId,
         @Nullable Object affKey,
-        @Nullable String affCacheName) {
-        return getSpi(taskSes.getFailoverSpi()).failover(new GridFailoverContextImpl(taskSes, jobRes,
-            ctx.loadBalancing(), affKey, affCacheName), top);
+        @Nullable String affCacheName,
+        @Nullable AffinityTopologyVersion topVer) {
+        return getSpi(taskSes.getFailoverSpi()).failover(new GridFailoverContextImpl(taskSes,
+            jobRes,
+            ctx.loadBalancing(),
+            affPartId,
+            affKey,
+            affCacheName,
+            topVer),
+            top);
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessor.java
index 19e0842..1726d02 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessor.java
@@ -195,6 +195,24 @@ public class GridAffinityProcessor extends GridProcessorAdapter {
     }
 
     /**
+     * Maps partition to a node.
+     *
+     * @param cacheName Cache name.
+     * @param partId partition.
+     * @param topVer Affinity topology version.
+     * @return Picked node.
+     * @throws IgniteCheckedException If failed.
+     */
+    @Nullable public ClusterNode mapPartitionToNode(@Nullable String cacheName, int partId,
+        AffinityTopologyVersion topVer)
+        throws IgniteCheckedException {
+        AffinityInfo affInfo = affinityCache(cacheName, topVer);
+
+        return affInfo != null ? F.first(affInfo.assignment().get(partId)) : null;
+    }
+
+
+    /**
      * Maps keys to nodes for given cache.
      *
      * @param cacheName Cache name.

http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
index cc3261c..fd0b471 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
@@ -1997,6 +1997,22 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
     public GridCloseableIterator<Map.Entry<byte[], byte[]>> rawSwapIterator(boolean primary, boolean backup)
         throws IgniteCheckedException
     {
+        return rawSwapIterator(primary, backup, cctx.affinity().affinityTopologyVersion());
+    }
+
+    /**
+     * @return Raw off-heap iterator.
+     * @param primary Include primaries.
+     * @param backup Include backups.
+     * @param topVer Affinity topology version.
+     * @throws IgniteCheckedException If failed.
+     */
+    public GridCloseableIterator<Map.Entry<byte[], byte[]>> rawSwapIterator(boolean primary, boolean backup,
+        AffinityTopologyVersion topVer)
+        throws IgniteCheckedException
+    {
+        assert topVer != null;
+
         if (!swapEnabled || (!primary && !backup))
             return new GridEmptyCloseableIterator<>();
 
@@ -2005,10 +2021,8 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
         if (primary && backup)
             return swapMgr.rawIterator(spaceName);
 
-        AffinityTopologyVersion ver = cctx.affinity().affinityTopologyVersion();
-
-        Set<Integer> parts = primary ? cctx.affinity().primaryPartitions(cctx.localNodeId(), ver) :
-            cctx.affinity().backupPartitions(cctx.localNodeId(), ver);
+        Set<Integer> parts = primary ? cctx.affinity().primaryPartitions(cctx.localNodeId(), topVer) :
+            cctx.affinity().backupPartitions(cctx.localNodeId(), topVer);
 
         return new CloseablePartitionsIterator<Map.Entry<byte[], byte[]>, Map.Entry<byte[], byte[]>>(parts) {
             @Override protected GridCloseableIterator<Map.Entry<byte[], byte[]>> partitionIterator(int part)

http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
index 14468eb..35e6267 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
@@ -1229,13 +1229,28 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
     public Iterator<Cache.Entry<K, V>> localEntriesIterator(final boolean primary,
         final boolean backup,
         final boolean keepBinary) {
+        return localEntriesIterator(primary,
+            backup,
+            keepBinary,
+            ctx.affinity().affinityTopologyVersion());
+    }
+
+    /**
+     * @param primary If {@code true} includes primary entries.
+     * @param backup If {@code true} includes backup entries.
+     * @param keepBinary Keep binary flag.
+     * @param topVer Specified affinity topology version.
+     * @return Local entries iterator.
+     */
+    public Iterator<Cache.Entry<K, V>> localEntriesIterator(final boolean primary,
+        final boolean backup,
+        final boolean keepBinary,
+        final AffinityTopologyVersion topVer) {
         assert primary || backup;
 
         if (primary && backup)
             return iterator(entries().iterator(), !keepBinary);
         else {
-            final AffinityTopologyVersion topVer = ctx.affinity().affinityTopologyVersion();
-
             final Iterator<GridDhtLocalPartition> partIt = topology().currentLocalPartitions().iterator();
 
             Iterator<GridCacheMapEntry> it = new Iterator<GridCacheMapEntry>() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
index 5061136..39a3e08 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
@@ -117,6 +117,10 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
     /** Update counter. */
     private final AtomicLong cntr = new AtomicLong();
 
+    /** Set if failed to move partition to RENTING state due to reservations, to be checked when
+     * reservation is released. */
+    private volatile boolean shouldBeRenting;
+
     /**
      * @param cctx Context.
      * @param id Partition ID.
@@ -411,6 +415,9 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
 
             // Decrement reservations.
             if (state.compareAndSet(reservations, --reservations)) {
+                if ((reservations & 0xFFFF) == 0 && shouldBeRenting)
+                    rent(true);
+
                 tryEvict();
 
                 break;
@@ -461,24 +468,24 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
      * @return Future to signal that this node is no longer an owner or backup.
      */
     IgniteInternalFuture<?> rent(boolean updateSeq) {
-        while (true) {
-            long reservations = state.get();
+        long reservations = state.get();
 
-            int ord = (int)(reservations >> 32);
+        int ord = (int)(reservations >> 32);
 
-            if (ord == RENTING.ordinal() || ord == EVICTED.ordinal())
-                return rent;
+        if (ord == RENTING.ordinal() || ord == EVICTED.ordinal())
+            return rent;
 
-            if (casState(reservations, RENTING)) {
-                if (log.isDebugEnabled())
-                    log.debug("Moved partition to RENTING state: " + this);
+        shouldBeRenting = true;
 
-                // Evict asynchronously, as the 'rent' method may be called
-                // from within write locks on local partition.
-                tryEvictAsync(updateSeq);
+        if ((reservations & 0xFFFF) == 0 && casState(reservations, RENTING)) {
+                shouldBeRenting = false;
 
-                break;
-            }
+            if (log.isDebugEnabled())
+                log.debug("Moved partition to RENTING state: " + this);
+
+            // Evict asynchronously, as the 'rent' method may be called
+            // from within write locks on local partition.
+            tryEvictAsync(updateSeq);
         }
 
         return rent;

http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridReservable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridReservable.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridReservable.java
index 51f22bc..068c68d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridReservable.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridReservable.java
@@ -17,6 +17,8 @@
 
 package org.apache.ignite.internal.processors.cache.distributed.dht;
 
+import org.apache.ignite.IgniteCheckedException;
+
 /**
  * Reservations support.
  */
@@ -25,8 +27,9 @@ public interface GridReservable {
      * Reserves.
      *
      * @return {@code true} If reserved successfully.
+     * @throws IgniteCheckedException If failed.
      */
-    public boolean reserve();
+    public boolean reserve() throws IgniteCheckedException;
 
     /**
      * Releases.

http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
index 6729d41..163bac5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
@@ -846,7 +846,10 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
 
             final ExpiryPolicy plc = cctx.expiry();
 
-            final AffinityTopologyVersion topVer = cctx.affinity().affinityTopologyVersion();
+            AffinityTopologyVersion topVer = GridQueryProcessor.getRequestAffinityTopologyVersion();
+
+            if (topVer == null)
+                topVer = cctx.affinity().affinityTopologyVersion();
 
             final boolean backups = qry.includeBackups() || cctx.isReplicated();
 
@@ -935,7 +938,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
 
         Integer part = qry.partition();
 
-        Iterator<Map.Entry<byte[], byte[]>> it = part == null ? cctx.swap().rawSwapIterator(true, backups) :
+        Iterator<Map.Entry<byte[], byte[]>> it = part == null ? cctx.swap().rawSwapIterator(true, backups, topVer) :
             cctx.swap().rawSwapIterator(part);
 
         if (expPlc != null)
@@ -978,8 +981,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
                 GridDhtCacheAdapter<K, V> cache = cctx.isNear() ? cctx.near().dht() : cctx.dht();
 
                 final Iterator<Cache.Entry<K, V>> iter = cache.localEntriesIterator(true,
-                    backups,
-                    cache.context().keepBinary());
+                    backups, cache.context().keepBinary(), topVer);
 
                 return new GridIteratorAdapter<IgniteBiTuple<K, V>>() {
                     /** */

http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/AffinityTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/AffinityTask.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/AffinityTask.java
index da00f01..9007c8b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/AffinityTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/AffinityTask.java
@@ -17,6 +17,8 @@
 
 package org.apache.ignite.internal.processors.closure;
 
+import java.util.Collection;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.jetbrains.annotations.Nullable;
 
 /**
@@ -26,10 +28,21 @@ public interface AffinityTask {
     /**
      * @return Affinity key.
      */
-    public Object affinityKey();
+    @Deprecated
+    @Nullable public Object affinityKey();
+
+    /**
+     * @return Partition.
+     */
+    public int partition();
 
     /**
      * @return Affinity cache name.
      */
-    @Nullable public String affinityCacheName();
+    @Nullable public Collection<String> affinityCacheNames();
+
+    /**
+     * @return Affinity topology version.
+     */
+    @Nullable public AffinityTopologyVersion topologyVersion();
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
index f9b74c4..6f878ce 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/closure/GridClosureProcessor.java
@@ -51,6 +51,7 @@ import org.apache.ignite.internal.GridInternalWrapper;
 import org.apache.ignite.internal.GridKernalContext;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.processors.GridProcessorAdapter;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.resource.GridNoImplicitInjection;
 import org.apache.ignite.internal.util.GridSpinReadWriteLock;
 import org.apache.ignite.internal.util.IgniteUtils;
@@ -439,34 +440,38 @@ public class GridClosureProcessor extends GridProcessorAdapter {
     }
 
     /**
-     * @param cacheName Cache name.
+     * @param cacheNames Cache names.
+     * @param partId Partition.
      * @param affKey Affinity key.
-     * @param job Job.
+     * @param job Closure to execute.
      * @param nodes Grid nodes.
-     * @return Job future.
+     * @return Grid future for collection of closure results.
+     * @throws IgniteCheckedException If failed.
      */
-    public <R> ComputeTaskInternalFuture<R> affinityCall(@Nullable String cacheName, Object affKey, Callable<R> job,
-        @Nullable Collection<ClusterNode> nodes) {
+    public <R> ComputeTaskInternalFuture<R> affinityCall(@NotNull Collection<String> cacheNames,
+        int partId,
+        @Nullable Object affKey,
+        Callable<R> job,
+        @Nullable Collection<ClusterNode> nodes) throws IgniteCheckedException {
+        assert partId >= 0 : partId;
+
         busyLock.readLock();
 
         try {
             if (F.isEmpty(nodes))
                 return ComputeTaskInternalFuture.finishedFuture(ctx, T5.class, U.emptyTopologyException());
 
-            // In case cache key is passed instead of affinity key.
-            final Object affKey0 = ctx.affinity().affinityKey(cacheName, affKey);
+            final String cacheName = F.first(cacheNames);
 
-            final ClusterNode node = ctx.affinity().mapKeyToNode(cacheName, affKey0);
+            final AffinityTopologyVersion mapTopVer = ctx.discovery().topologyVersionEx();
+            final ClusterNode node = ctx.affinity().mapPartitionToNode(cacheName, partId, mapTopVer);
 
             if (node == null)
                 return ComputeTaskInternalFuture.finishedFuture(ctx, T5.class, U.emptyTopologyException());
 
             ctx.task().setThreadContext(TC_SUBGRID, nodes);
 
-            return ctx.task().execute(new T5(node, job, affKey0, cacheName), null, false);
-        }
-        catch (IgniteCheckedException e) {
-            return ComputeTaskInternalFuture.finishedFuture(ctx, T5.class, e);
+            return ctx.task().execute(new T5(node, job, cacheNames, partId, affKey, mapTopVer), null, false);
         }
         finally {
             busyLock.readUnlock();
@@ -474,34 +479,38 @@ public class GridClosureProcessor extends GridProcessorAdapter {
     }
 
     /**
-     * @param cacheName Cache name.
+     * @param cacheNames Cache names.
+     * @param partId Partition.
      * @param affKey Affinity key.
      * @param job Job.
      * @param nodes Grid nodes.
      * @return Job future.
+     * @throws IgniteCheckedException If failed.
      */
-    public ComputeTaskInternalFuture<?> affinityRun(@Nullable String cacheName, Object affKey, Runnable job,
-        @Nullable Collection<ClusterNode> nodes) {
+    public ComputeTaskInternalFuture<?> affinityRun(@NotNull Collection<String> cacheNames,
+        int partId,
+        @Nullable Object affKey,
+        Runnable job,
+        @Nullable Collection<ClusterNode> nodes) throws IgniteCheckedException {
+        assert partId >= 0 : partId;
+
         busyLock.readLock();
 
         try {
             if (F.isEmpty(nodes))
                 return ComputeTaskInternalFuture.finishedFuture(ctx, T4.class, U.emptyTopologyException());
 
-            // In case cache key is passed instead of affinity key.
-            final Object affKey0 = ctx.affinity().affinityKey(cacheName, affKey);
+            final String cacheName = F.first(cacheNames);
 
-            final ClusterNode node = ctx.affinity().mapKeyToNode(cacheName, affKey0);
+            final AffinityTopologyVersion mapTopVer = ctx.discovery().topologyVersionEx();
+            final ClusterNode node = ctx.affinity().mapPartitionToNode(cacheName, partId, mapTopVer);
 
             if (node == null)
                 return ComputeTaskInternalFuture.finishedFuture(ctx, T4.class, U.emptyTopologyException());
 
             ctx.task().setThreadContext(TC_SUBGRID, nodes);
 
-            return ctx.task().execute(new T4(node, job, affKey0, cacheName), null, false);
-        }
-        catch (IgniteCheckedException e) {
-            return ComputeTaskInternalFuture.finishedFuture(ctx, T4.class, e);
+            return ctx.task().execute(new T4(node, job, cacheNames, partId, affKey, mapTopVer), null, false);
         }
         finally {
             busyLock.readUnlock();
@@ -1183,7 +1192,7 @@ public class GridClosureProcessor extends GridProcessorAdapter {
         }
 
         /**
-         *
+         * @return Map.
          */
         public Map<ComputeJob, ClusterNode> map() {
             return map;
@@ -1346,23 +1355,35 @@ public class GridClosureProcessor extends GridProcessorAdapter {
         private Object affKey;
 
         /** */
-        private String affCacheName;
+        private int partId;
+
+        /** */
+        private AffinityTopologyVersion topVer;
+
+        /** */
+        private Collection<String> affCacheNames;
+
 
         /**
          * @param node Cluster node.
-         * @param job Job.
+         * @param job Job affinity partition.
+         * @param affCacheNames Affinity caches.
+         * @param partId Partition.
          * @param affKey Affinity key.
-         * @param affCacheName Affinity cache name.
+         * @param topVer Affinity topology version.
          */
-        private T4(ClusterNode node, Runnable job, Object affKey, String affCacheName) {
+        private T4(ClusterNode node, Runnable job, Collection<String> affCacheNames, int partId, Object affKey,
+            AffinityTopologyVersion topVer) {
             super(U.peerDeployAware0(job));
 
-            assert affKey != null;
+            assert partId >= 0;
 
             this.node = node;
             this.job = job;
+            this.affCacheNames = affCacheNames;
+            this.partId = partId;
             this.affKey = affKey;
-            this.affCacheName = affCacheName;
+            this.topVer = topVer;
         }
 
         /** {@inheritDoc} */
@@ -1371,13 +1392,23 @@ public class GridClosureProcessor extends GridProcessorAdapter {
         }
 
         /** {@inheritDoc} */
-        @Override public Object affinityKey() {
-            return affKey;
+        @Override public int partition() {
+            return partId;
         }
 
         /** {@inheritDoc} */
-        @Nullable @Override public String affinityCacheName() {
-            return affCacheName;
+        @Nullable @Override public Collection<String> affinityCacheNames() {
+            return affCacheNames;
+        }
+
+        /** {@inheritDoc} */
+        @Nullable @Override public AffinityTopologyVersion topologyVersion() {
+            return topVer;
+        }
+
+        /** {@inheritDoc} */
+        @Nullable @Override public Object affinityKey() {
+            return affKey;
         }
     }
 
@@ -1398,23 +1429,38 @@ public class GridClosureProcessor extends GridProcessorAdapter {
         private Object affKey;
 
         /** */
-        private String affCacheName;
+        private int partId;
+
+        /** */
+        private AffinityTopologyVersion topVer;
+
+        /** */
+        private Collection<String> affCacheNames;
+
+
 
         /**
          * @param node Cluster node.
-         * @param job Job.
+         * @param job Job affinity partition.
+         * @param affCacheNames Affinity caches.
+         * @param partId Partition.
          * @param affKey Affinity key.
-         * @param affCacheName Affinity cache name.
+         * @param topVer Affinity topology version.
          */
-        private T5(ClusterNode node, Callable<R> job, Object affKey, String affCacheName) {
+        private T5(ClusterNode node,
+            Callable<R> job,
+            Collection<String> affCacheNames,
+            int partId,
+            Object affKey,
+            AffinityTopologyVersion topVer) {
             super(U.peerDeployAware0(job));
 
-            assert affKey != null;
-
             this.node = node;
             this.job = job;
+            this.affCacheNames = affCacheNames;
+            this.partId = partId;
             this.affKey = affKey;
-            this.affCacheName = affCacheName;
+            this.topVer = topVer;
         }
 
         /** {@inheritDoc} */
@@ -1433,13 +1479,23 @@ public class GridClosureProcessor extends GridProcessorAdapter {
         }
 
         /** {@inheritDoc} */
-        @Override public Object affinityKey() {
+        @Nullable @Override public Object affinityKey() {
             return affKey;
         }
 
         /** {@inheritDoc} */
-        @Nullable @Override public String affinityCacheName() {
-            return affCacheName;
+        @Override public int partition() {
+            return partId;
+        }
+
+        /** {@inheritDoc} */
+        @Nullable @Override public Collection<String> affinityCacheNames() {
+            return affCacheNames;
+        }
+
+        /** {@inheritDoc} */
+        @Nullable @Override public AffinityTopologyVersion topologyVersion() {
+            return topVer;
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobProcessor.java
index a2e9e33..6a162d3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobProcessor.java
@@ -60,12 +60,17 @@ import org.apache.ignite.internal.managers.communication.GridMessageListener;
 import org.apache.ignite.internal.managers.deployment.GridDeployment;
 import org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener;
 import org.apache.ignite.internal.processors.GridProcessorAdapter;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridReservable;
 import org.apache.ignite.internal.processors.jobmetrics.GridJobMetricsSnapshot;
 import org.apache.ignite.internal.util.GridAtomicLong;
 import org.apache.ignite.internal.util.GridBoundedConcurrentLinkedHashMap;
 import org.apache.ignite.internal.util.GridBoundedConcurrentLinkedHashSet;
 import org.apache.ignite.internal.util.GridConcurrentHashSet;
 import org.apache.ignite.internal.util.GridSpinReadWriteLock;
+import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.P1;
 import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.internal.util.typedef.internal.S;
@@ -93,6 +98,7 @@ import static org.apache.ignite.internal.GridTopic.TOPIC_JOB_SIBLINGS;
 import static org.apache.ignite.internal.GridTopic.TOPIC_TASK;
 import static org.apache.ignite.internal.managers.communication.GridIoPolicy.MANAGEMENT_POOL;
 import static org.apache.ignite.internal.managers.communication.GridIoPolicy.SYSTEM_POOL;
+import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState.OWNING;
 import static org.jsr166.ConcurrentLinkedHashMap.QueuePolicy.PER_SEGMENT_Q;
 
 /**
@@ -420,7 +426,8 @@ public class GridJobProcessor extends GridProcessorAdapter {
      * @return Siblings.
      * @throws IgniteCheckedException If failed.
      */
-    public Collection<ComputeJobSibling> requestJobSiblings(final ComputeTaskSession ses) throws IgniteCheckedException {
+    public Collection<ComputeJobSibling> requestJobSiblings(
+        final ComputeTaskSession ses) throws IgniteCheckedException {
         assert ses != null;
 
         final UUID taskNodeId = ses.getTaskNodeId();
@@ -628,7 +635,7 @@ public class GridJobProcessor extends GridProcessorAdapter {
                 GridJobWorker activeJob = activeJobs.get(jobId);
 
                 if (activeJob != null && idsMatch.apply(activeJob))
-                    cancelActiveJob(activeJob,  sys);
+                    cancelActiveJob(activeJob, sys);
             }
         }
         finally {
@@ -743,7 +750,7 @@ public class GridJobProcessor extends GridProcessorAdapter {
                             void advance() {
                                 assert w == null;
 
-                                while(iter.hasNext()) {
+                                while (iter.hasNext()) {
                                     GridJobWorker w0 = iter.next();
 
                                     assert !w0.isInternal();
@@ -804,7 +811,7 @@ public class GridJobProcessor extends GridProcessorAdapter {
                             void advance() {
                                 assert w == null;
 
-                                while(iter.hasNext()) {
+                                while (iter.hasNext()) {
                                     GridJobWorker w0 = iter.next();
 
                                     assert !w0.isInternal();
@@ -947,6 +954,15 @@ public class GridJobProcessor extends GridProcessorAdapter {
         if (log.isDebugEnabled())
             log.debug("Received job request message [req=" + req + ", nodeId=" + node.id() + ']');
 
+        PartitionsReservation partsReservation = null;
+
+        if (req.getCacheIds() != null) {
+            assert req.getPartition() >= 0 : req;
+            assert !F.isEmpty(req.getCacheIds()) : req;
+
+            partsReservation = new PartitionsReservation(req.getCacheIds(), req.getPartition(), req.getTopVer());
+        }
+
         GridJobWorker job = null;
 
         if (!rwLock.tryReadLock()) {
@@ -1079,7 +1095,9 @@ public class GridJobProcessor extends GridProcessorAdapter {
                         node,
                         req.isInternal(),
                         evtLsnr,
-                        holdLsnr);
+                        holdLsnr,
+                        partsReservation,
+                        req.getTopVer());
 
                     jobCtx.job(job);
 
@@ -1330,7 +1348,8 @@ public class GridJobProcessor extends GridProcessorAdapter {
                 null,
                 loc ? null : marsh.marshal(null),
                 null,
-                false);
+                false,
+                null);
 
             if (req.isSessionFullSupport()) {
                 // Send response to designated job topic.
@@ -1472,6 +1491,114 @@ public class GridJobProcessor extends GridProcessorAdapter {
     /**
      *
      */
+    private class PartitionsReservation implements GridReservable {
+        /** Caches. */
+        private final int[] cacheIds;
+
+        /** Partition id. */
+        private final int partId;
+
+        /** Topology version. */
+        private final AffinityTopologyVersion topVer;
+
+        /** Partitions. */
+        private GridDhtLocalPartition[] partititons;
+
+        /**
+         * @param cacheIds Cache identifiers array.
+         * @param partId Partition number.
+         * @param topVer Affinity topology version.
+         */
+        public PartitionsReservation(int[] cacheIds, int partId,
+            AffinityTopologyVersion topVer) {
+            this.cacheIds = cacheIds;
+            this.partId = partId;
+            this.topVer = topVer;
+            partititons = new GridDhtLocalPartition[cacheIds.length];
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean reserve() throws IgniteCheckedException {
+            boolean reserved = false;
+
+            try {
+                for (int i = 0; i < cacheIds.length; ++i) {
+                    GridCacheContext<?, ?> cctx = ctx.cache().context().cacheContext(cacheIds[i]);
+
+                    if (cctx == null) // Cache was not found, probably was not deployed yet.
+                        return reserved;
+
+                    if (!cctx.started()) // Cache not started.
+                        return reserved;
+
+                    if (cctx.isLocal() || !cctx.rebalanceEnabled())
+                        continue;
+
+                    boolean checkPartMapping = false;
+
+                    try {
+                        if (cctx.isReplicated()) {
+                            GridDhtLocalPartition part = cctx.topology().localPartition(partId,
+                                topVer, false);
+
+                            // We don't need to reserve partitions because they will not be evicted in replicated caches.
+                            if (part == null || part.state() != OWNING) {
+                                checkPartMapping = true;
+
+                                return reserved;
+                            }
+                        }
+
+                        GridDhtLocalPartition part = cctx.topology().localPartition(partId, topVer, false);
+
+                        if (part == null || part.state() != OWNING || !part.reserve()) {
+                            checkPartMapping = true;
+
+                            return reserved;
+                        }
+
+                        partititons[i] = part;
+
+                        // Double check that we are still in owning state and partition contents are not cleared.
+                        if (part.state() != OWNING) {
+                            checkPartMapping = true;
+
+                            return reserved;
+                        }
+                    }
+                    finally {
+                        if (checkPartMapping && !cctx.affinity().primary(partId, topVer).id().equals(ctx.localNodeId()))
+                            throw new IgniteCheckedException("Failed partition reservation. " +
+                                "Partition is not primary on the node. [partition=" + partId + ", cacheName=" + cctx.name() +
+                                ", nodeId=" + ctx.localNodeId() + ", topology=" + topVer + ']');
+                    }
+                }
+
+                reserved = true;
+            }
+            finally {
+                if (!reserved)
+                    release();
+            }
+
+            return true;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void release() {
+            for (int i = 0; i < partititons.length; ++i) {
+                if (partititons[i] == null)
+                    break;
+
+                partititons[i].release();
+                partititons[i] = null;
+            }
+        }
+    }
+
+    /**
+     *
+     */
     private class CollisionJobContext extends GridCollisionJobContextAdapter {
         /** */
         private final boolean passive;

http://git-wip-us.apache.org/repos/asf/ignite/blob/01800101/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobWorker.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobWorker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobWorker.java
index 5b04d6f..16fadaf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobWorker.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobWorker.java
@@ -43,6 +43,9 @@ import org.apache.ignite.internal.GridJobSessionImpl;
 import org.apache.ignite.internal.GridKernalContext;
 import org.apache.ignite.internal.IgniteInterruptedCheckedException;
 import org.apache.ignite.internal.managers.deployment.GridDeployment;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridReservable;
+import org.apache.ignite.internal.processors.query.GridQueryProcessor;
 import org.apache.ignite.internal.processors.task.GridInternal;
 import org.apache.ignite.internal.processors.timeout.GridTimeoutObject;
 import org.apache.ignite.internal.util.typedef.F;
@@ -154,6 +157,12 @@ public class GridJobWorker extends GridWorker implements GridTimeoutObject {
     /** Hold/unhold listener to notify job processor. */
     private final GridJobHoldListener holdLsnr;
 
+    /** Partitions to reservations. */
+    private final GridReservable partsReservation;
+
+    /** Request topology version. */
+    private final AffinityTopologyVersion reqTopVer;
+
     /**
      * @param ctx Kernal context.
      * @param dep Grid deployment.
@@ -166,6 +175,8 @@ public class GridJobWorker extends GridWorker implements GridTimeoutObject {
      * @param internal Whether or not task was marked with {@link GridInternal}
      * @param evtLsnr Job event listener.
      * @param holdLsnr Hold listener.
+     * @param partsReservation Reserved partitions (must be released at the job finish).
+     * @param reqTopVer Affinity topology version of the job request.
      */
     GridJobWorker(
         GridKernalContext ctx,
@@ -178,7 +189,9 @@ public class GridJobWorker extends GridWorker implements GridTimeoutObject {
         ClusterNode taskNode,
         boolean internal,
         GridJobEventListener evtLsnr,
-        GridJobHoldListener holdLsnr) {
+        GridJobHoldListener holdLsnr,
+        GridReservable partsReservation,
+        AffinityTopologyVersion reqTopVer) {
         super(ctx.gridName(), "grid-job-worker", ctx.log(GridJobWorker.class));
 
         assert ctx != null;
@@ -199,6 +212,8 @@ public class GridJobWorker extends GridWorker implements GridTimeoutObject {
         this.taskNode = taskNode;
         this.internal = internal;
         this.holdLsnr = holdLsnr;
+        this.partsReservation = partsReservation;
+        this.reqTopVer = reqTopVer;
 
         if (job != null)
             this.job = job;
@@ -471,96 +486,128 @@ public class GridJobWorker extends GridWorker implements GridTimeoutObject {
         // Make sure flag is not set for current thread.
         HOLD.set(false);
 
-        if (isCancelled())
-            // If job was cancelled prior to assigning runner to it?
-            super.cancel();
+        try {
+            if (partsReservation != null) {
+                try {
+                    if (!partsReservation.reserve()) {
+                        finishJob(null, null, true, true);
 
-        if (!skipNtf) {
-            if (holdLsnr.onUnheld(this))
-                held.decrementAndGet();
-            else {
-                if (log.isDebugEnabled())
-                    log.debug("Ignoring job execution (job was not held).");
+                        return;
+                    }
+                }
+                catch (Exception e) {
+                    IgniteException ex = new IgniteException("Failed to lock partitions " +
+                        "[jobId=" + ses.getJobId() + ", ses=" + ses + ']', e);
 
-                return;
+                    U.error(log, "Failed to lock partitions [jobId=" + ses.getJobId() + ", ses=" + ses + ']', e);;
+
+                    finishJob(null, ex, true);
+
+                    return;
+                }
             }
-        }
 
-        boolean sndRes = true;
+            if (isCancelled())
+                // If job was cancelled prior to assigning runner to it?
+                super.cancel();
 
-        Object res = null;
+            if (!skipNtf) {
+                if (holdLsnr.onUnheld(this))
+                    held.decrementAndGet();
+                else {
+                    if (log.isDebugEnabled())
+                        log.debug("Ignoring job execution (job was not held).");
 
-        IgniteException ex = null;
+                    return;
+                }
+            }
 
-        try {
-            ctx.job().currentTaskSession(ses);
-
-            // If job has timed out, then
-            // avoid computation altogether.
-            if (isTimedOut())
-                sndRes = false;
-            else {
-                res = U.wrapThreadLoader(dep.classLoader(), new Callable<Object>() {
-                    @Nullable @Override public Object call() {
-                        try {
-                            if (internal && ctx.config().isPeerClassLoadingEnabled())
-                                ctx.job().internal(true);
+            boolean sndRes = true;
 
-                            return job.execute();
-                        }
-                        finally {
-                            if (internal && ctx.config().isPeerClassLoadingEnabled())
-                                ctx.job().internal(false);
+            Object res = null;
+
+            IgniteException ex = null;
+
+            try {
+                ctx.job().currentTaskSession(ses);
+
+                if (reqTopVer != null)
+                    GridQueryProcessor.setRequestAffinityTopologyVersion(reqTopVer);
+
+                // If job has timed out, then
+                // avoid computation altogether.
+                if (isTimedOut())
+                    sndRes = false;
+                else {
+                    res = U.wrapThreadLoader(dep.classLoader(), new Callable<Object>() {
+                        @Nullable @Override public Object call() {
+                            try {
+                                if (internal && ctx.config().isPeerClassLoadingEnabled())
+                                    ctx.job().internal(true);
+
+                                return job.execute();
+                            }
+                            finally {
+                                if (internal && ctx.config().isPeerClassLoadingEnabled())
+                                    ctx.job().internal(false);
+                            }
                         }
-                    }
-                });
+                    });
 
-                if (log.isDebugEnabled())
-                    log.debug("Job execution has successfully finished [job=" + job + ", res=" + res + ']');
+                    if (log.isDebugEnabled())
+                        log.debug("Job execution has successfully finished [job=" + job + ", res=" + res + ']');
+                }
             }
-        }
-        catch (IgniteException e) {
-            if (sysStopping && e.hasCause(IgniteInterruptedCheckedException.class, InterruptedException.class)) {
-                ex = handleThrowable(e);
+            catch (IgniteException e) {
+                if (sysStopping && e.hasCause(IgniteInterruptedCheckedException.class, InterruptedException.class)) {
+                    ex = handleThrowable(e);
 
-                assert ex != null;
-            }
-            else {
-                if (X.hasCause(e, GridInternalException.class) || X.hasCause(e, IgfsOutOfSpaceException.class)) {
-                    // Print exception for internal errors only if debug is enabled.
-                    if (log.isDebugEnabled())
-                        U.error(log, "Failed to execute job [jobId=" + ses.getJobId() + ", ses=" + ses + ']', e);
+                    assert ex != null;
                 }
-                else if (X.hasCause(e, InterruptedException.class)) {
-                    String msg = "Job was cancelled [jobId=" + ses.getJobId() + ", ses=" + ses + ']';
+                else {
+                    if (X.hasCause(e, GridInternalException.class) || X.hasCause(e, IgfsOutOfSpaceException.class)) {
+                        // Print exception for internal errors only if debug is enabled.
+                        if (log.isDebugEnabled())
+                            U.error(log, "Failed to execute job [jobId=" + ses.getJobId() + ", ses=" + ses + ']', e);
+                    }
+                    else if (X.hasCause(e, InterruptedException.class)) {
+                        String msg = "Job was cancelled [jobId=" + ses.getJobId() + ", ses=" + ses + ']';
 
-                    if (log.isDebugEnabled())
-                        U.error(log, msg, e);
+                        if (log.isDebugEnabled())
+                            U.error(log, msg, e);
+                        else
+                            U.warn(log, msg);
+                    }
                     else
-                        U.warn(log, msg);
+                        U.error(log, "Failed to execute job [jobId=" + ses.getJobId() + ", ses=" + ses + ']', e);
+
+                    ex = e;
                 }
-                else
-                    U.error(log, "Failed to execute job [jobId=" + ses.getJobId() + ", ses=" + ses + ']', e);
+            }
+            // Catch Throwable to protect against bad user code except
+            // InterruptedException if job is being cancelled.
+            catch (Throwable e) {
+                ex = handleThrowable(e);
 
-                ex = e;
+                assert ex != null;
+
+                if (e instanceof Error)
+                    throw (Error)e;
             }
-        }
-        // Catch Throwable to protect against bad user code except
-        // InterruptedException if job is being cancelled.
-        catch (Throwable e) {
-            ex = handleThrowable(e);
+            finally {
+                // Finish here only if not held by this thread.
+                if (!HOLD.get())
+                    finishJob(res, ex, sndRes);
 
-            assert ex != null;
+                ctx.job().currentTaskSession(null);
 
-            if (e instanceof Error)
-                throw (Error)e;
+                if (reqTopVer != null)
+                    GridQueryProcessor.setRequestAffinityTopologyVersion(null);
+            }
         }
         finally {
-            // Finish here only if not held by this thread.
-            if (!HOLD.get())
-                finishJob(res, ex, sndRes);
-
-            ctx.job().currentTaskSession(null);
+            if (partsReservation != null)
+                partsReservation.release();
         }
     }
 
@@ -686,7 +733,20 @@ public class GridJobWorker extends GridWorker implements GridTimeoutObject {
      */
     void finishJob(@Nullable Object res,
         @Nullable IgniteException ex,
-        boolean sndReply)
+        boolean sndReply) {
+        finishJob(res, ex, sndReply, false);
+    }
+
+    /**
+     * @param res Resuilt.
+     * @param ex Exception
+     * @param sndReply If {@code true}, reply will be sent.
+     * @param retry If {@code true}, retry response will be sent.
+     */
+    void finishJob(@Nullable Object res,
+        @Nullable IgniteException ex,
+        boolean sndReply,
+        boolean retry)
     {
         // Avoid finishing a job more than once from different threads.
         if (!finishing.compareAndSet(false, true))
@@ -750,7 +810,8 @@ public class GridJobWorker extends GridWorker implements GridTimeoutObject {
                                 loc ? res : null,
                                 loc ? null : marsh.marshal(attrs),
                                 loc ? attrs : null,
-                                isCancelled());
+                                isCancelled(),
+                                retry ? ctx.cache().context().exchange().readyAffinityVersion() : null);
 
                             long timeout = ses.getEndTime() - U.currentTimeMillis();
 


[11/19] ignite git commit: IGNITE-2310 Lock cache partition for affinityRun/affinityCall execution - add javadoc for test

Posted by an...@apache.org.
IGNITE-2310 Lock cache partition for affinityRun/affinityCall execution -  add javadoc for test


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d1a3904c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d1a3904c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d1a3904c

Branch: refs/heads/master
Commit: d1a3904c8c8ed4a6cf750a2caa4e2e06cc471698
Parents: e23aba4
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Tue Aug 9 16:23:34 2016 +0300
Committer: tledkov-gridgain <tl...@gridgain.com>
Committed: Tue Aug 9 16:23:34 2016 +0300

----------------------------------------------------------------------
 .../cache/IgniteCacheLockPartitionOnAffinityRunAbstractTest.java    | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/d1a3904c/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunAbstractTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunAbstractTest.java
index 28d297d..11dc6c5 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunAbstractTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunAbstractTest.java
@@ -32,6 +32,7 @@ import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 
 /**
+ * Base class of for the tests to validate https://issues.apache.org/jira/browse/IGNITE-2310
  */
 public class IgniteCacheLockPartitionOnAffinityRunAbstractTest extends GridCacheAbstractSelfTest {
     /** Count of affinity run threads. */


[03/19] ignite git commit: IGNITE-3631: IGFS: Now metadata co-location is used for PARTITIONED cache as well.

Posted by an...@apache.org.
IGNITE-3631: IGFS: Now metadata co-location is used for PARTITIONED cache as well.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/bb0fb729
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bb0fb729
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bb0fb729

Branch: refs/heads/master
Commit: bb0fb7293b7e430431e7699101320f59b3b93067
Parents: 78a21f1
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Aug 5 15:05:43 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Aug 5 15:05:43 2016 +0300

----------------------------------------------------------------------
 .../org/apache/ignite/internal/processors/igfs/IgfsUtils.java   | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/bb0fb729/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
index 3a313ad..3d86fbb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
@@ -17,13 +17,11 @@
 
 package org.apache.ignite.internal.processors.igfs;
 
-import java.util.Set;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.IgniteSystemProperties;
 import org.apache.ignite.binary.BinaryRawReader;
 import org.apache.ignite.binary.BinaryRawWriter;
-import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.cache.CacheWriteSynchronizationMode;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.cluster.ClusterTopologyException;
@@ -32,8 +30,8 @@ import org.apache.ignite.configuration.FileSystemConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.events.IgfsEvent;
 import org.apache.ignite.igfs.IgfsException;
-import org.apache.ignite.igfs.IgfsMode;
 import org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper;
+import org.apache.ignite.igfs.IgfsMode;
 import org.apache.ignite.igfs.IgfsPath;
 import org.apache.ignite.internal.GridKernalContext;
 import org.apache.ignite.internal.binary.BinaryUtils;
@@ -61,6 +59,7 @@ import java.util.Comparator;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.UUID;
 import java.util.concurrent.ThreadLocalRandom;
 


[19/19] ignite git commit: Merge branch 'ignite-1.7.2'

Posted by an...@apache.org.
Merge branch 'ignite-1.7.2'


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4ee2353f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4ee2353f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4ee2353f

Branch: refs/heads/master
Commit: 4ee2353f7fd7a7601247088cef8a5f817b478097
Parents: e5ae9fc 7307d8d
Author: Andrey Novikov <an...@apache.org>
Authored: Thu Aug 11 10:31:42 2016 +0700
Committer: Andrey Novikov <an...@apache.org>
Committed: Thu Aug 11 10:31:42 2016 +0700

----------------------------------------------------------------------
 .../ignite/codegen/MessageCodeGenerator.java    |   6 +-
 .../java/org/apache/ignite/IgniteCompute.java   |  69 +-
 .../configuration/ConnectorConfiguration.java   |   1 +
 .../internal/GridEventConsumeHandler.java       |   5 +
 .../ignite/internal/GridJobExecuteRequest.java  | 148 +++-
 .../ignite/internal/GridJobExecuteResponse.java |  42 +-
 .../internal/GridMessageListenHandler.java      |   5 +
 .../ignite/internal/IgniteComputeImpl.java      | 120 ++-
 .../ignite/internal/binary/BinaryContext.java   |   2 +
 .../discovery/GridDiscoveryManager.java         |   3 +-
 .../failover/GridFailoverContextImpl.java       |  27 +-
 .../managers/failover/GridFailoverManager.java  |  17 +-
 .../affinity/GridAffinityProcessor.java         |  18 +
 .../processors/cache/GridCacheSwapManager.java  |  22 +-
 .../distributed/dht/GridDhtCacheAdapter.java    |  19 +-
 .../distributed/dht/GridDhtLocalPartition.java  |  33 +-
 .../cache/query/GridCacheQueryManager.java      |  10 +-
 .../continuous/CacheContinuousQueryEntry.java   |  16 +-
 .../continuous/CacheContinuousQueryHandler.java |  85 +-
 .../processors/closure/AffinityTask.java        |  17 +-
 .../closure/GridClosureProcessor.java           | 142 +++-
 .../continuous/GridContinuousHandler.java       |   5 +
 .../continuous/GridContinuousProcessor.java     |  11 +-
 .../continuous/GridContinuousQueryBatch.java    |  47 +
 .../processors/igfs/IgfsFileAffinityRange.java  |  40 +-
 .../processors/igfs/IgfsMetaManager.java        |   9 +
 .../internal/processors/igfs/IgfsUtils.java     |  42 +-
 .../meta/IgfsClientMetaUnlockCallable.java      | 123 +++
 .../processors/job/GridJobProcessor.java        | 139 ++-
 .../internal/processors/job/GridJobWorker.java  | 203 +++--
 .../processors/query/GridQueryProcessor.java    |  22 +-
 .../processors/task/GridTaskWorker.java         | 235 +++--
 .../ignite/internal/util/IgniteUtils.java       |  10 +
 .../internal/visor/util/VisorTaskUtils.java     |   8 +
 .../ignite/spi/discovery/tcp/ClientImpl.java    |   8 +-
 .../ignite/spi/failover/FailoverContext.java    |  15 +-
 .../spi/failover/always/AlwaysFailoverSpi.java  |  15 +-
 .../GridJobMasterLeaveAwareSelfTest.java        |   4 +-
 ...ectionLocalJobMultipleArgumentsSelfTest.java |   4 +-
 .../GridTaskFailoverAffinityRunTest.java        |   2 +-
 .../IgniteComputeEmptyClusterGroupTest.java     |   8 +-
 .../binary/GridBinaryAffinityKeySelfTest.java   |   6 +-
 ...acheAbstractUsersAffinityMapperSelfTest.java |   2 +-
 ...niteDynamicCacheStartStopConcurrentTest.java |   2 +-
 ...niteCacheContinuousQueryBackupQueueTest.java | 184 +++-
 .../spi/failover/GridFailoverTestContext.java   |   6 +
 .../ignite/testframework/IgniteTestSuite.java   | 191 +++++
 .../apache/ignite/testsuites/IgniteIgnore.java  |  35 +
 .../testsuites/IgniteIgnoredTestSuite.java      |  63 ++
 ...eLockPartitionOnAffinityRunAbstractTest.java | 413 +++++++++
 ...PartitionOnAffinityRunAtomicCacheOpTest.java | 329 +++++++
 ...niteCacheLockPartitionOnAffinityRunTest.java | 852 +++++++++++++++++++
 ...LockPartitionOnAffinityRunTxCacheOpTest.java |  33 +
 ...titionOnAffinityRunWithCollisionSpiTest.java | 204 +++++
 .../IgniteCacheAffinityRunTestSuite.java        |  45 +
 .../apache/ignite/cache/spring/SpringCache.java |  44 +-
 .../ignite/cache/spring/SpringCacheManager.java |   7 +-
 .../spring/GridSpringCacheManagerSelfTest.java  | 438 ++++++++++
 .../cache/spring/GridSpringCacheTestKey.java    |  61 ++
 .../spring/GridSpringCacheTestKeyGenerator.java |  40 +
 .../spring/GridSpringCacheTestService.java      | 181 ++++
 .../GridSpringDynamicCacheTestService.java      |  85 ++
 .../SpringCacheManagerContextInjectionTest.java | 125 +++
 .../ignite/cache/spring/spring-caching.xml      |  57 ++
 .../spring/GridSpringCacheManagerSelfTest.java  | 342 --------
 .../ignite/spring/GridSpringCacheTestKey.java   |  61 --
 .../spring/GridSpringCacheTestKeyGenerator.java |  40 -
 .../spring/GridSpringCacheTestService.java      | 125 ---
 .../GridSpringDynamicCacheTestService.java      |  85 --
 .../SpringCacheManagerContextInjectionTest.java | 126 ---
 .../org/apache/ignite/spring/spring-caching.xml |  57 --
 .../testsuites/IgniteSpringTestSuite.java       |   4 +-
 72 files changed, 4814 insertions(+), 1186 deletions(-)
----------------------------------------------------------------------



[15/19] ignite git commit: IGNITE-2310 Lock cache partition for affinityRun/affinityCall execution - fix reservable

Posted by an...@apache.org.
IGNITE-2310 Lock cache partition for affinityRun/affinityCall execution -  fix reservable


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8bf0a48c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8bf0a48c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8bf0a48c

Branch: refs/heads/master
Commit: 8bf0a48cf21c5b75feb62481ddfca102b4a84fd9
Parents: 47da199
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Wed Aug 10 12:07:21 2016 +0300
Committer: tledkov-gridgain <tl...@gridgain.com>
Committed: Wed Aug 10 12:07:21 2016 +0300

----------------------------------------------------------------------
 .../processors/cache/distributed/dht/GridReservable.java        | 5 +----
 .../apache/ignite/internal/processors/job/GridJobProcessor.java | 4 ++--
 .../ignite/internal/processors/query/GridQueryProcessor.java    | 4 ++--
 .../IgniteCacheLockPartitionOnAffinityRunAbstractTest.java      | 2 +-
 4 files changed, 6 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/8bf0a48c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridReservable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridReservable.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridReservable.java
index 068c68d..51f22bc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridReservable.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridReservable.java
@@ -17,8 +17,6 @@
 
 package org.apache.ignite.internal.processors.cache.distributed.dht;
 
-import org.apache.ignite.IgniteCheckedException;
-
 /**
  * Reservations support.
  */
@@ -27,9 +25,8 @@ public interface GridReservable {
      * Reserves.
      *
      * @return {@code true} If reserved successfully.
-     * @throws IgniteCheckedException If failed.
      */
-    public boolean reserve() throws IgniteCheckedException;
+    public boolean reserve();
 
     /**
      * Releases.

http://git-wip-us.apache.org/repos/asf/ignite/blob/8bf0a48c/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobProcessor.java
index 6a162d3..8db0936 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobProcessor.java
@@ -1518,7 +1518,7 @@ public class GridJobProcessor extends GridProcessorAdapter {
         }
 
         /** {@inheritDoc} */
-        @Override public boolean reserve() throws IgniteCheckedException {
+        @Override public boolean reserve() {
             boolean reserved = false;
 
             try {
@@ -1568,7 +1568,7 @@ public class GridJobProcessor extends GridProcessorAdapter {
                     }
                     finally {
                         if (checkPartMapping && !cctx.affinity().primary(partId, topVer).id().equals(ctx.localNodeId()))
-                            throw new IgniteCheckedException("Failed partition reservation. " +
+                            throw new IgniteException("Failed partition reservation. " +
                                 "Partition is not primary on the node. [partition=" + partId + ", cacheName=" + cctx.name() +
                                 ", nodeId=" + ctx.localNodeId() + ", topology=" + topVer + ']');
                     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8bf0a48c/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index d73b6ca..7ed4a2f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -808,7 +808,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
                             sqlQry,
                             F.asList(params),
                             typeDesc,
-                            idx.backupFilter(null, requestTopVer.get(), null));
+                            idx.backupFilter(requestTopVer.get(), null));
 
                         sendQueryExecutedEvent(
                             sqlQry,
@@ -894,7 +894,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
                     Object[] args = qry.getArgs();
 
                     final GridQueryFieldsResult res = idx.queryLocalSqlFields(space, sql, F.asList(args),
-                        idx.backupFilter(null, requestTopVer.get(), null), qry.isEnforceJoinOrder());
+                        idx.backupFilter(requestTopVer.get(), null), qry.isEnforceJoinOrder());
 
                     sendQueryExecutedEvent(sql, args);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8bf0a48c/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunAbstractTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunAbstractTest.java
index 11dc6c5..4c99421 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunAbstractTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunAbstractTest.java
@@ -32,7 +32,7 @@ import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 
 /**
- * Base class of for the tests to validate https://issues.apache.org/jira/browse/IGNITE-2310
+ * Base class of the tests to validate https://issues.apache.org/jira/browse/IGNITE-2310
  */
 public class IgniteCacheLockPartitionOnAffinityRunAbstractTest extends GridCacheAbstractSelfTest {
     /** Count of affinity run threads. */