ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [50/50] [abbrv] ignite git commit: Merged master to ignite-5267
Date Thu, 01 Jun 2017 13:24:05 GMT
Merged master to ignite-5267


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

Branch: refs/heads/ignite-5267
Commit: 9d75ff8cd9af1a2246b48eac28ae4f7367da91c0
Parents: 3a44e3a 9589093
Author: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Authored: Thu Jun 1 16:21:27 2017 +0300
Committer: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Committed: Thu Jun 1 16:21:27 2017 +0300

----------------------------------------------------------------------
 DEVNOTES.txt                                    |  74 +-
 assembly/dependencies-fabric-lgpl.xml           |   2 +
 assembly/dependencies-fabric.xml                |   2 +
 assembly/release-fabric-lgpl.xml                |   1 +
 assembly/release-fabric.xml                     |   1 +
 assembly/release-yardstick.xml                  |  98 +++
 doap_Ignite.rdf                                 |   2 +
 .../datagrid/CacheClientBinaryQueryExample.java |   4 +-
 .../jdbc2/JdbcAbstractDmlStatementSelfTest.java |  55 +-
 .../JdbcAbstractUpdateStatementSelfTest.java    |  11 +-
 .../ignite/internal/jdbc2/JdbcBlobTest.java     | 485 ++++++++++++
 .../jdbc2/JdbcInsertStatementSelfTest.java      |  16 +-
 .../jdbc2/JdbcMergeStatementSelfTest.java       |  16 +-
 .../internal/jdbc2/JdbcNoDefaultCacheTest.java  |   2 -
 .../jdbc2/JdbcPreparedStatementSelfTest.java    |  47 ++
 .../jdbc/suite/IgniteJdbcDriverTestSuite.java   |   7 +-
 .../src/main/java/org/apache/ignite/Ignite.java |  18 +-
 .../java/org/apache/ignite/IgniteBinary.java    |  23 +-
 .../apache/ignite/IgniteSystemProperties.java   |  12 +-
 .../org/apache/ignite/binary/BinaryObject.java  |   8 +
 .../org/apache/ignite/binary/BinaryType.java    |   5 +
 .../ignite/binary/BinaryTypeConfiguration.java  |  26 +
 .../cache/affinity/AffinityKeyMapper.java       |   3 +
 .../ignite/cache/query/SqlFieldsQuery.java      |  24 +
 .../configuration/CacheConfiguration.java       |  22 +-
 .../configuration/IgniteConfiguration.java      |  28 +
 .../MemoryPolicyConfiguration.java              |  96 ++-
 .../ignite/internal/GridKernalContext.java      |   1 +
 .../ignite/internal/GridKernalContextImpl.java  |   1 +
 .../org/apache/ignite/internal/IgniteEx.java    |  30 +
 .../apache/ignite/internal/IgniteKernal.java    |  43 +-
 .../ignite/internal/IgniteNodeAttributes.java   |   6 +
 .../binary/BinaryCachingMetadataHandler.java    |   5 +
 .../internal/binary/BinaryClassDescriptor.java  |   4 +-
 .../ignite/internal/binary/BinaryContext.java   |  60 +-
 .../internal/binary/BinaryEnumObjectImpl.java   |  41 +-
 .../internal/binary/BinaryFieldAccessor.java    |  10 +
 .../ignite/internal/binary/BinaryMetadata.java  |  93 ++-
 .../internal/binary/BinaryMetadataHandler.java  |   9 +
 .../binary/BinaryNoopMetadataHandler.java       |   5 +
 .../internal/binary/BinaryObjectExImpl.java     |   5 +
 .../internal/binary/BinaryObjectImpl.java       |  24 +-
 .../binary/BinaryObjectOffheapImpl.java         |   9 +-
 .../internal/binary/BinaryReaderExImpl.java     |  18 +
 .../ignite/internal/binary/BinaryTypeImpl.java  |  15 +
 .../ignite/internal/binary/BinaryTypeProxy.java |   6 +
 .../ignite/internal/binary/BinaryUtils.java     | 104 ++-
 .../internal/binary/BinaryWriterExImpl.java     |  18 +-
 .../internal/binary/GridBinaryMarshaller.java   |   3 +
 .../binary/builder/BinaryBuilderSerializer.java |  10 +-
 .../binary/builder/BinaryObjectBuilderImpl.java |   2 +-
 .../apache/ignite/internal/jdbc2/JdbcBlob.java  | 191 +++++
 .../ignite/internal/jdbc2/JdbcConnection.java   |  73 +-
 .../internal/jdbc2/JdbcPreparedStatement.java   |   4 +-
 .../ignite/internal/jdbc2/JdbcQueryTask.java    |  11 +-
 .../ignite/internal/jdbc2/JdbcResultSet.java    |  13 +-
 .../ignite/internal/jdbc2/JdbcStatement.java    |  12 +-
 .../jdbc2/JdbcStreamedPreparedStatement.java    |   3 +-
 .../discovery/GridDiscoveryManager.java         |  65 +-
 .../affinity/GridAffinityProcessor.java         |   2 +-
 .../cache/CacheAffinitySharedManager.java       |  53 +-
 .../internal/processors/cache/CacheData.java    |  13 +
 .../cache/CacheJoinNodeDiscoveryData.java       |  15 +-
 .../internal/processors/cache/CacheObject.java  |   8 +-
 .../processors/cache/CacheObjectAdapter.java    |   4 +-
 .../cache/CacheObjectByteArrayImpl.java         |   8 +-
 .../processors/cache/CacheObjectContext.java    | 197 +----
 .../processors/cache/CacheObjectImpl.java       |  31 +-
 .../processors/cache/CacheObjectUtils.java      | 173 +++++
 .../cache/CacheObjectValueContext.java          |  50 ++
 .../processors/cache/ClusterCachesInfo.java     |  66 +-
 .../cache/DynamicCacheChangeRequest.java        |  21 +-
 .../cache/DynamicCacheDescriptor.java           |  13 +
 .../processors/cache/ExchangeActions.java       |   2 +-
 .../processors/cache/GridCacheAdapter.java      |   3 +-
 .../processors/cache/GridCacheAttributes.java   |  14 +-
 .../processors/cache/GridCacheContext.java      |  12 +-
 .../processors/cache/GridCacheEventManager.java |   2 +-
 .../processors/cache/GridCacheIoManager.java    |   6 +-
 .../processors/cache/GridCacheMapEntry.java     |   9 +-
 .../GridCachePartitionExchangeManager.java      |   2 +-
 .../processors/cache/GridCacheProcessor.java    | 152 +++-
 .../processors/cache/IgniteCacheProxy.java      |   2 +-
 .../processors/cache/KeyCacheObjectImpl.java    |  10 +-
 .../cache/binary/CacheObjectBinaryContext.java  |   6 +-
 .../binary/CacheObjectBinaryProcessor.java      |  21 +-
 .../binary/CacheObjectBinaryProcessorImpl.java  | 100 ++-
 .../cache/binary/IgniteBinaryImpl.java          |  26 +
 .../cache/database/CacheDataRowAdapter.java     |   8 +-
 .../IgniteCacheDatabaseSharedManager.java       |  46 ++
 .../cache/database/MemoryMetricsImpl.java       |  47 +-
 .../cache/database/MemoryMetricsMXBeanImpl.java |  10 +-
 .../CacheDataStructuresManager.java             |   4 +-
 .../dht/GridClientPartitionTopology.java        |  31 +-
 .../dht/GridDhtPartitionTopology.java           |   9 +-
 .../dht/GridDhtPartitionTopologyImpl.java       |  59 +-
 .../dht/preloader/GridDhtPartitionDemander.java | 103 +--
 .../GridDhtPartitionsExchangeFuture.java        |  48 +-
 .../cache/distributed/near/GridNearTxLocal.java |   3 +-
 .../cache/query/GridCacheQueryRequest.java      |  14 +-
 .../CacheContinuousQueryAcknowledgeBuffer.java  | 120 +++
 .../CacheContinuousQueryDeployableObject.java   | 110 +++
 .../continuous/CacheContinuousQueryEntry.java   | 117 ++-
 .../CacheContinuousQueryEventBuffer.java        | 483 ++++++++++++
 .../continuous/CacheContinuousQueryHandler.java | 733 +++----------------
 .../CacheContinuousQueryHandlerV2.java          |   6 +-
 .../continuous/CacheContinuousQueryManager.java |  16 +-
 .../CacheContinuousQueryPartitionRecovery.java  | 267 +++++++
 .../cache/transactions/TxDeadlock.java          |   7 +-
 .../cacheobject/IgniteCacheObjectProcessor.java |   6 +-
 .../IgniteCacheObjectProcessorImpl.java         |  39 +-
 .../processors/cacheobject/NoOpBinary.java      |  12 +
 .../closure/GridClosureProcessor.java           |  11 +-
 .../continuous/GridContinuousBatchAdapter.java  |   2 +-
 .../continuous/GridContinuousProcessor.java     |  19 +-
 .../continuous/GridContinuousQueryBatch.java    |  16 +-
 .../datastructures/DataStructuresProcessor.java |   1 +
 .../datastructures/GridCacheLockImpl.java       |  10 +-
 .../platform/PlatformContextImpl.java           |  29 +-
 .../binary/PlatformBinaryProcessor.java         |  25 +
 .../platform/cluster/PlatformClusterGroup.java  |  45 +-
 .../utils/PlatformConfigurationUtils.java       |  42 +-
 .../query/CacheQueryObjectValueContext.java     |  64 ++
 .../query/GridQueryCacheObjectsIterator.java    |  16 +-
 .../processors/query/GridQueryIndexing.java     |  94 +--
 .../processors/query/GridQueryProcessor.java    | 292 +++++---
 .../query/GridQueryTypeDescriptor.java          |  15 +
 .../processors/query/GridRunningQueryInfo.java  |  16 +-
 .../processors/query/QueryIndexKey.java         |  28 +-
 .../internal/processors/query/QuerySchema.java  |   2 +-
 .../query/QueryTypeDescriptorImpl.java          |   9 +
 .../internal/processors/query/QueryUtils.java   | 283 +++++--
 .../query/property/QueryBinaryProperty.java     |   2 +-
 .../handlers/cache/GridCacheCommandHandler.java |  10 +-
 .../top/GridTopologyCommandHandler.java         |   4 +-
 .../processors/security/SecurityUtils.java      |  92 +++
 .../service/GridServiceProcessor.java           |   4 +-
 .../processors/service/GridServiceProxy.java    |   4 +-
 .../processors/task/GridTaskProcessor.java      |   7 +-
 .../task/GridTaskThreadContextKey.java          |   5 +-
 .../query/VisorRunningQueriesCollectorTask.java |   2 +-
 .../ignite/mxbean/MemoryMetricsMXBean.java      |   8 +-
 .../security/SecurityBasicPermissionSet.java    |  41 +-
 .../communication/tcp/TcpCommunicationSpi.java  |   4 +-
 .../ignite/spi/discovery/DiscoverySpi.java      |   9 +-
 .../ignite/spi/discovery/tcp/ClientImpl.java    |  14 +-
 .../ignite/spi/discovery/tcp/ServerImpl.java    |  99 ++-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |   8 +-
 .../internal/GridAffinityNoCacheSelfTest.java   |  10 +-
 .../IgniteComputeTopologyExceptionTest.java     |   2 +-
 .../internal/binary/BinaryEnumsSelfTest.java    | 146 +++-
 .../binary/TestCachingMetadataHandler.java      |   5 +
 ...dManagerMxBeanIllegalArgumentHandleTest.java | 125 ++++
 .../GridDiscoveryManagerAttributesSelfTest.java |  70 +-
 ...IgniteClientCacheInitializationFailTest.java | 366 +++++++++
 .../cache/IgniteDynamicCacheStartSelfTest.java  |   4 +-
 .../IgniteIncompleteCacheObjectSelfTest.java    |  10 +-
 ...iteMarshallerCacheClassNameConflictTest.java |   9 +-
 .../cache/MemoryPolicyConfigValidationTest.java |  62 +-
 .../BinaryAtomicCacheLocalEntriesSelfTest.java  |  30 +
 .../BinaryTxCacheLocalEntriesSelfTest.java      |  84 +++
 .../BinaryAtomicCacheLocalEntriesSelfTest.java  |  30 -
 .../BinaryTxCacheLocalEntriesSelfTest.java      |  84 ---
 ...tinuousQueryAsyncFailoverAtomicSelfTest.java |   1 -
 ...nuousQueryConcurrentPartitionUpdateTest.java | 304 ++++++++
 .../CacheContinuousQueryEventBufferTest.java    | 217 ++++++
 ...ContinuousQueryFailoverAbstractSelfTest.java |  79 +-
 ...niteCacheContinuousQueryBackupQueueTest.java |  13 +-
 ...eCacheContinuousQueryImmutableEntryTest.java |   6 +-
 .../database/FreeListImplSelfTest.java          |  10 +-
 .../database/MemoryMetricsSelfTest.java         |  10 +-
 .../processors/igfs/IgfsIgniteMock.java         |  24 +
 .../platform/PlatformComputeEchoTask.java       |  13 +
 .../discovery/AuthenticationRestartTest.java    |  88 +++
 .../spi/discovery/tcp/TcpDiscoverySelfTest.java |   4 +-
 .../discovery/tcp/TestReconnectProcessor.java   |  47 +-
 .../ignite/testframework/GridTestUtils.java     |   6 +-
 .../config/GridTestProperties.java              |   3 +-
 .../ignite/testframework/junits/IgniteMock.java |   5 +
 .../junits/multijvm/IgniteProcessProxy.java     |  18 +
 .../ignite/testsuites/IgniteBasicTestSuite.java |  13 +-
 .../testsuites/IgniteBinaryBasicTestSuite.java  | 104 ---
 .../IgniteBinaryObjectsCacheTestSuite3.java     |  13 +
 .../IgniteBinaryObjectsTestSuite.java           |   4 +-
 ...iteBinarySimpleNameMapperBasicTestSuite.java |   3 +-
 .../testsuites/IgniteCacheTestSuite4.java       |   2 +
 .../IgniteSpiDiscoverySelfTestSuite.java        |   2 +
 .../query/h2/H2IndexingAbstractGeoSelfTest.java |  26 +-
 .../query/h2/H2IndexingBinaryGeoSelfTest.java   |  30 -
 .../H2IndexingBinarySegmentedGeoSelfTest.java   |  30 -
 .../query/h2/H2IndexingGeoSelfTest.java         |   2 +-
 .../h2/H2IndexingSegmentedGeoSelfTest.java      |   2 +-
 .../testsuites/GeoSpatialIndexingTestSuite.java |   5 -
 .../collections/HadoopSkipListSelfTest.java     |  37 -
 .../query/h2/DmlStatementsProcessor.java        |  75 +-
 .../processors/query/h2/H2DmlPlanKey.java       |  66 ++
 .../query/h2/H2ResultSetIterator.java           |   4 +-
 .../processors/query/h2/H2RowDescriptor.java    |  62 +-
 .../internal/processors/query/h2/H2Schema.java  |  99 ++-
 .../processors/query/h2/H2TableDescriptor.java  |  61 +-
 .../processors/query/h2/H2TableEngine.java      |   2 +-
 .../query/h2/H2TwoStepCachedQuery.java          |  18 +-
 .../query/h2/H2TwoStepCachedQueryKey.java       |  19 +-
 .../internal/processors/query/h2/H2Utils.java   |  81 +-
 .../processors/query/h2/IgniteH2Indexing.java   | 555 ++++++--------
 .../query/h2/ddl/DdlStatementsProcessor.java    | 139 +++-
 .../query/h2/opt/GridH2RowDescriptor.java       |   5 -
 .../processors/query/h2/opt/GridH2Table.java    |  31 +-
 .../query/h2/opt/GridH2ValueCacheObject.java    |  32 +-
 .../query/h2/opt/GridLuceneIndex.java           |   2 +-
 .../query/h2/sql/GridSqlCreateTable.java        | 153 ++++
 .../query/h2/sql/GridSqlDropTable.java          |  79 ++
 .../query/h2/sql/GridSqlQueryParser.java        | 260 +++++++
 .../query/h2/sql/GridSqlQuerySplitter.java      |  22 +-
 .../query/h2/twostep/GridMapQueryExecutor.java  |  20 +-
 .../h2/twostep/GridReduceQueryExecutor.java     | 167 ++---
 .../query/h2/twostep/ReduceQueryRun.java        | 157 ++++
 .../query/h2/twostep/msg/GridH2CacheObject.java |  39 +-
 ...niteCacheAbstractInsertSqlQuerySelfTest.java |  42 +-
 .../IgniteCacheInsertSqlQuerySelfTest.java      |  47 +-
 ...ClientReconnectCacheQueriesFailoverTest.java |   2 +-
 .../cache/index/AbstractSchemaSelfTest.java     | 150 +++-
 .../DynamicIndexAbstractBasicSelfTest.java      | 159 ++--
 .../DynamicIndexAbstractConcurrentSelfTest.java |  86 ++-
 .../index/DynamicIndexAbstractSelfTest.java     |  37 +-
 .../index/H2DynamicIndexAbstractSelfTest.java   |  52 +-
 .../cache/index/H2DynamicTableSelfTest.java     | 393 ++++++++++
 .../cache/index/SchemaExchangeSelfTest.java     |  27 +-
 .../query/IgniteSqlSchemaIndexingTest.java      |  20 +-
 .../query/IgniteSqlSplitterSelfTest.java        | 315 ++++++--
 .../h2/GridIndexingSpiAbstractSelfTest.java     | 141 ++--
 .../query/h2/sql/BaseH2CompareQueryTest.java    |  12 +-
 .../query/h2/sql/GridQueryParsingTest.java      | 288 +++++++-
 .../query/h2/sql/H2CompareBigQueryTest.java     |   2 +-
 .../IgniteCacheQuerySelfTestSuite.java          |   2 +
 .../IgniteCacheQuerySelfTestSuite3.java         |   5 +
 .../IgniteH2IndexingSpiTestSuite.java           |  37 -
 .../processors/query/h2/sql/bigQuery.sql        |   8 +-
 modules/ml/pom.xml                              |  13 +
 .../main/java/org/apache/ignite/ml/Model.java   |  39 +
 .../ml/clustering/BaseKMeansClusterer.java      |  98 +++
 .../apache/ignite/ml/clustering/Clusterer.java  |  32 +
 .../ml/clustering/ClusterizationModel.java      |  29 +
 .../clustering/KMeansDistributedClusterer.java  | 298 ++++++++
 .../ml/clustering/KMeansLocalClusterer.java     | 174 +++++
 .../ignite/ml/clustering/KMeansModel.java       |  79 ++
 .../ignite/ml/clustering/WeightedClusterer.java |  38 +
 .../ignite/ml/clustering/package-info.java      |  22 +
 .../apache/ignite/ml/math/DistanceMeasure.java  |  39 +
 .../ignite/ml/math/EuclideanDistance.java       |  48 ++
 .../org/apache/ignite/ml/math/MathUtils.java    |  31 +
 .../java/org/apache/ignite/ml/math/Matrix.java  |   2 +
 .../apache/ignite/ml/math/StorageConstants.java |   3 +
 .../org/apache/ignite/ml/math/VectorUtils.java  |  41 ++
 .../math/exceptions/ConvergenceException.java   |  48 ++
 .../exceptions/MathArithmeticException.java     |   6 +-
 .../exceptions/MathIllegalNumberException.java  |  51 ++
 .../exceptions/MathIllegalStateException.java   |  49 ++
 .../exceptions/NumberIsTooSmallException.java   |  79 ++
 .../ignite/ml/math/functions/Functions.java     |  39 +
 .../apache/ignite/ml/math/impls/CacheUtils.java |  47 ++
 .../ml/math/impls/matrix/AbstractMatrix.java    |   2 +
 .../impls/matrix/SparseDistributedMatrix.java   |   2 +-
 .../impls/storage/matrix/MapWrapperStorage.java |  93 +++
 .../vector/SparseLocalOnHeapVectorStorage.java  |  32 +
 .../ml/math/impls/vector/DelegatingVector.java  |   5 +
 .../ml/math/impls/vector/MapWrapperVector.java  |  32 +
 .../ml/math/impls/vector/SparseLocalVector.java |   9 +
 .../ignite/ml/math/impls/vector/VectorView.java |   1 +
 .../ignite/ml/math/statistics/Variance.java     |  53 ++
 .../org/apache/ignite/ml/math/util/MapUtil.java |  38 +
 .../apache/ignite/ml/math/util/MatrixUtil.java  |  38 +-
 .../org/apache/ignite/ml/IgniteMLTestSuite.java |   4 +-
 .../ml/clustering/ClusteringTesetSuite.java     |  15 +
 .../KMeansDistributedClustererTest.java         | 184 +++++
 .../ml/clustering/KMeansLocalClustererTest.java |  46 ++
 .../apache/ignite/ml/clustering/KMeansUtil.java |  33 +
 .../ignite/ml/math/MathImplLocalTestSuite.java  |   1 +
 modules/platforms/cpp/binary/Makefile.am        |  67 +-
 .../platforms/cpp/binary/include/Makefile.am    |  55 +-
 .../binary/include/ignite/binary/binary_type.h  |   2 +-
 .../ignite/impl/binary/binary_type_impl.h       |  61 ++
 .../ignite/impl/binary/binary_writer_impl.h     |   4 +-
 .../cpp/binary/project/vs/binary.vcxproj        |   2 +
 .../binary/project/vs/binary.vcxproj.filters    |   6 +
 .../binary/src/impl/binary/binary_type_impl.cpp |  61 ++
 modules/platforms/cpp/common/Makefile.am        |  54 +-
 .../platforms/cpp/common/include/Makefile.am    |   1 +
 .../common/include/ignite/common/cancelable.h   |  65 ++
 .../cpp/common/include/ignite/common/promise.h  |  18 +
 .../common/include/ignite/common/shared_state.h |  51 ++
 .../cpp/common/include/ignite/future.h          |  60 +-
 .../cpp/common/include/ignite/ignite_error.h    |   3 +
 .../cpp/common/project/vs/common.vcxproj        |   1 +
 .../common/project/vs/common.vcxproj.filters    |   3 +
 modules/platforms/cpp/core-test/Makefile.am     | 101 +--
 .../cpp/core-test/include/ignite/test_utils.h   |  24 +-
 .../cpp/core-test/project/vs/core-test.vcxproj  |   1 +
 .../project/vs/core-test.vcxproj.filters        |  10 +-
 .../cpp/core-test/src/cache_invoke_test.cpp     |   2 +-
 .../cpp/core-test/src/cluster_test.cpp          |   2 +-
 .../cpp/core-test/src/compute_test.cpp          | 337 +++++++++
 .../cpp/core-test/src/continuous_query_test.cpp |   2 +-
 .../platforms/cpp/core-test/src/test_utils.cpp  |   9 +
 modules/platforms/cpp/core/Makefile.am          |  82 ++-
 modules/platforms/cpp/core/include/Makefile.am  | 107 +--
 .../cpp/core/include/ignite/cache/cache.h       |   4 +-
 .../cpp/core/include/ignite/cache/query/query.h |   1 -
 .../cpp/core/include/ignite/compute/compute.h   | 136 ++++
 .../core/include/ignite/compute/compute_func.h  |  65 ++
 .../platforms/cpp/core/include/ignite/ignite.h  |  19 +-
 .../cpp/core/include/ignite/ignite_binding.h    |  25 +
 .../include/ignite/ignite_binding_context.h     |   2 +-
 .../cpp/core/include/ignite/impl/bindings.h     |  24 +
 .../ignite/impl/cluster/cluster_group_impl.h    |  31 +-
 .../ignite/impl/compute/cancelable_impl.h       |  70 ++
 .../include/ignite/impl/compute/compute_impl.h  | 118 +++
 .../ignite/impl/compute/compute_job_holder.h    | 139 ++++
 .../ignite/impl/compute/compute_job_result.h    | 161 ++++
 .../ignite/impl/compute/compute_task_holder.h   | 213 ++++++
 .../include/ignite/impl/ignite_binding_impl.h   |   2 +
 .../include/ignite/impl/ignite_environment.h    |  69 ++
 .../cpp/core/include/ignite/impl/ignite_impl.h  |  23 +-
 .../ignite/impl/interop/interop_target.h        |  11 +-
 .../platforms/cpp/core/project/vs/core.vcxproj  |   9 +
 .../cpp/core/project/vs/core.vcxproj.filters    |  33 +
 modules/platforms/cpp/core/src/ignite.cpp       |   5 +
 .../src/impl/cluster/cluster_group_impl.cpp     |  23 +-
 .../core/src/impl/compute/cancelable_impl.cpp   |  59 ++
 .../cpp/core/src/impl/compute/compute_impl.cpp  |  35 +
 .../cpp/core/src/impl/ignite_environment.cpp    | 260 ++++++-
 .../platforms/cpp/core/src/impl/ignite_impl.cpp |  15 +-
 .../core/src/impl/interop/interop_target.cpp    |  20 +
 .../src/impl/transactions/transactions_impl.cpp |  10 -
 modules/platforms/cpp/examples/Makefile.am      |   3 +-
 .../cpp/examples/compute-example/Makefile.am    |  59 ++
 .../compute-example/config/compute-example.xml  |  52 ++
 .../project/vs/compute-example.vcxproj          | 102 +++
 .../project/vs/compute-example.vcxproj.filters  |  27 +
 .../compute-example/src/compute_example.cpp     | 177 +++++
 modules/platforms/cpp/examples/configure.ac     |   3 +-
 .../project/vs/continuous-query-example.vcxproj |   4 -
 .../src/continuous_query_example.cpp            | 130 +++-
 .../examples/include/ignite/examples/address.h  |   2 +-
 .../include/ignite/examples/organization.h      |   4 +-
 .../cpp/examples/odbc-example/Makefile.am       |  12 +-
 .../cpp/examples/project/vs/ignite-examples.sln |  18 +-
 .../cpp/examples/put-get-example/Makefile.am    |  58 ++
 .../put-get-example/config/example-cache.xml    |  67 ++
 .../project/vs/put-get-example.vcxproj          | 110 +++
 .../project/vs/put-get-example.vcxproj.filters  |  38 +
 .../put-get-example/src/put_get_example.cpp     | 126 ++++
 .../cpp/examples/putget-example/Makefile.am     |  58 --
 .../putget-example/config/example-cache.xml     |  67 --
 .../project/vs/putget-example.vcxproj           | 110 ---
 .../project/vs/putget-example.vcxproj.filters   |  38 -
 .../putget-example/src/putget_example.cpp       | 126 ----
 .../cpp/examples/query-example/Makefile.am      |  12 +-
 .../platforms/cpp/jni/include/ignite/jni/java.h |   1 +
 modules/platforms/cpp/jni/src/java.cpp          |  10 +
 .../StartupTest.cs                              |  78 ++
 .../Apache.Ignite.Core.Tests.NuGet/TestUtil.cs  |  30 +
 .../Apache.Ignite.Core.Tests.csproj             |  10 +
 .../Binary/BinaryBuilderSelfTest.cs             |  88 ++-
 .../Binary/TypeNameParserTest.cs                |   8 +-
 .../Cache/CacheConfigurationTest.cs             |   6 +-
 .../Cache/MemoryMetricsTest.cs                  |  20 +
 .../Cache/Query/CacheLinqTest.cs                | 199 ++++-
 .../Cache/Query/CacheLinqTestSqlEscapeAll.cs    |  34 +
 .../Compute/BinarizableClosureTaskTest.cs       |   7 +-
 .../Compute/ClosureTaskTest.cs                  |   6 +-
 .../Compute/ComputeApiTest.cs                   |  45 +-
 .../Compute/IgniteExceptionTaskSelfTest.cs      |   8 +-
 .../Compute/SerializableClosureTaskTest.cs      |   5 +-
 .../Deployment/GetAddressFunc.cs                |  35 +
 .../PeerAssemblyLoadingAllApisTest.cs           | 167 +++++
 .../Deployment/PeerAssemblyLoadingTest.cs       | 192 +++++
 .../PeerAssemblyLoadingVersioningTest.cs        | 164 +++++
 .../Deployment/ProcessNameFunc.cs               |  50 ++
 .../Deployment/ProcessNameTask.cs               |  74 ++
 .../Deployment/peer_assembly_app.config         |  35 +
 .../IgniteConfigurationSerializerTest.cs        |  18 +-
 .../IgniteConfigurationTest.cs                  |   6 +-
 .../Log/CustomLoggerTest.cs                     |   5 +-
 .../Process/IgniteProcess.cs                    |  12 +-
 .../Apache.Ignite.Core.csproj                   |  10 +
 .../Apache.Ignite.Core.nuspec                   |  12 +-
 .../Binary/BinaryTypeConfiguration.cs           |   3 +-
 .../dotnet/Apache.Ignite.Core/Binary/IBinary.cs |  24 +
 .../Apache.Ignite.Core/Binary/IBinaryObject.cs  |   8 +
 .../Apache.Ignite.Core/Binary/IBinaryType.cs    |   6 +
 .../Configuration/MemoryPolicyConfiguration.cs  |  45 +-
 .../Cache/Configuration/QueryEntity.cs          |  64 +-
 .../Deployment/PeerAssemblyLoadingMode.cs       |  55 ++
 .../dotnet/Apache.Ignite.Core/IIgnite.cs        |   9 +
 .../Apache.Ignite.Core/IgniteConfiguration.cs   |  16 +
 .../IgniteConfigurationSection.xsd              |  22 +
 .../dotnet/Apache.Ignite.Core/Ignition.cs       |  18 +-
 .../Impl/Binary/BinarizableSerializer.cs        |   5 +-
 .../Apache.Ignite.Core/Impl/Binary/Binary.cs    |  68 +-
 .../Impl/Binary/BinaryEnum.cs                   |  11 +-
 .../Binary/BinaryEqualityComparerSerializer.cs  |   1 -
 .../Impl/Binary/BinaryObject.cs                 |  13 +-
 .../Impl/Binary/BinaryProcessor.cs              |  67 +-
 .../Impl/Binary/BinaryReader.cs                 |  76 +-
 .../Impl/Binary/BinaryReflectiveActions.cs      |   7 +-
 .../BinaryReflectiveSerializerInternal.cs       |   5 +-
 .../Impl/Binary/BinarySystemHandlers.cs         |  25 +-
 .../Impl/Binary/BinarySystemTypeSerializer.cs   |   2 +-
 .../Impl/Binary/BinaryUtils.cs                  |  19 +
 .../Impl/Binary/BinaryWriter.cs                 |  28 +-
 .../Impl/Binary/BinaryWriterExtensions.cs       |   9 +-
 .../Impl/Binary/IBinarySerializerInternal.cs    |  10 +-
 .../Impl/Binary/Marshaller.cs                   | 117 +--
 .../Impl/Binary/Metadata/BinaryType.cs          | 179 ++++-
 .../Impl/Binary/Metadata/BinaryTypeHolder.cs    |  44 +-
 .../Impl/Binary/SerializableSerializer.cs       |  14 +-
 .../Impl/Binary/TypeResolver.cs                 |   6 +-
 .../Impl/Binary/UserSerializerProxy.cs          |   5 +-
 .../Impl/Cache/IQueryEntityInternal.cs          |  31 +
 .../Impl/Cluster/ClusterGroupImpl.cs            |  12 +
 .../Common/CopyOnWriteConcurrentDictionary.cs   |   8 -
 .../Apache.Ignite.Core/Impl/Common/Future.cs    |  13 +-
 .../Impl/Common/IgniteHome.cs                   |   3 +-
 .../Impl/Common/LoadedAssembliesResolver.cs     |   8 +-
 .../Impl/Compute/Closure/ComputeActionJob.cs    |   7 +-
 .../Impl/Compute/Closure/ComputeFuncJob.cs      |   5 +-
 .../Impl/Compute/ComputeFunc.cs                 |   5 +-
 .../Impl/Compute/ComputeImpl.cs                 |   1 -
 .../Impl/Compute/ComputeJob.cs                  |   3 +-
 .../Impl/Compute/ComputeOutFunc.cs              |   3 +-
 .../Impl/Deployment/AssemblyLoader.cs           | 105 +++
 .../Impl/Deployment/AssemblyRequest.cs          |  68 ++
 .../Impl/Deployment/AssemblyRequestResult.cs    |  80 ++
 .../Impl/Deployment/GetAssemblyFunc.cs          |  77 ++
 .../Impl/Deployment/PeerAssemblyResolver.cs     | 189 +++++
 .../Impl/Deployment/PeerLoadingExtensions.cs    |  65 ++
 .../Impl/Deployment/PeerLoadingObjectHolder.cs  |  90 +++
 .../PeerLoadingObjectHolderSerializer.cs        |  49 ++
 .../dotnet/Apache.Ignite.Core/Impl/Ignite.cs    |   8 +
 modules/platforms/dotnet/Apache.Ignite.FxCop    |   3 +-
 .../Apache.Ignite.Linq.csproj                   |   3 +
 .../Apache.Ignite.Linq/CacheExtensions.cs       |  65 ++
 .../Impl/CacheFieldsQueryExecutor.cs            |  39 -
 .../Impl/CacheFieldsQueryProvider.cs            |   9 +
 .../Impl/CacheQueryExpressionVisitor.cs         |  76 +-
 .../Impl/CacheQueryModelVisitor.cs              |  73 +-
 .../Apache.Ignite.Linq/Impl/CacheQueryParser.cs |  21 +-
 .../Impl/CacheQueryableBase.cs                  |  14 +-
 .../Impl/Dml/RemoveAllExpressionNode.cs         |  88 +++
 .../Impl/Dml/RemoveAllResultOperator.cs         |  61 ++
 .../Apache.Ignite.Linq/Impl/ExpressionWalker.cs |   7 +-
 .../Impl/ICacheQueryableInternal.cs             |   6 -
 .../Apache.Ignite.Linq/Impl/MethodVisitor.cs    |   7 +-
 .../dotnet/Apache.Ignite.Linq/Impl/QueryData.cs |  17 +-
 .../dotnet/Apache.Ignite.sln.DotSettings        |   1 +
 .../dotnet/Apache.Ignite/Apache.Ignite.csproj   |   1 -
 .../platforms/dotnet/Apache.Ignite/App.config   |  11 +
 .../dotnet/Apache.Ignite/Config/Configurator.cs |   9 +-
 .../Apache.Ignite/Service/ServiceDescription.cs |  32 -
 modules/platforms/dotnet/build.ps1              |   5 +-
 modules/spring/pom.xml                          |   7 +
 .../org/apache/ignite/IgniteSpringBean.java     |   7 +
 .../apache/ignite/cache/spring/SpringCache.java |  60 +-
 .../ignite/cache/spring/SpringCacheManager.java |  51 +-
 .../GridSpringCacheManagerMultiJvmSelfTest.java | 134 ++++
 .../GridSpringDynamicCacheTestService.java      |  13 +
 .../ignite/cache/spring/SpringCacheTest.java    |   2 +-
 .../ignite/cache/spring/spring-caching1.xml     |  56 ++
 .../ignite/cache/spring/spring-caching2.xml     |  56 ++
 modules/web-console/frontend/.babelrc           |   9 +-
 modules/web-console/frontend/.gitignore         |   1 -
 modules/web-console/frontend/app/app.js         |  18 +-
 .../components/web-console-header/component.js  |   6 +-
 .../frontend/gulpfile.babel.js/index.js         |  26 -
 .../frontend/gulpfile.babel.js/paths.js         |  64 --
 .../frontend/gulpfile.babel.js/tasks/build.js   |  21 -
 .../frontend/gulpfile.babel.js/tasks/bundle.js  |  36 -
 .../frontend/gulpfile.babel.js/tasks/clean.js   |  32 -
 .../frontend/gulpfile.babel.js/tasks/copy.js    |  33 -
 .../gulpfile.babel.js/tasks/ignite-modules.js   |  55 --
 .../frontend/gulpfile.babel.js/tasks/watch.js   |  30 -
 .../gulpfile.babel.js/webpack/common.js         | 205 ------
 .../webpack/environments/development.js         |  60 --
 .../webpack/environments/production.js          |  41 --
 .../webpack/environments/test.js                |  44 --
 .../frontend/gulpfile.babel.js/webpack/index.js |  36 -
 .../frontend/ignite_modules/index.js            |   7 +-
 modules/web-console/frontend/package.json       | 104 ++-
 .../frontend/test/karma.conf.babel.js           |  13 +-
 modules/web-console/frontend/test/karma.conf.js |   2 +-
 .../frontend/webpack/webpack.common.js          | 193 +++++
 .../frontend/webpack/webpack.dev.babel.js       | 100 +++
 .../frontend/webpack/webpack.prod.babel.js      |  64 ++
 .../frontend/webpack/webpack.test.js            |  33 +
 modules/web-console/web-agent/pom.xml           |   8 +
 .../yardstick/IgniteBenchmarkArguments.java     |  11 +
 .../org/apache/ignite/yardstick/IgniteNode.java |   5 +
 .../apache/ignite/yardstick/io/FileUtils.java   |  64 ++
 parent/pom.xml                                  |   8 +-
 pom.xml                                         | 254 ++-----
 501 files changed, 19005 insertions(+), 5491 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/9d75ff8c/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractDmlStatementSelfTest.java
----------------------------------------------------------------------
diff --cc modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractDmlStatementSelfTest.java
index 6ef86d3,82f9cd2..6b1112b
--- a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractDmlStatementSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractDmlStatementSelfTest.java
@@@ -129,7 -137,7 +137,7 @@@ public abstract class JdbcAbstractDmlSt
  
      /** {@inheritDoc} */
      @Override protected void afterTest() throws Exception {
-         grid(0).destroyCache(DEFAULT_CACHE_NAME);
 -        ((IgniteEx)ignite(0)).context().cache().dynamicDestroyCache(DEFAULT_CACHE_NAME, true, true);
++        ((IgniteEx)ignite(0)).context().cache().dynamicDestroyCache(DEFAULT_CACHE_NAME, true, true, false);
  
          conn.close();
          assertTrue(conn.isClosed());

http://git-wip-us.apache.org/repos/asf/ignite/blob/9d75ff8c/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
index d6015d7,ea4b690..8606175
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@@ -627,14 -603,17 +627,24 @@@ public final class IgniteSystemProperti
          }
      };
  
+      /**
+      * When set to {@code true}, Ignite switches to compatibility mode with versions that don't
+      * support service security permissions. In this case security permissions will be ignored
+      * (if they set).
+      * <p>
+      *     Default is {@code false}, which means that service security permissions will be respected.
+      * </p>
+      */
+     public static final String IGNITE_SECURITY_COMPATIBILITY_MODE = "IGNITE_SECURITY_COMPATIBILITY_MODE";
+ 
      /**
 +     * Ignite cluster name.
 +     * <p>
 +     * Defaults to utility cache deployment ID..
 +     */
 +    public static final String IGNITE_CLUSTER_NAME = "IGNITE_CLUSTER_NAME";
 +
 +    /**
       * Enforces singleton.
       */
      private IgniteSystemProperties() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/9d75ff8c/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/9d75ff8c/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 377100d,6d05147..b04a969
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@@ -3045,7 -3064,7 +3064,7 @@@ public class IgniteKernal implements Ig
          try {
              checkClusterState();
  
-             return ctx.cache().dynamicDestroyCache(cacheName, checkThreadTx, false);
 -            return ctx.cache().dynamicDestroyCache(cacheName, sql, checkThreadTx);
++            return ctx.cache().dynamicDestroyCache(cacheName, sql, checkThreadTx, false);
          }
          finally {
              unguard();

http://git-wip-us.apache.org/repos/asf/ignite/blob/9d75ff8c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/9d75ff8c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/9d75ff8c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeActions.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/9d75ff8c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/9d75ff8c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/9d75ff8c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/9d75ff8c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/9d75ff8c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index bed0601,c7e8670..bf4691b
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@@ -1168,9 -1179,8 +1181,10 @@@ public class GridCacheProcessor extend
  
          if (log.isInfoEnabled())
              log.info("Started cache [name=" + U.maskName(cfg.getName()) +
 -                ", memoryPolicyName=" + cfg.getMemoryPolicyName() + ", mode=" + cfg.getCacheMode() +
 -                ", atomicity=" + cfg.getAtomicityMode() + ']');
 +                ", memoryPolicyName=" + cfg.getMemoryPolicyName() +
-                 ", mode=" + cfg.getCacheMode() + ']'
++                ", mode=" + cfg.getCacheMode() +
++                ", atomicity=" + cfg.getAtomicityMode() + ']'
 +            );
      }
  
      /**
@@@ -1911,10 -1889,9 +1923,10 @@@
  
      /**
       * @param req Stop request.
 +     * @return Stopped cache context.
       */
-     private GridCacheContext<?, ?> prepareCacheStop(DynamicCacheChangeRequest req) {
-         assert req.stop() || req.close() : req;
 -    private void prepareCacheStop(DynamicCacheChangeRequest req, boolean forceClose) {
++    private GridCacheContext<?, ?> prepareCacheStop(DynamicCacheChangeRequest req, boolean forceClose) {
+         assert req.stop() || req.close() || forceClose : req;
  
          GridCacheAdapter<?, ?> cache = caches.remove(req.cacheName());
  
@@@ -1957,31 -1952,11 +1991,30 @@@
              }
          }
  
-         if (exchActions != null && err == null) {
+         if (exchActions != null && (err == null || forceClose)) {
 +            Collection<IgniteBiTuple<GridCacheContext, Boolean>> stopped = null;
 +
 +            GridCacheContext<?, ?> stopCtx = null;
 +            boolean destroy = false;
- 
              for (ExchangeActions.ActionData action : exchActions.cacheStopRequests()) {
                  stopGateway(action.request());
  
 -                prepareCacheStop(action.request(), forceClose);
 +                sharedCtx.database().checkpointReadLock();
 +
 +                try {
-                     stopCtx = prepareCacheStop(action.request());
++                    stopCtx = prepareCacheStop(action.request(), forceClose);
 +                    destroy = action.request().destroy();
 +                }
 +                finally {
 +                    sharedCtx.database().checkpointReadUnlock();
 +                }
 +
 +                if (stopCtx != null) {
 +                    if (stopped == null)
 +                        stopped = new ArrayList<>();
 +
 +                    stopped.add(F.<GridCacheContext, Boolean>t(stopCtx, destroy));
 +                }
              }
  
              for (DynamicCacheChangeRequest req : exchActions.closeRequests(ctx.localNodeId())) {
@@@ -2003,28 -1977,13 +2036,32 @@@
  
                          proxy.context().gate().onStopped();
  
 -                        prepareCacheStop(req, forceClose);
 +                        sharedCtx.database().checkpointReadLock();
 +
 +                        try {
-                             stopCtx = prepareCacheStop(req);
++                            stopCtx = prepareCacheStop(req, forceClose);
 +                            destroy = req.destroy();
 +                        }
 +                        finally {
 +                            sharedCtx.database().checkpointReadUnlock();
 +                        }
                      }
                  }
  
 +                if (stopCtx != null) {
 +                    if (stopped == null)
 +                        stopped = new ArrayList<>();
 +
 +                    stopped.add(F.<GridCacheContext, Boolean>t(stopCtx, destroy));
 +                }
++
+                 if (forceClose)
+                     completeCacheStartFuture(req, false, err);
++
              }
 +
 +            if (stopped != null && !sharedCtx.kernalContext().clientNode())
 +                sharedCtx.database().onCachesStopped(stopped);
          }
      }
  
@@@ -2412,18 -2396,14 +2494,18 @@@
       * @param checkThreadTx If {@code true} checks that current thread does not have active transactions.
       * @return Future that will be completed when cache is destroyed.
       */
-     public IgniteInternalFuture<?> dynamicDestroyCache(String cacheName, boolean checkThreadTx, boolean restart) {
 -    public IgniteInternalFuture<Boolean> dynamicDestroyCache(String cacheName, boolean sql, boolean checkThreadTx) {
++    public IgniteInternalFuture<Boolean> dynamicDestroyCache(String cacheName, boolean sql, boolean checkThreadTx, boolean restart) {
          assert cacheName != null;
  
          if (checkThreadTx)
              checkEmptyTransactions();
  
-         DynamicCacheChangeRequest req = DynamicCacheChangeRequest.stopRequest(ctx, cacheName, true);
+         DynamicCacheChangeRequest req = DynamicCacheChangeRequest.stopRequest(ctx, cacheName, sql, true);
  
 +        req.stop(true);
 +        req.destroy(true);
 +        req.restart(restart);
 +
          return F.first(initiateCacheChanges(F.asList(req), false));
      }
  
@@@ -2440,12 -2419,8 +2522,12 @@@
          List<DynamicCacheChangeRequest> reqs = new ArrayList<>(cacheNames.size());
  
          for (String cacheName : cacheNames) {
-             DynamicCacheChangeRequest req = DynamicCacheChangeRequest.stopRequest(ctx, cacheName, true);
+             DynamicCacheChangeRequest req = DynamicCacheChangeRequest.stopRequest(ctx, cacheName, false, true);
  
 +            req.stop(true);
 +            req.destroy(true);
 +            req.restart(restart);
 +
              reqs.add(req);
          }
  

http://git-wip-us.apache.org/repos/asf/ignite/blob/9d75ff8c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
index f9f318a,78216db..c8dc8dc
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
@@@ -2366,7 -2359,7 +2366,7 @@@ public class IgniteCacheProxy<K, V> ext
          IgniteInternalFuture<?> fut;
  
          try {
-             fut = ctx.kernalContext().cache().dynamicDestroyCache(ctx.name(), true, false);
 -            fut = ctx.kernalContext().cache().dynamicDestroyCache(ctx.name(), false, true);
++            fut = ctx.kernalContext().cache().dynamicDestroyCache(ctx.name(), false, true, false);
          }
          finally {
              onLeave(gate);

http://git-wip-us.apache.org/repos/asf/ignite/blob/9d75ff8c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/IgniteCacheDatabaseSharedManager.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/9d75ff8c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/9d75ff8c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/9d75ff8c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/9d75ff8c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/9d75ff8c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index dbcfeb9,2cd5629..d3042e9
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@@ -1212,9 -1111,18 +1219,21 @@@ public class GridDhtPartitionsExchangeF
      @Override public boolean onDone(@Nullable AffinityTopologyVersion res, @Nullable Throwable err) {
          boolean realExchange = !dummy && !forcePreload;
  
 +        if (!done.compareAndSet(false, true))
 +            return dummy;
 +
+         if (err == null &&
+             realExchange &&
+             !cctx.kernalContext().clientNode() &&
+             (serverNodeDiscoveryEvent() || affChangeMsg != null)) {
+             for (GridCacheContext cacheCtx : cctx.cacheContexts()) {
+                 if (!cacheCtx.affinityNode() || cacheCtx.isLocal())
+                     continue;
+ 
+                 cacheCtx.continuousQueries().flushBackupQueue(exchId.topologyVersion());
+             }
+        }
+ 
          if (err == null && realExchange) {
              for (GridCacheContext cacheCtx : cctx.cacheContexts()) {
                  if (cacheCtx.isLocal())
@@@ -1662,20 -1506,10 +1681,20 @@@
                  continue;
  
              CounterWithNodes maxCntr = maxCntrs.get(part.id());
-             
+ 
 -            if (maxCntr == null || part.initialUpdateCounter() > maxCntr.cnt)
 -                maxCntrs.put(part.id(), new CounterWithNodes(part.updateCounter(), cctx.localNodeId()));
 -            else if (part.initialUpdateCounter() == maxCntr.cnt)
 +            if (maxCntr == null && cntr == 0) {
 +                CounterWithNodes cntrObj = new CounterWithNodes(cntr, cctx.localNodeId());
 +
 +                for (UUID nodeId : msgs.keySet()) {
 +                    if (top.partitionState(nodeId, part.id()) == GridDhtPartitionState.OWNING)
 +                        cntrObj.nodes.add(nodeId);
 +                }
 +
 +                maxCntrs.put(part.id(), cntrObj);
 +            }
 +            else if (maxCntr == null || cntr > maxCntr.cnt)
 +                maxCntrs.put(part.id(), new CounterWithNodes(cntr, cctx.localNodeId()));
 +            else if (cntr == maxCntr.cnt)
                  maxCntr.nodes.add(cctx.localNodeId());
          }
  

http://git-wip-us.apache.org/repos/asf/ignite/blob/9d75ff8c/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/9d75ff8c/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 5245cf8,bfbfb6c..207b4c1
--- 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
@@@ -42,8 -42,8 +42,7 @@@ import org.apache.ignite.internal.proce
  import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
  import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
  import org.apache.ignite.internal.processors.cache.GridCacheContext;
 -import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
  import org.apache.ignite.internal.processors.cache.KeyCacheObject;
- import org.apache.ignite.internal.processors.cache.QueryCursorImpl;
  import org.apache.ignite.internal.processors.cache.query.CacheQueryFuture;
  import org.apache.ignite.internal.processors.cache.query.CacheQueryType;
  import org.apache.ignite.internal.processors.cache.query.GridCacheQueryType;

http://git-wip-us.apache.org/repos/asf/ignite/blob/9d75ff8c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java
----------------------------------------------------------------------
diff --cc modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java
index 0000000,1d616f8..ac443ef
mode 000000,100644..100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java
@@@ -1,0 -1,367 +1,366 @@@
+ /*
+  * 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.sql.PreparedStatement;
+ import java.sql.SQLException;
+ import java.util.Collection;
+ import java.util.Collections;
+ import java.util.HashSet;
+ import java.util.List;
+ import java.util.Random;
+ import java.util.Set;
+ import java.util.concurrent.Callable;
+ import javax.cache.Cache;
+ import javax.cache.CacheException;
+ import org.apache.ignite.Ignite;
+ import org.apache.ignite.IgniteCache;
+ import org.apache.ignite.IgniteCheckedException;
+ import org.apache.ignite.IgniteDataStreamer;
+ import org.apache.ignite.cache.CacheAtomicityMode;
+ import org.apache.ignite.cache.query.FieldsQueryCursor;
+ import org.apache.ignite.cache.query.QueryCursor;
+ import org.apache.ignite.cache.query.SqlFieldsQuery;
+ import org.apache.ignite.cache.query.SqlQuery;
+ import org.apache.ignite.configuration.CacheConfiguration;
+ import org.apache.ignite.configuration.IgniteConfiguration;
+ import org.apache.ignite.configuration.NearCacheConfiguration;
+ import org.apache.ignite.internal.GridKernalContext;
+ import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+ import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+ import org.apache.ignite.internal.processors.query.GridQueryCancel;
+ import org.apache.ignite.internal.processors.query.GridQueryIndexing;
+ import org.apache.ignite.internal.processors.query.GridQueryProcessor;
+ import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor;
+ import org.apache.ignite.internal.processors.query.GridRunningQueryInfo;
+ import org.apache.ignite.internal.processors.query.QueryIndexDescriptorImpl;
+ import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitor;
+ import org.apache.ignite.internal.util.GridSpinBusyLock;
+ import org.apache.ignite.internal.util.lang.GridCloseableIterator;
+ import org.apache.ignite.lang.IgniteBiTuple;
+ import org.apache.ignite.lang.IgniteFuture;
+ import org.apache.ignite.spi.indexing.IndexingQueryFilter;
+ import org.apache.ignite.testframework.GridTestUtils;
+ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+ import org.jetbrains.annotations.Nullable;
+ 
+ /**
+  * Test checks whether cache initialization error on client side
+  * doesn't causes hangs and doesn't impact other caches.
+  */
+ public class IgniteClientCacheInitializationFailTest extends GridCommonAbstractTest {
+     /** Failed cache name. */
+     private static final String CACHE_NAME = "cache";
+ 
+     /** Atomic cache name. */
+     private static final String ATOMIC_CACHE_NAME = "atomic-cache";
+ 
+     /** Tx cache name. */
+     private static final String TX_CACHE_NAME = "tx-cache";
+ 
+     /** Near atomic cache name. */
+     private static final String NEAR_ATOMIC_CACHE_NAME = "near-atomic-cache";
+ 
+     /** Near tx cache name. */
+     private static final String NEAR_TX_CACHE_NAME = "near-tx-cache";
+ 
+     /** Failed caches. */
+     private static final Set<String> FAILED_CACHES;
+ 
+     static {
+         Set<String> set = new HashSet<>();
+ 
+         set.add(ATOMIC_CACHE_NAME);
+         set.add(TX_CACHE_NAME);
+         set.add(NEAR_ATOMIC_CACHE_NAME);
+         set.add(NEAR_TX_CACHE_NAME);
+ 
+         FAILED_CACHES = Collections.unmodifiableSet(set);
+     }
+ 
+     /** {@inheritDoc} */
+     @Override protected void beforeTestsStarted() throws Exception {
+         startGrid("server");
+         startGrid("client");
+     }
+ 
+     /** {@inheritDoc} */
+     @Override protected void afterTestsStopped() throws Exception {
+         stopAllGrids();
+     }
+ 
+     /** {@inheritDoc} */
+     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+         IgniteConfiguration cfg = super.getConfiguration(gridName);
+ 
+         if (gridName.contains("server")) {
+             CacheConfiguration<Integer, String> ccfg1 = new CacheConfiguration<>();
+ 
+             ccfg1.setIndexedTypes(Integer.class, String.class);
+             ccfg1.setName(ATOMIC_CACHE_NAME);
+             ccfg1.setAtomicityMode(CacheAtomicityMode.ATOMIC);
+ 
+             CacheConfiguration<Integer, String> ccfg2 = new CacheConfiguration<>();
+ 
+             ccfg2.setIndexedTypes(Integer.class, String.class);
+             ccfg2.setName(TX_CACHE_NAME);
+             ccfg2.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
+ 
+             cfg.setCacheConfiguration(ccfg1, ccfg2);
+         }
+         else {
+             GridQueryProcessor.idxCls = FailedIndexing.class;
+ 
+             cfg.setClientMode(true);
+         }
+ 
+         return cfg;
+     }
+ 
+     /**
+      * @throws Exception If failed.
+      */
+     public void testAtomicCacheInitialization() throws Exception {
+         checkCacheInitialization(ATOMIC_CACHE_NAME);
+     }
+ 
+     /**
+      * @throws Exception If failed.
+      */
+     public void testTransactionalCacheInitialization() throws Exception {
+         checkCacheInitialization(TX_CACHE_NAME);
+     }
+ 
+     /**
+      * @throws Exception If failed.
+      */
+     public void testAtomicNearCacheInitialization() throws Exception {
+         checkCacheInitialization(NEAR_ATOMIC_CACHE_NAME);
+     }
+ 
+     /**
+      * @throws Exception If failed.
+      */
+     public void testTransactionalNearCacheInitialization() throws Exception {
+         checkCacheInitialization(NEAR_TX_CACHE_NAME);
+     }
+ 
+     /**
+      * @throws Exception If failed.
+      */
+     private void checkCacheInitialization(final String cacheName) throws Exception {
+         Ignite client = grid("client");
+ 
+         checkFailedCache(client, cacheName);
+ 
+         checkFineCache(client, CACHE_NAME + 1);
+ 
+         assertNull(client.cache(cacheName));
+         assertNull(client.getOrCreateCache(cacheName));
+ 
+         checkFineCache(client, CACHE_NAME + 2);
+     }
+ 
+     /**
+      * @param client Client.
+      * @param cacheName Cache name.
+      */
+     private void checkFineCache(Ignite client, String cacheName) {
+         IgniteCache<Integer, String> cache = client.getOrCreateCache(cacheName);
+ 
+         cache.put(1, "1");
+ 
+         assertEquals("1", cache.get(1));
+     }
+ 
+     /**
+      * @param client Client.
+      */
+     @SuppressWarnings("ThrowableNotThrown")
+     private void checkFailedCache(final Ignite client, final String cacheName) {
+         GridTestUtils.assertThrows(log, new Callable<Object>() {
+             @Override public Object call() throws Exception {
+                 IgniteCache<Integer, String> cache;
+ 
+                 // Start cache with near enabled.
+                 if (NEAR_ATOMIC_CACHE_NAME.equals(cacheName) || NEAR_TX_CACHE_NAME.equals(cacheName)) {
+                     CacheConfiguration<Integer, String> ccfg = new CacheConfiguration<Integer, String>(cacheName)
+                         .setNearConfiguration(new NearCacheConfiguration<Integer, String>());
+ 
+                     if (NEAR_TX_CACHE_NAME.equals(cacheName))
+                         ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
+ 
+                     cache = client.getOrCreateCache(ccfg);
+                 }
+                 else
+                     cache = client.cache(cacheName);
+ 
+ 
+                 cache.put(1, "1");
+ 
+                 assertEquals("1", cache.get(1));
+ 
+                 return null;
+             }
+         }, CacheException.class, null);
+     }
+ 
+     /**
+      * To fail on cache start.
+      */
+     private static class FailedIndexing implements GridQueryIndexing {
+         /** {@inheritDoc} */
+         @Override public void start(GridKernalContext ctx, GridSpinBusyLock busyLock) throws IgniteCheckedException {
+             // No-op
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public void stop() throws IgniteCheckedException {
+             // No-op
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public <K, V> QueryCursor<Cache.Entry<K, V>> queryDistributedSql(String schemaName, SqlQuery qry,
+             boolean keepBinary, int mainCacheId) throws IgniteCheckedException {
+             return null;
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public FieldsQueryCursor<List<?>> queryDistributedSqlFields(String schemaName, SqlFieldsQuery qry,
+             boolean keepBinary, GridQueryCancel cancel, @Nullable Integer mainCacheId) throws IgniteCheckedException {
+             return null;
+         }
+ 
+ 
+         /** {@inheritDoc} */
+         @Override public long streamUpdateQuery(String spaceName, String qry, @Nullable Object[] params,
+             IgniteDataStreamer<?, ?> streamer) throws IgniteCheckedException {
+             return 0;
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public <K, V> QueryCursor<Cache.Entry<K, V>> queryLocalSql(String schemaName, SqlQuery qry,
+             IndexingQueryFilter filter, boolean keepBinary) throws IgniteCheckedException {
+             return null;
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public FieldsQueryCursor<List<?>> queryLocalSqlFields(String schemaName, SqlFieldsQuery qry,
+             boolean keepBinary, IndexingQueryFilter filter, GridQueryCancel cancel) throws IgniteCheckedException {
+             return null;
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public <K, V> GridCloseableIterator<IgniteBiTuple<K, V>> queryLocalText(String spaceName, String qry,
+             String typeName, IndexingQueryFilter filter) throws IgniteCheckedException {
+             return null;
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public void dynamicIndexCreate(String spaceName, String tblName, QueryIndexDescriptorImpl idxDesc,
+             boolean ifNotExists, SchemaIndexCacheVisitor cacheVisitor) throws IgniteCheckedException {
+             // No-op
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public void dynamicIndexDrop(String spaceName, String idxName,
+             boolean ifExists) throws IgniteCheckedException {
+             // No-op
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public void registerCache(String cacheName, String schemaName,
+             GridCacheContext<?, ?> cctx) throws IgniteCheckedException {
+             if (FAILED_CACHES.contains(cctx.name()) && cctx.kernalContext().clientNode())
+                 throw new IgniteCheckedException("Test query exception " + cctx.name() + " " + new Random().nextInt());
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public void unregisterCache(String spaceName) throws IgniteCheckedException {
+             // No-op
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public boolean registerType(GridCacheContext cctx,
+             GridQueryTypeDescriptor desc) throws IgniteCheckedException {
+             return false;
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public void store(String cacheName, GridQueryTypeDescriptor type, KeyCacheObject key, int partId,
+             CacheObject val, GridCacheVersion ver, long expirationTime, long link) throws IgniteCheckedException {
+             // No-op
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public void remove(String spaceName, GridQueryTypeDescriptor type, KeyCacheObject key, int partId,
+             CacheObject val, GridCacheVersion ver) throws IgniteCheckedException {
+             // No-op
+         }
+ 
+         /** {@inheritDoc} */
 -        @Override public void rebuildIndexesFromHash(GridCacheContext cctx, String schemaName,
 -            String typeName) throws IgniteCheckedException {
++        @Override public void rebuildIndexesFromHash(String cacheName) throws IgniteCheckedException {
+             // No-op
+         }
+ 
+         /** {@inheritDoc} */
 -        @Override public void markForRebuildFromHash(String cacheName, String typeName) {
++        @Override public void markForRebuildFromHash(String cacheName) {
+             // No-op
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public IndexingQueryFilter backupFilter(AffinityTopologyVersion topVer, int[] parts) {
+             return null;
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public void onDisconnected(IgniteFuture<?> reconnectFut) {
+             // No-op
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public PreparedStatement prepareNativeStatement(String space, String sql) throws SQLException {
+             return null;
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public Collection<GridRunningQueryInfo> runningQueries(long duration) {
+             return null;
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public void cancelQueries(Collection<Long> queries) {
+             // No-op
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public void cancelAllQueries() {
+             // No-op
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public String schema(String cacheName) {
+             return null;
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public boolean isInsertStatement(PreparedStatement nativeStmt) {
+             return false;
+         }
+     }
+ }

http://git-wip-us.apache.org/repos/asf/ignite/blob/9d75ff8c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
----------------------------------------------------------------------
diff --cc modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
index 4afaea3,ea3b9e2..4f606c9
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
@@@ -198,7 -198,7 +198,7 @@@ public class IgniteDynamicCacheStartSel
  
          GridTestUtils.runMultiThreaded(new Callable<Object>() {
              @Override public Object call() throws Exception {
-                 futs.add(kernal.context().cache().dynamicDestroyCache(DYNAMIC_CACHE_NAME, true, false));
 -                futs.add(kernal.context().cache().dynamicDestroyCache(DYNAMIC_CACHE_NAME, false, true));
++                futs.add(kernal.context().cache().dynamicDestroyCache(DYNAMIC_CACHE_NAME, false, true, false));
  
                  return null;
              }
@@@ -266,7 -266,7 +266,7 @@@
              @Override public Object call() throws Exception {
                  IgniteEx kernal = grid(ThreadLocalRandom.current().nextInt(nodeCount()));
  
-                 futs.add(kernal.context().cache().dynamicDestroyCache(DYNAMIC_CACHE_NAME, true, false));
 -                futs.add(kernal.context().cache().dynamicDestroyCache(DYNAMIC_CACHE_NAME, false, true));
++                futs.add(kernal.context().cache().dynamicDestroyCache(DYNAMIC_CACHE_NAME, false, true, false));
  
                  return null;
              }

http://git-wip-us.apache.org/repos/asf/ignite/blob/9d75ff8c/modules/core/src/test/java/org/apache/ignite/testframework/config/GridTestProperties.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/9d75ff8c/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/9d75ff8c/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsTestSuite.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/9d75ff8c/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --cc modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index 9de971a,ca591c1..dd4d518
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@@ -89,9 -89,10 +90,9 @@@ import org.apache.ignite.internal.proce
  import org.apache.ignite.internal.processors.query.GridRunningQueryInfo;
  import org.apache.ignite.internal.processors.query.IgniteSQLException;
  import org.apache.ignite.internal.processors.query.QueryIndexDescriptorImpl;
+ import org.apache.ignite.internal.processors.query.QueryUtils;
  import org.apache.ignite.internal.processors.query.h2.ddl.DdlStatementsProcessor;
  import org.apache.ignite.internal.processors.query.h2.opt.DistributedJoinMode;
--import org.apache.ignite.internal.processors.query.h2.database.H2PkHashIndex;
  import org.apache.ignite.internal.processors.query.h2.database.H2RowFactory;
  import org.apache.ignite.internal.processors.query.h2.database.H2TreeIndex;
  import org.apache.ignite.internal.processors.query.h2.database.io.H2ExtrasInnerIO;
@@@ -137,8 -138,9 +138,7 @@@ import org.h2.api.ErrorCode
  import org.h2.api.JavaObjectSerializer;
  import org.h2.command.Prepared;
  import org.h2.command.dml.Insert;
--import org.h2.engine.Session;
  import org.h2.engine.SysProperties;
 -import org.h2.index.Cursor;
  import org.h2.index.Index;
  import org.h2.jdbc.JdbcPreparedStatement;
  import org.h2.jdbc.JdbcStatement;
@@@ -1797,16 -1680,12 +1678,11 @@@ public class IgniteH2Indexing implement
          if (schema == null)
              return null;
  
-         return schema.tables().get(type);
+         return schema.tableByTypeName(type);
 -    };
 -
 +    }
  
-     /**
-      * Gets database schema from cache name.
-      *
-      * @param cacheName Cache name. {@code null} would be converted to an empty string.
-      * @return Schema name. Should not be null since we should not fail for an invalid cache name.
-      */
-     public String schema(String cacheName) {
+     /** {@inheritDoc} */
+     @Override  public String schema(String cacheName) {
          String res = cacheName2schema.get(cacheName);
  
          if (res == null)
@@@ -1815,19 -1694,11 +1691,26 @@@
          return res;
      }
  
 +    /**
 +     * Gets collection of table for given schema name.
 +     *
 +     * @param cacheName Schema name.
 +     * @return Collection of table descriptors.
 +     */
 +    private Collection<H2TableDescriptor> tables(String cacheName) {
 +        H2Schema s = schemas.get(schema(cacheName));
 +
 +        if (s == null)
 +            return Collections.emptySet();
 +
-         return s.tables().values();
++        return s.tables();
++    }
++
+     /** {@inheritDoc} */
+     @Override public boolean isInsertStatement(PreparedStatement nativeStmt) {
+         Prepared prep = GridSqlQueryParser.prepared(nativeStmt);
+ 
+         return prep instanceof Insert;
      }
  
      /**
@@@ -1847,69 -1718,60 +1730,53 @@@
          }
      }
  
--    /** {@inheritDoc} */
-     @Override public String cacheName(String schemaName) {
-         assert schemaName != null;
 -    @SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter")
 -    @Override public void rebuildIndexesFromHash(GridCacheContext cctx, String schemaName, String typeName)
 -        throws IgniteCheckedException {
 -        H2TableDescriptor tbl = tableDescriptor(schemaName, typeName);
--
-         H2Schema schema = schemas.get(schemaName);
 -        if (tbl == null)
 -            return;
--
-         // For the compatibility with conversion from """" to "" inside h2 lib
-         if (schema == null) {
-             assert schemaName.isEmpty() || schemaName.charAt(0) != H2Utils.ESC_CH;
 -        assert tbl.table() != null;
--
-             schema = schemas.get(H2Utils.escapeName(schemaName, true));
-         }
 -        assert tbl.table().rebuildFromHashInProgress();
--
-         return schema.cacheName();
-     }
 -        H2PkHashIndex hashIdx = tbl.primaryKeyHashIndex();
 -
 -        Cursor cursor = hashIdx.find((Session)null, null, null);
--
 -        while (cursor.next()) {
 -            CacheDataRow dataRow = (CacheDataRow)cursor.get();
 +    /**
 +     * Rebuild indexes from hash index.
 +     *
 +     * @param cacheName Cache name.
 +     * @throws IgniteCheckedException If failed.
 +     */
 +    @Override public void rebuildIndexesFromHash(String cacheName) throws IgniteCheckedException {
 +        int cacheId = CU.cacheId(cacheName);
  
 -            boolean done = false;
 +        GridCacheContext cctx = ctx.cache().context().cacheContext(cacheId);
  
 -            while (!done) {
 -                GridCacheEntryEx entry = cctx.cache().entryEx(dataRow.key());
 +        IgniteCacheOffheapManager offheapMgr = cctx.isNear() ? cctx.near().dht().context().offheap() : cctx.offheap();
  
 -                try {
 -                    synchronized (entry) {
 -                        // TODO : How to correctly get current value and link here?
 +        for (int p = 0; p < cctx.affinity().partitions(); p++) {
 +            try (GridCloseableIterator<KeyCacheObject> keyIter = offheapMgr.keysIterator(p)) {
 +                while (keyIter.hasNext()) {
 +                    cctx.shared().database().checkpointReadLock();
  
 -                        GridH2Row row = tbl.table().rowDescriptor().createRow(entry.key(), entry.partition(),
 -                            dataRow.value(), entry.version(), entry.expireTime());
 -
 -                        row.link(dataRow.link());
 +                    try {
 +                        KeyCacheObject key = keyIter.next();
  
 -                        List<Index> indexes = tbl.table().getAllIndexes();
 +                        while (true) {
 +                            try {
 +                                GridCacheEntryEx entry = cctx.isNear() ?
 +                                    cctx.near().dht().entryEx(key) : cctx.cache().entryEx(key);
  
 -                        for (int i = 2; i < indexes.size(); i++) {
 -                            Index idx = indexes.get(i);
 +                                entry.ensureIndexed();
  
 -                            if (idx instanceof H2TreeIndex)
 -                                ((H2TreeIndex)idx).put(row);
 +                                break;
 +                            }
 +                            catch (GridCacheEntryRemovedException ignore) {
 +                                // Retry.
 +                            }
 +                            catch (GridDhtInvalidPartitionException ignore) {
 +                                break;
 +                            }
                          }
 -
 -                        done = true;
                      }
 -                }
 -                catch (GridCacheEntryRemovedException e) {
 -                    // No-op
 +                    finally {
 +                        cctx.shared().database().checkpointReadUnlock();
 +                    }
                  }
              }
 -
          }
  
 -        tbl.table().markRebuildFromHashInProgress(false);
 +        for (H2TableDescriptor tblDesc : tables(cacheName))
 +            tblDesc.table().markRebuildFromHashInProgress(false);
      }
  
      /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/9d75ff8c/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/AbstractSchemaSelfTest.java
----------------------------------------------------------------------
diff --cc modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/AbstractSchemaSelfTest.java
index 1f50244,406cba5..eb3b8e1
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/AbstractSchemaSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/AbstractSchemaSelfTest.java
@@@ -433,6 -455,97 +455,96 @@@ public class AbstractSchemaSelfTest ext
      }
  
      /**
+      * Synchronously create index.
+      *
+      * @param node Ignite node.
+      * @param cacheName Cache name.
+      * @param tblName Table name.
+      * @param idx Index.
+      * @param ifNotExists When set to true operation will fail if index already exists.
+      * @throws Exception If failed.
+      */
+     protected void dynamicIndexCreate(Ignite node, String cacheName, String tblName, QueryIndex idx, boolean ifNotExists)
+         throws Exception {
+         GridStringBuilder sql = new SB("CREATE INDEX ")
+             .a(ifNotExists ? "IF NOT EXISTS " : "")
+             .a(idx.getName())
+             .a(" ON ")
+             .a(tblName)
+             .a(" (");
+ 
+         boolean first = true;
+ 
+         for (Map.Entry<String, Boolean> fieldEntry : idx.getFields().entrySet()) {
+             if (first)
+                 first = false;
+             else
+                 sql.a(", ");
+ 
+             String name = fieldEntry.getKey();
+             boolean asc = fieldEntry.getValue();
+ 
+             sql.a(name).a(" ").a(asc ? "ASC" : "DESC");
+         }
+ 
+         sql.a(')');
+ 
+         executeSql(node, cacheName, sql.toString());
+     }
+ 
+     /**
+      * Synchronously drop index.
+      *
+      * @param node Ignite node.
+      * @param cacheName Cache name.
+      * @param idxName Index name.
+      * @param ifExists When set to true operation fill fail if index doesn't exists.
+      * @throws Exception if failed.
+      */
+     protected void dynamicIndexDrop(Ignite node, String cacheName, String idxName, boolean ifExists) throws Exception {
+         String sql = "DROP INDEX " + (ifExists ? "IF EXISTS " : "") + idxName;
+ 
+         executeSql(node, cacheName, sql);
+     }
+ 
+     /**
+      * Start SQL cache on given node.
+      * @param node Node to create cache on.
+      * @param ccfg Cache configuration.
+      * @return Created cache.
+      */
+     protected IgniteCache<?, ?> createSqlCache(Ignite node, CacheConfiguration ccfg) throws IgniteCheckedException {
+         ((IgniteEx)node).context().cache().dynamicStartSqlCache(ccfg).get();
+ 
+         IgniteCache<?, ?> res = node.cache(CACHE_NAME);
+ 
+         assertNotNull(res);
+ 
+         return res;
+     }
+ 
+     /**
+      * Destroy SQL cache on given node.
+      * @param node Node to create cache on.
 -     * @return Created cache.
+      */
+     protected void destroySqlCache(Ignite node) throws IgniteCheckedException {
 -        ((IgniteEx)node).context().cache().dynamicDestroyCache(CACHE_NAME, true, true).get();
++        ((IgniteEx)node).context().cache().dynamicDestroyCache(CACHE_NAME, true, true, false).get();
+     }
+ 
+     /**
+      * Execute SQL.
+      *
+      * @param node Ignite node.
+      * @param cacheName Cache name.
+      * @param sql SQL.
+      */
+     private void executeSql(Ignite node, String cacheName, String sql) {
+         log.info("Executing DDL: " + sql);
+ 
+         node.cache(cacheName).query(new SqlFieldsQuery(sql)).getAll();
+     }
+ 
+     /**
       * Key class.
       */
      public static class KeyClass {

http://git-wip-us.apache.org/repos/asf/ignite/blob/9d75ff8c/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractBasicSelfTest.java
----------------------------------------------------------------------
diff --cc modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractBasicSelfTest.java
index 7e3473f,cf83319..1a188e4
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractBasicSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractBasicSelfTest.java
@@@ -74,7 -77,7 +77,7 @@@ public abstract class DynamicIndexAbstr
  
      /** {@inheritDoc} */
      @Override protected void afterTest() throws Exception {
-         node().destroyCache(CACHE_NAME);
 -        node().context().cache().dynamicDestroyCache(CACHE_NAME, true, true).get();
++        node().context().cache().dynamicDestroyCache(CACHE_NAME, true, true, false).get();
  
          super.afterTest();
      }

http://git-wip-us.apache.org/repos/asf/ignite/blob/9d75ff8c/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite3.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/9d75ff8c/pom.xml
----------------------------------------------------------------------


Mime
View raw message