ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [30/31] ignite git commit: Merge remote-tracking branch 'remotes/origin/master' into ignite-5267
Date Tue, 06 Jun 2017 10:01:51 GMT
Merge remote-tracking branch 'remotes/origin/master' into ignite-5267

# Conflicts:
#	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
#	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java
#	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeActions.java
#	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
#	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
#	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java
#	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
#	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/tree/io/PageIO.java
#	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
#	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java
#	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
#	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
#	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandMessage.java
#	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
#	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java
#	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
#	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
#	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
#	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
#	modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
#	modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheExchangeMessageDuplicatedStateTest.java
#	modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
#	modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsSqlTest.java
#	modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java


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

Branch: refs/heads/ignite-5267
Commit: 4f69bd021a3e0951ca222e58cc1fb947c0042635
Parents: 874b1f4 db85d16
Author: sboikov <sboikov@gridgain.com>
Authored: Tue Jun 6 13:01:02 2017 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Tue Jun 6 13:01:02 2017 +0300

----------------------------------------------------------------------
 .../jdbc2/JdbcAbstractDmlStatementSelfTest.java |   2 -
 .../jdbc2/JdbcComplexQuerySelfTest.java         |   2 -
 .../internal/jdbc2/JdbcConnectionSelfTest.java  |   2 -
 .../jdbc2/JdbcDistributedJoinsQueryTest.java    |   2 -
 .../internal/jdbc2/JdbcEmptyCacheSelfTest.java  |   2 -
 .../internal/jdbc2/JdbcLocalCachesSelfTest.java |   2 -
 .../internal/jdbc2/JdbcMetadataSelfTest.java    |   2 -
 .../internal/jdbc2/JdbcNoDefaultCacheTest.java  |   2 -
 .../jdbc2/JdbcPreparedStatementSelfTest.java    |   2 -
 .../internal/jdbc2/JdbcResultSetSelfTest.java   |   2 -
 .../internal/jdbc2/JdbcSpringSelfTest.java      |   2 -
 .../internal/jdbc2/JdbcStatementSelfTest.java   |   2 -
 .../internal/jdbc2/JdbcStreamingSelfTest.java   |   2 -
 .../jdbc/AbstractJdbcPojoQuerySelfTest.java     |   2 -
 .../ignite/jdbc/JdbcComplexQuerySelfTest.java   |   2 -
 .../ignite/jdbc/JdbcConnectionSelfTest.java     |   2 -
 .../ignite/jdbc/JdbcEmptyCacheSelfTest.java     |   2 -
 .../ignite/jdbc/JdbcLocalCachesSelfTest.java    |   2 -
 .../ignite/jdbc/JdbcMetadataSelfTest.java       |   2 -
 .../ignite/jdbc/JdbcNoDefaultCacheTest.java     |   2 -
 .../jdbc/JdbcPreparedStatementSelfTest.java     |   2 -
 .../ignite/jdbc/JdbcResultSetSelfTest.java      |   2 -
 .../ignite/jdbc/JdbcStatementSelfTest.java      |   2 -
 .../JdbcThinAbstractDmlStatementSelfTest.java   |   5 -
 .../jdbc/thin/JdbcThinAbstractSelfTest.java     |  16 +-
 .../jdbc/thin/JdbcThinConnectionSelfTest.java   |  84 ++-
 .../jdbc/thin/JdbcThinEmptyCacheSelfTest.java   |   3 -
 .../jdbc/thin/JdbcThinNoDefaultSchemaTest.java  |   2 -
 .../thin/JdbcThinPreparedStatementSelfTest.java |   3 -
 .../jdbc/thin/JdbcThinStatementSelfTest.java    |   3 -
 .../main/java/META-INF/services/java.sql.Driver |   2 +
 .../org/apache/ignite/IgniteJdbcDriver.java     |   9 +-
 .../org/apache/ignite/IgniteJdbcThinDriver.java |  19 +-
 .../ignite/cache/query/SqlFieldsQuery.java      |  12 +-
 .../configuration/IgniteConfiguration.java      |  30 +
 .../ignite/configuration/OdbcConfiguration.java |   4 +
 .../SqlConnectorConfiguration.java              | 275 +++++++++
 .../internal/jdbc/thin/JdbcThinConnection.java  |   8 +-
 .../internal/jdbc/thin/JdbcThinTcpIo.java       |  49 +-
 .../internal/jdbc/thin/JdbcThinUtils.java       |  15 +-
 .../cache/CacheAffinitySharedManager.java       |   6 +-
 .../processors/cache/ClusterCachesInfo.java     |  11 +
 .../processors/cache/GridCacheProcessor.java    |  59 ++
 .../processors/cache/GridCacheUtils.java        |   3 +
 .../distributed/dht/GridDhtLocalPartition.java  |  14 +
 .../dht/GridDhtPartitionTopologyImpl.java       |  10 +-
 .../dht/preloader/GridDhtPartitionDemander.java |   1 +
 .../GridDhtPartitionsExchangeFuture.java        |   1 +
 .../preloader/GridDhtPartitionsFullMessage.java |  20 +-
 .../GridDhtPartitionsSingleMessage.java         |   6 +-
 .../dht/preloader/GridDhtPreloader.java         |   7 +-
 .../internal/processors/odbc/OdbcTypes.java     | 131 -----
 .../internal/processors/odbc/OdbcUtils.java     | 141 -----
 .../processors/odbc/SqlListenerDataTypes.java   |  30 +-
 .../processors/odbc/SqlListenerNioListener.java |  40 +-
 .../processors/odbc/SqlListenerProcessor.java   | 187 +++++--
 .../odbc/jdbc/JdbcRequestHandler.java           |  34 +-
 .../processors/odbc/odbc/OdbcColumnMeta.java    |   1 -
 .../processors/odbc/odbc/OdbcMessageParser.java |  12 +-
 .../odbc/odbc/OdbcQueryExecuteRequest.java      |  16 +-
 .../odbc/OdbcQueryGetColumnsMetaRequest.java    |  44 +-
 .../odbc/OdbcQueryGetParamsMetaRequest.java     |  15 +-
 .../odbc/odbc/OdbcRequestHandler.java           |  69 +--
 .../processors/odbc/odbc/OdbcTableMeta.java     |   1 -
 .../processors/odbc/odbc/OdbcTypes.java         | 131 +++++
 .../processors/odbc/odbc/OdbcUtils.java         | 142 +++++
 .../odbc/odbc/escape/OdbcEscapeUtils.java       |   2 +-
 .../platform/cache/PlatformCache.java           |   4 +-
 .../processors/query/GridQueryProcessor.java    |  12 +-
 .../internal/processors/query/QueryUtils.java   |  44 ++
 .../processors/cache/IgniteCacheGroupsTest.java | 556 ++++++++++++++++++-
 ...ologyValidatorAbstractTxCacheGroupsTest.java | 126 +++++
 ...opologyValidatorCacheGroupsAbstractTest.java | 131 +++++
 ...torNearPartitionedAtomicCacheGroupsTest.java |  31 ++
 ...lidatorNearPartitionedTxCacheGroupsTest.java |  31 ++
 ...lidatorPartitionedAtomicCacheGroupsTest.java |  45 ++
 ...gyValidatorPartitionedTxCacheGroupsTest.java |  31 ++
 ...alidatorReplicatedAtomicCacheGroupsTest.java |  45 ++
 ...ogyValidatorReplicatedTxCacheGroupsTest.java |  31 ++
 ...eCacheGroupsPartitionLossPolicySelfTest.java | 355 ++++++++++++
 .../OdbcConfigurationValidationSelfTest.java    | 186 +++++++
 .../SqlListenerProcessorValidationSelfTest.java | 184 ------
 .../ignite/testsuites/IgniteBasicTestSuite.java |   4 +-
 .../testsuites/IgniteCacheTestSuite5.java       |   2 +
 .../IgniteTopologyValidatorTestSuite.java       |  14 +
 .../cache/query/GridCacheTwoStepQuery.java      |   1 +
 .../processors/query/h2/IgniteH2Indexing.java   |   2 +-
 .../query/h2/ddl/DdlStatementsProcessor.java    |  18 +-
 .../cache/IgniteCacheGroupsSqlTest.java         |   5 -
 .../cache/IgniteCacheNoClassQuerySelfTest.java  |   2 +
 .../cache/index/H2DynamicTableSelfTest.java     | 106 +++-
 .../IgniteCacheGroupsCompareQueryTest.java      |  45 ++
 ...teCacheGroupsSqlDistributedJoinSelfTest.java |  30 +
 ...roupsSqlSegmentedIndexMultiNodeSelfTest.java |  28 +
 ...iteCacheGroupsSqlSegmentedIndexSelfTest.java |  37 ++
 .../query/IgniteSqlDistributedJoinSelfTest.java |   2 +-
 .../processors/query/SqlSchemaSelfTest.java     |  25 +
 .../query/h2/sql/BaseH2CompareQueryTest.java    |  35 +-
 ...onnectorConfigurationValidationSelfTest.java | 240 ++++++++
 .../IgniteCacheQuerySelfTestSuite.java          |   3 +
 .../IgniteCacheQuerySelfTestSuite2.java         |   9 +
 .../core-test/config/cache-query-default.xml    |  27 +-
 .../cpp/core-test/src/cache_query_test.cpp      |  47 +-
 .../ignite/cache/query/query_sql_fields.h       |  53 +-
 .../odbc-example/config/example-odbc.xml        |   6 -
 .../odbc-test/config/queries-test-default.xml   |   9 +-
 .../odbc-test/config/queries-test-noodbc-32.xml |   4 +
 .../odbc-test/config/queries-test-noodbc.xml    |   6 +-
 .../project/vs/odbc-test.vcxproj.filters        |   4 +-
 .../cpp/odbc-test/src/api_robustness_test.cpp   |  54 +-
 .../cpp/odbc-test/src/configuration_test.cpp    |  32 +-
 .../cpp/odbc-test/src/queries_test.cpp          |  34 +-
 .../odbc-test/src/sql_test_suite_fixture.cpp    |   2 +-
 .../include/ignite/odbc/config/configuration.h  |  24 +-
 .../cpp/odbc/include/ignite/odbc/connection.h   |   6 +-
 .../cpp/odbc/include/ignite/odbc/message.h      |  30 +-
 .../odbc/system/ui/dsn_configuration_window.h   |  12 +-
 .../src/system/ui/dsn_configuration_window.cpp  |  18 +-
 .../cpp/odbc/src/config/configuration.cpp       |   4 +-
 modules/platforms/cpp/odbc/src/connection.cpp   |   4 +-
 modules/platforms/cpp/odbc/src/dsn_config.cpp   |   4 +-
 .../odbc/src/query/column_metadata_query.cpp    |   2 +-
 .../platforms/cpp/odbc/src/query/data_query.cpp |  14 +-
 modules/platforms/cpp/odbc/src/statement.cpp    |  12 +-
 .../Cache/Query/CacheLinqTest.cs                |  12 +-
 .../Cache/Query/CacheQueriesTest.cs             |  32 ++
 .../Cache/Query/SqlFieldsQuery.cs               |  12 +-
 .../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs  |   1 +
 modules/platforms/dotnet/build.ps1              |  36 +-
 129 files changed, 3642 insertions(+), 998 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/4f69bd02/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractDmlStatementSelfTest.java
----------------------------------------------------------------------

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

http://git-wip-us.apache.org/repos/asf/ignite/blob/4f69bd02/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
index d8ca177,dc4a91f..031033c
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
@@@ -405,18 -400,17 +405,19 @@@ public class CacheAffinitySharedManager
              }
          }
  
-         Set<Integer> gprs = new HashSet<>();
 -            Set<Integer> gprs = new HashSet<>();
++        Set<
++            Integer > gprs = new HashSet<>();
  
 -                for (ExchangeActions.ActionData action : exchActions.newAndClientCachesStartRequests())
{
 -                    Integer grpId = action.descriptor().groupId();
 +        for (ExchangeActions.ActionData action : exchActions.newAndClientCachesStartRequests())
{
 +            Integer grpId = action.descriptor().groupId();
  
 -                    if (gprs.add(grpId)) {
 -                        if (crd && lateAffAssign)
 -                    initStartedGroupOnCoordinator(fut, action.descriptor().groupDescriptor());else
 {
 -                        CacheGroupContext grp = cctx.cache().cacheGroup(grpId);
 +            if (gprs.add(grpId)) {
 +                if (crd && lateAffAssign)
 +                    initStartedGroupOnCoordinator(fut, action.descriptor().groupDescriptor());
 +                else {
 +                    CacheGroupContext grp = cctx.cache().cacheGroup(grpId);
  
 -                        if (grp != null && !grp.isLocal() && grp.localStartVersion().equals(fut.topologyVersion()))
{
 +                    if (grp != null && !grp.isLocal() && grp.localStartVersion().equals(fut.topologyVersion()))
{
                          assert grp.affinity().lastVersion().equals(AffinityTopologyVersion.NONE)
: grp.affinity().lastVersion();
  
                          initAffinity(registeredGrps.get(grp.groupId()), grp.affinity(),
fut);
@@@ -427,8 -421,8 +428,7 @@@
  
          List<ExchangeActions.ActionData> closeReqs = exchActions.closeRequests(cctx.localNodeId());
  
--        for (ExchangeActions.ActionData req : closeReqs) {
--            cctx.cache().blockGateway(req.request());
++        for (ExchangeActions.ActionData req : closeReqs) {    cctx.cache().blockGateway(req.request());
  
              if (crd) {
                  CacheGroupContext grp = cctx.cache().cacheGroup(req.descriptor().groupId());

http://git-wip-us.apache.org/repos/asf/ignite/blob/4f69bd02/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 577bfb9,ad83b14..ec63c03
--- 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
@@@ -1315,6 -1316,16 +1315,15 @@@ public class GridCacheProcessor extend
                  log.info("Stopped cache [cacheName=" + cache.name() + ']');
          }
  
 -        if (sharedCtx.pageStore() != null) {
 -            try {
 -                sharedCtx.pageStore().shutdownForCache(ctx, destroy);
 -            }
 -            catch (IgniteCheckedException e) {
 -                U.error(log, "Failed to gracefully clean page store resources for destroyed
cache " +
 -                    "[cache=" + ctx.name() + "]", e);
 -            }
++        U.stopLifecycleAware(log, lifecycleAwares(ctx.group(), cache.configuration(), ctx.store().configuredStore()));
++
++        if (log.isInfoEnabled()) {
++            if (ctx.group().sharedGroup())
++                log.info("Stopped cache [cacheName=" + cache.name() + ", group=" + ctx.group().name()
+ ']');
++            else
++                log.info("Stopped cache [cacheName=" + cache.name() + ']');
+         }
+ 
          cleanup(ctx);
      }
  
@@@ -1941,14 -1945,11 +1950,64 @@@
          grp.onCacheStarted(cacheCtx);
  
          onKernalStart(cache);
 +
 +        if (proxyRestart)
 +            proxy.onRestarted(cacheCtx, cache);
 +    }
 +
 +    /**
 +     * @param desc Group descriptor.
 +     * @param cacheType Cache type.
++     * @param affNode Affinity node flag.
++     * @param cacheObjCtx Cache object context.
++     * @param exchTopVer Current topology version.
++     * @return Started cache group.
++     * @throws IgniteCheckedException If failed.
++     */
++    private CacheGroupContext startCacheGroup(
++        CacheGroupDescriptor desc,
++        CacheType cacheType,
++        boolean affNode,
++        CacheObjectContext cacheObjCtx,
++        AffinityTopologyVersion exchTopVer)
++        throws IgniteCheckedException {
++        CacheConfiguration cfg = new CacheConfiguration(desc.config());
++
++        String memPlcName = cfg.getMemoryPolicyName();
++
++        MemoryPolicy memPlc = sharedCtx.database().memoryPolicy(memPlcName);
++        FreeList freeList = sharedCtx.database().freeList(memPlcName);
++        ReuseList reuseList = sharedCtx.database().reuseList(memPlcName);
++
++        CacheGroupContext grp = new CacheGroupContext(sharedCtx,
++            desc.groupId(),
++            desc.receivedFrom(),
++            cacheType,
++            cfg,
++            affNode,
++            memPlc,
++            cacheObjCtx,
++            freeList,
++            reuseList,
++            exchTopVer);
++
++        for (Object obj : grp.configuredUserObjects())
++            prepare(cfg, obj, false);
++
++        U.startLifecycleAware(grp.configuredUserObjects());
++
++        grp.start();
++
++        CacheGroupContext old = cacheGrps.put(desc.groupId(), grp);
++
++        assert old == null : old.name();
++
++        return grp;
+     }
+ 
+     /**
+      * @param desc Group descriptor.
+      * @param cacheType Cache type.
       * @param affNode Affinity node flag.
       * @param cacheObjCtx Cache object context.
       * @param exchTopVer Current topology version.

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

http://git-wip-us.apache.org/repos/asf/ignite/blob/4f69bd02/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
index 791bac0,248d44e..8baeffe
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
@@@ -416,92 -507,99 +416,101 @@@ public class GridDhtPartitionTopologyIm
  
          ctx.database().checkpointReadLock();
  
 -        synchronized (ctx.exchange().interruptLock()) {
 -            if (Thread.currentThread().isInterrupted())
 -                throw new IgniteInterruptedCheckedException("Thread is interrupted: " +
Thread.currentThread());
 +        try {
 +            synchronized (ctx.exchange().interruptLock()) {
 +                if (Thread.currentThread().isInterrupted())
 +                    throw new IgniteInterruptedCheckedException("Thread is interrupted:
" + Thread.currentThread());
  
 -            try {
                  U.writeLock(lock);
 -            }
 -            catch (IgniteInterruptedCheckedException e) {
 -                ctx.database().checkpointReadUnlock();
  
 -                throw e;
 -            }
 +                try {
 +                    GridDhtPartitionExchangeId exchId = exchFut.exchangeId();
  
 -            try {
 -                GridDhtPartitionExchangeId exchId = exchFut.exchangeId();
 +                    if (stopping)
 +                        return;
  
 -                if (stopping)
 -                    return;
 +                    assert topVer.equals(exchId.topologyVersion()) : "Invalid topology version
[topVer=" +
 +                        topVer + ", exchId=" + exchId + ']';
  
 -                assert topVer.equals(exchId.topologyVersion()) : "Invalid topology version
[topVer=" +
 -                    topVer + ", exchId=" + exchId + ']';
 +                    if (exchId.isLeft())
 +                        removeNode(exchId.nodeId());
  
 -                if (exchId.isLeft())
 -                    removeNode(exchId.nodeId());
 +                    ClusterNode oldest = discoCache.oldestAliveServerNodeWithCache();
  
 -                ClusterNode oldest = discoCache.oldestAliveServerNodeWithCache();
 +                    if (log.isDebugEnabled())
 +                        log.debug("Partition map beforeExchange [exchId=" + exchId + ",
fullMap=" + fullMapString() + ']');
  
 -                if (log.isDebugEnabled())
 -                    log.debug("Partition map beforeExchange [exchId=" + exchId + ", fullMap="
+ fullMapString() + ']');
 +                    long updateSeq = this.updateSeq.incrementAndGet();
  
 -                long updateSeq = this.updateSeq.incrementAndGet();
 +                    cntrMap.clear();
  
 -                cntrMap.clear();
 +                    // If this is the oldest node.
 +                    if (oldest != null && (loc.equals(oldest) || exchFut.cacheGroupAddedOnExchange(grp.groupId(),
grp.receivedFrom()))) {
 +                        if (node2part == null) {
 +                            node2part = new GridDhtPartitionFullMap(oldest.id(), oldest.order(),
updateSeq);
  
 -                // If this is the oldest node.
 -                if (oldest != null && (loc.equals(oldest) || exchFut.cacheGroupAddedOnExchange(grp.groupId(),
grp.receivedFrom()))) {
 -                    if (node2part == null) {
 -                        node2part = new GridDhtPartitionFullMap(oldest.id(), oldest.order(),
updateSeq);
 +                            if (log.isDebugEnabled())
 +                                log.debug("Created brand new full topology map on oldest
node [exchId=" +
 +                                    exchId + ", fullMap=" + fullMapString() + ']');
 +                        }
 +                        else if (!node2part.valid()) {
 +                            node2part = new GridDhtPartitionFullMap(oldest.id(), oldest.order(),
updateSeq, node2part, false);
  
 -                        if (log.isDebugEnabled())
 -                            log.debug("Created brand new full topology map on oldest node
[exchId=" +
 -                                exchId + ", fullMap=" + fullMapString() + ']');
 -                    }
 -                    else if (!node2part.valid()) {
 -                        node2part = new GridDhtPartitionFullMap(oldest.id(), oldest.order(),
updateSeq, node2part, false);
 +                            if (log.isDebugEnabled())
 +                                log.debug("Created new full topology map on oldest node
[exchId=" + exchId + ", fullMap=" +
 +                                    node2part + ']');
 +                        }
 +                        else if (!node2part.nodeId().equals(loc.id())) {
 +                            node2part = new GridDhtPartitionFullMap(oldest.id(), oldest.order(),
updateSeq, node2part, false);
  
 -                        if (log.isDebugEnabled())
 -                            log.debug("Created new full topology map on oldest node [exchId="
+ exchId + ", fullMap=" +
 -                                node2part + ']');
 +                            if (log.isDebugEnabled())
 +                                log.debug("Copied old map into new map on oldest node (previous
oldest node left) [exchId=" +
 +                                    exchId + ", fullMap=" + fullMapString() + ']');
 +                        }
                      }
 -                    else if (!node2part.nodeId().equals(loc.id())) {
 -                        node2part = new GridDhtPartitionFullMap(oldest.id(), oldest.order(),
updateSeq, node2part, false);
  
 -                        if (log.isDebugEnabled())
 -                            log.debug("Copied old map into new map on oldest node (previous
oldest node left) [exchId=" +
 -                                exchId + ", fullMap=" + fullMapString() + ']');
 +                    if (affReady)
 +                        initPartitions0(exchFut, updateSeq);
 +                    else {
 +                        List<List<ClusterNode>> aff = grp.affinity().idealAssignment();
 +
 +                        createPartitions(aff, updateSeq);
                      }
 -                }
  
 -                if (affReady)
 -                    initPartitions0(exchFut, updateSeq);
 -                else {
 -                    List<List<ClusterNode>> aff = grp.affinity().idealAssignment();
 +                    consistencyCheck();
  
 -                    createPartitions(aff, updateSeq);
 +                    if (log.isDebugEnabled())
 +                        log.debug("Partition map after beforeExchange [exchId=" + exchId
+ ", fullMap=" +
 +                            fullMapString() + ']');
 +                }
 +                finally {
 +                    lock.writeLock().unlock();
                  }
 -
 -                consistencyCheck();
 -
 -                if (log.isDebugEnabled())
 -                    log.debug("Partition map after beforeExchange [exchId=" + exchId + ",
fullMap=" +
 -                        fullMapString() + ']');
 -            }
 -            finally {
 -                lock.writeLock().unlock();
 -
 -                ctx.database().checkpointReadUnlock();
              }
          }
 +        finally {
 +            ctx.database().checkpointReadUnlock();
 +        }
 +    }
  
 -        // Wait for evictions.
 -        waitForRent();
 +    /**
 +     * @param p Partition number.
 +     * @param topVer Topology version.
 +     * @return {@code True} if given partition belongs to local node.
 +     */
 +    private boolean partitionLocalNode(int p, AffinityTopologyVersion topVer) {
 +        return grp.affinity().nodes(p, topVer).contains(ctx.localNode());
      }
  
+     /**
+      * @param p Partition number.
+      * @param topVer Topology version.
+      * @return {@code True} if given partition belongs to local node.
+      */
+     private boolean partitionLocalNode(int p, AffinityTopologyVersion topVer) {
+         return grp.affinity().nodes(p, topVer).contains(ctx.localNode());
+     }
+ 
      /** {@inheritDoc} */
      @Override public boolean afterExchange(GridDhtPartitionsExchangeFuture exchFut) throws
IgniteCheckedException {
          treatAllPartAsLoc = false;

http://git-wip-us.apache.org/repos/asf/ignite/blob/4f69bd02/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
index cda24e5,a1b45df..b19459d
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
@@@ -41,7 -41,6 +41,8 @@@ import org.apache.ignite.internal.proce
  import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
  import org.apache.ignite.internal.processors.cache.CacheEntryInfoCollection;
  import org.apache.ignite.internal.processors.cache.CacheGroupContext;
 +import org.apache.ignite.internal.processors.cache.CacheMetricsImpl;
++import org.apache.ignite.internal.processors.cache.CacheGroupContext;
  import org.apache.ignite.internal.processors.cache.GridCacheContext;
  import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
  import org.apache.ignite.internal.processors.cache.GridCacheEntryInfo;

http://git-wip-us.apache.org/repos/asf/ignite/blob/4f69bd02/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 88dc863,0c5cdd9..3a9e2d8
--- 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
@@@ -57,8 -55,7 +57,9 @@@ import org.apache.ignite.internal.pagem
  import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
  import org.apache.ignite.internal.processors.affinity.GridAffinityAssignmentCache;
  import org.apache.ignite.internal.processors.cache.CacheAffinityChangeMessage;
 +import org.apache.ignite.internal.processors.cache.CacheGroupDescriptor;
 +import org.apache.ignite.internal.processors.cache.CacheGroupContext;
+ import org.apache.ignite.internal.processors.cache.CacheGroupContext;
  import org.apache.ignite.internal.processors.cache.CacheInvalidStateException;
  import org.apache.ignite.internal.processors.cache.CachePartitionExchangeWorkerTask;
  import org.apache.ignite.internal.processors.cache.ClusterState;

http://git-wip-us.apache.org/repos/asf/ignite/blob/4f69bd02/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
index 2f8a531,f9bc5df..e83c7fc
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java
@@@ -121,15 -102,13 +121,20 @@@ public class GridDhtPartitionsFullMessa
          assert id == null || topVer.equals(id.topologyVersion());
  
          this.topVer = topVer;
 +        this.partHistSuppliers = partHistSuppliers;
 +        this.partsToReload = partsToReload;
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public int handlerId() {
 +        return 0;
      }
  
+     /** {@inheritDoc} */
+     @Override public int handlerId() {
+         return 0;
+     }
+ 
      /**
       * @param compress {@code True} if it is possible to use compression for message.
       */
@@@ -421,24 -357,12 +429,24 @@@
                  writer.incrementState();
  
              case 8:
 +                if (!writer.writeByteArray("partHistSuppliersBytes", partHistSuppliersBytes))
 +                    return false;
 +
 +                writer.incrementState();
 +
-             case 9:
++            case 8:
                  if (!writer.writeByteArray("partsBytes", partsBytes))
                      return false;
  
                  writer.incrementState();
  
-             case 10:
+             case 9:
 +                if (!writer.writeByteArray("partsToReloadBytes", partsToReloadBytes))
 +                    return false;
 +
 +                writer.incrementState();
 +
 +            case 11:
                  if (!writer.writeMessage("topVer", topVer))
                      return false;
  
@@@ -485,14 -409,6 +493,14 @@@
                  reader.incrementState();
  
              case 8:
 +                partHistSuppliersBytes = reader.readByteArray("partHistSuppliersBytes");
 +
 +                if (!reader.isLastRead())
 +                    return false;
 +
 +                reader.incrementState();
 +
-             case 9:
++            case 8:
                  partsBytes = reader.readByteArray("partsBytes");
  
                  if (!reader.isLastRead())
@@@ -500,15 -416,7 +508,15 @@@
  
                  reader.incrementState();
  
-             case 10:
+             case 9:
 +                partsToReloadBytes = reader.readByteArray("partsToReloadBytes");
 +
 +                if (!reader.isLastRead())
 +                    return false;
 +
 +                reader.incrementState();
 +
 +            case 11:
                  topVer = reader.readMessage("topVer");
  
                  if (!reader.isLastRead())

http://git-wip-us.apache.org/repos/asf/ignite/blob/4f69bd02/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
index 1e5ea14,416b127..1b0ff7c
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java
@@@ -380,12 -321,6 +380,12 @@@ public class GridDhtPartitionsSingleMes
                  writer.incrementState();
  
              case 9:
 +                if (!writer.writeByteArray("partHistCntrsBytes", partHistCntrsBytes))
 +                    return false;
 +
 +                writer.incrementState();
 +
-             case 10:
++            case 9:
                  if (!writer.writeByteArray("partsBytes", partsBytes))
                      return false;
  
@@@ -440,14 -375,6 +440,14 @@@
                  reader.incrementState();
  
              case 9:
 +                partHistCntrsBytes = reader.readByteArray("partHistCntrsBytes");
 +
 +                if (!reader.isLastRead())
 +                    return false;
 +
 +                reader.incrementState();
 +
-             case 10:
++            case 9:
                  partsBytes = reader.readByteArray("partsBytes");
  
                  if (!reader.isLastRead())

http://git-wip-us.apache.org/repos/asf/ignite/blob/4f69bd02/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
index 82eafc1,a931ef4..9340678
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
@@@ -220,80 -205,35 +219,82 @@@ public class GridDhtPreloader extends G
                  assert part != null;
                  assert part.id() == p;
  
 -                if (part.state() != MOVING) {
 -                    if (log.isDebugEnabled())
 -                        log.debug("Skipping partition assignment (state is not MOVING):
" + part);
 +                ClusterNode histSupplier = null;
  
 -                    continue; // For.
 +                if (ctx.database().persistenceEnabled()) {
 +                    UUID nodeId = exchFut.partitionHistorySupplier(grp.groupId(), p);
 +
 +                    if (nodeId != null)
 +                        histSupplier = ctx.discovery().node(nodeId);
                  }
  
 -                Collection<ClusterNode> picked = pickedOwners(p, topVer);
 +                if (histSupplier != null) {
 +                    if (part.state() != MOVING) {
 +                        if (log.isDebugEnabled())
 +                            log.debug("Skipping partition assignment (state is not MOVING):
" + part);
 +
 +                        continue; // For.
 +                    }
 +
 +                    assert ctx.database().persistenceEnabled();
 +                    assert remoteOwners(p, topVer).contains(histSupplier) : remoteOwners(p,
topVer);
  
 -                if (picked.isEmpty()) {
 -                    top.own(part);
 +                    GridDhtPartitionDemandMessage msg = assigns.get(histSupplier);
  
 -                    if (grp.eventRecordable(EVT_CACHE_REBALANCE_PART_DATA_LOST)) {
 -                        DiscoveryEvent discoEvt = exchFut.discoveryEvent();
 +                    if (msg == null) {
 +                        assigns.put(histSupplier, msg = new GridDhtPartitionDemandMessage(
 +                            top.updateSequence(),
 +                            exchFut.exchangeId().topologyVersion(),
 +                            grp.groupId()));
 +                    }
 +
 +                    msg.addPartition(p, true);
 +                }
 +                else {
 +                    if (ctx.database().persistenceEnabled()) {
 +                        if (part.state() == RENTING || part.state() == EVICTED) {
 +                            try {
 +                                part.rent(false).get();
 +                            }
 +                            catch (IgniteCheckedException e) {
 +                                U.error(log, "Error while clearing outdated local partition",
e);
 +                            }
 +
 +                            part = top.localPartition(p, topVer, true);
 +
 +                            assert part != null;
 +                        }
 +                    }
 +
 +                    if (part.state() != MOVING) {
 +                        if (log.isDebugEnabled())
 +                            log.debug("Skipping partition assignment (state is not MOVING):
" + part);
 +
 +                        continue; // For.
 +                    }
 +
 +                    Collection<ClusterNode> picked = pickedOwners(p, topVer);
 +
 +                    if (picked.isEmpty()) {
 +                        top.own(part);
 +
 +                        if (grp.eventRecordable(EVT_CACHE_REBALANCE_PART_DATA_LOST)) {
 +                            DiscoveryEvent discoEvt = exchFut.discoveryEvent();
  
                          grp.addRebalanceEvent(p,
-                             EVT_CACHE_REBALANCE_PART_DATA_LOST, discoEvt.eventNode(),
-                             discoEvt.type(), discoEvt.timestamp());
+                             EVT_CACHE_REBALANCE_PART_DATA_LOST,
+                             discoEvt.eventNode(),
+                             discoEvt.type(),
+                             discoEvt.timestamp());
                      }
  
 -                    if (log.isDebugEnabled())
 -                        log.debug("Owning partition as there are no other owners: " + part);
 -                }
 -                else {
 -                    ClusterNode n = F.rand(picked);
 +                        if (log.isDebugEnabled())
 +                            log.debug("Owning partition as there are no other owners: "
+ part);
 +                    }
 +                    else {
 +                        ClusterNode n = F.rand(picked);
  
 -                    GridDhtPartitionDemandMessage msg = assigns.get(n);
 +                        GridDhtPartitionDemandMessage msg = assigns.get(n);
  
                      if (msg == null) {
                          assigns.put(n, msg = new GridDhtPartitionDemandMessage(

http://git-wip-us.apache.org/repos/asf/ignite/blob/4f69bd02/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/4f69bd02/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------


Mime
View raw message