ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject ignite git commit: IGNITETE-5872 - Fixing tests
Date Tue, 08 Aug 2017 09:24:25 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-5872 ee6f76965 -> cfbd3275d


IGNITETE-5872 - Fixing tests


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

Branch: refs/heads/ignite-5872
Commit: cfbd3275d8d760a82a9fc3b7a4a8759bdcedfc4f
Parents: ee6f769
Author: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Authored: Tue Aug 8 12:24:11 2017 +0300
Committer: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Committed: Tue Aug 8 12:24:11 2017 +0300

----------------------------------------------------------------------
 .../cache/GridCachePartitionExchangeManager.java | 19 +++++++++++--------
 .../dht/GridClientPartitionTopology.java         |  2 +-
 .../dht/GridDhtPartitionTopology.java            |  2 +-
 .../dht/GridDhtPartitionTopologyImpl.java        |  6 ++++--
 .../CachePartitionPartialCountersMap.java        | 12 ++++++++++++
 .../GridDhtPartitionsExchangeFuture.java         |  3 ++-
 .../continuous/GridContinuousProcessor.java      |  4 ++--
 .../schema/SchemaIndexCacheVisitorImpl.java      |  7 +++++++
 ...eContinuousQueryFailoverAbstractSelfTest.java |  3 ++-
 .../ignite/testsuites/IgniteBasicTestSuite.java  |  3 +--
 10 files changed, 43 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/cfbd3275/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index 12b313a..27fda14 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@ -670,7 +670,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
 
         CacheGroupDescriptor grpDesc = cctx.cache().cacheGroupDescriptors().get(grpId);
 
-        assert grpDesc != null;
+        assert grpDesc != null: "Failed for exchange: " + exchFut;
 
         CacheConfiguration<?, ?> ccfg = grpDesc.config();
 
@@ -1077,7 +1077,8 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
         GridDhtPartitionsSingleMessage m = createPartitionsSingleMessage(node,
             id,
             cctx.kernalContext().clientNode(),
-            false);
+            false,
+            null);
 
         if (log.isDebugEnabled())
             log.debug("Sending local partitions [nodeId=" + node.id() + ", msg=" + m + ']');
@@ -1102,11 +1103,13 @@ public class GridCachePartitionExchangeManager<K, V> extends
GridCacheSharedMana
      * @param sndCounters {@code True} if need send partition update counters.
      * @return Message.
      */
-    public GridDhtPartitionsSingleMessage createPartitionsSingleMessage(ClusterNode targetNode,
+    public GridDhtPartitionsSingleMessage createPartitionsSingleMessage(
+        ClusterNode targetNode,
         @Nullable GridDhtPartitionExchangeId exchangeId,
         boolean clientOnlyExchange,
-        boolean sndCounters)
-    {
+        boolean sndCounters,
+        ExchangeActions exchActions
+    ) {
         GridDhtPartitionsSingleMessage m = new GridDhtPartitionsSingleMessage(exchangeId,
             clientOnlyExchange,
             cctx.versions().last(),
@@ -1115,7 +1118,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
         Map<Object, T2<Integer, GridPartitionStateMap>> dupData = new HashMap<>();
 
         for (CacheGroupContext grp : cctx.cache().cacheGroups()) {
-            if (!grp.isLocal()) {
+            if (!grp.isLocal() && (exchActions == null || !exchActions.cacheGroupStopping(grp.groupId())))
{
                 GridDhtPartitionMap locMap = grp.topology().localPartitionMap();
 
                 addPartitionMap(m,
@@ -1126,7 +1129,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
                     grp.affinity().similarAffinityKey());
 
                 if (sndCounters)
-                    m.partitionUpdateCounters(grp.groupId(), grp.topology().localUpdateCounters());
+                    m.partitionUpdateCounters(grp.groupId(), grp.topology().localUpdateCounters(true));
             }
         }
 
@@ -1144,7 +1147,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
                 top.similarAffinityKey());
 
             if (sndCounters)
-                m.partitionUpdateCounters(top.groupId(), top.localUpdateCounters());
+                m.partitionUpdateCounters(top.groupId(), top.localUpdateCounters(true));
         }
 
         return m;

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfbd3275/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
index 6448f69..f844e19 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
@@ -1070,7 +1070,7 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology
{
     }
 
     /** {@inheritDoc} */
-    @Override public CachePartitionPartialCountersMap localUpdateCounters() {
+    @Override public CachePartitionPartialCountersMap localUpdateCounters(boolean skipZeros)
{
         return CachePartitionPartialCountersMap.EMPTY;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfbd3275/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
index bab9030..4608977 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
@@ -310,7 +310,7 @@ public interface GridDhtPartitionTopology {
     /**
      * @return Partition update counters.
      */
-    public CachePartitionPartialCountersMap localUpdateCounters();
+    public CachePartitionPartialCountersMap localUpdateCounters(boolean skipZeros);
 
     /**
      * @param part Partition to own.

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfbd3275/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------
diff --git 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
index ff6bf7f..84ae9af 100644
--- 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
@@ -2073,7 +2073,7 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology
{
     }
 
     /** {@inheritDoc} */
-    @Override public CachePartitionPartialCountersMap localUpdateCounters() {
+    @Override public CachePartitionPartialCountersMap localUpdateCounters(boolean skipZeros)
{
         lock.readLock().lock();
 
         try {
@@ -2097,12 +2097,14 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology
{
                 long updCntr = part.updateCounter();
                 long initCntr = part.initialUpdateCounter();
 
-                if (initCntr == 0L && updCntr == 0L)
+                if (skipZeros && initCntr == 0L && updCntr == 0L)
                     continue;
 
                 res.add(part.id(), initCntr, updCntr);
             }
 
+            res.trim();
+
             return res;
         }
         finally {

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfbd3275/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/CachePartitionPartialCountersMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/CachePartitionPartialCountersMap.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/CachePartitionPartialCountersMap.java
index 8cbdc77..851ffed 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/CachePartitionPartialCountersMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/CachePartitionPartialCountersMap.java
@@ -92,6 +92,18 @@ public class CachePartitionPartialCountersMap implements Serializable {
     }
 
     /**
+     * Cuts the array sizes according to curIdx. No more entries can be added to this map
+     * after this method is called.
+     */
+    public void trim() {
+        if (curIdx < partIds.length) {
+            partIds = Arrays.copyOf(partIds, curIdx);
+            initialUpdCntrs = Arrays.copyOf(initialUpdCntrs, curIdx);
+            updCntrs = Arrays.copyOf(updCntrs, curIdx);
+        }
+    }
+
+    /**
      * @param partId Partition ID to search.
      * @return Partition index in the array.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfbd3275/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --git 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
index 53532ab..8530a23 100644
--- 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
@@ -1132,7 +1132,8 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
             msg = cctx.exchange().createPartitionsSingleMessage(node,
                 exchangeId(),
                 false,
-                true);
+                true,
+                exchActions);
         }
 
         Map<Integer, Map<Integer, Long>> partHistReserved0 = partHistReserved;

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfbd3275/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
index be958c7..fa52be2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
@@ -204,7 +204,7 @@ public class GridContinuousProcessor extends GridProcessorAdapter {
 
                                 if (cctx != null && cntrsPerNode != null &&
!cctx.isLocal() && cctx.affinityNode())
                                     cntrsPerNode.put(ctx.localNodeId(),
-                                        toCountersMap(cctx.topology().localUpdateCounters()));
+                                        toCountersMap(cctx.topology().localUpdateCounters(false)));
 
                                 routine.handler().updateCounters(topVer, cntrsPerNode, cntrs);
                             }
@@ -1073,7 +1073,7 @@ public class GridContinuousProcessor extends GridProcessorAdapter {
 
                 if (cache != null && !cache.isLocal() && cache.context().userCache())
                     req.addUpdateCounters(ctx.localNodeId(),
-                        toCountersMap(cache.context().topology().localUpdateCounters()));
+                        toCountersMap(cache.context().topology().localUpdateCounters(false)));
             }
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfbd3275/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorImpl.java
index 3a445bf..4e50f64 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorImpl.java
@@ -24,6 +24,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheContext;
 import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
 import org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtInvalidPartitionException;
 import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter;
@@ -118,6 +119,9 @@ public class SchemaIndexCacheVisitorImpl implements SchemaIndexCacheVisitor
{
                 KeyCacheObject key = row.key();
 
                 processKey(key, row.link(), clo);
+
+                if (part.state() == RENTING)
+                    break;
             }
         }
         finally {
@@ -149,6 +153,9 @@ public class SchemaIndexCacheVisitorImpl implements SchemaIndexCacheVisitor
{
 
                 break;
             }
+            catch (GridDhtInvalidPartitionException ignore) {
+                break;
+            }
             catch (GridCacheEntryRemovedException ignored) {
                 // No-op.
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfbd3275/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
index 39c31ad..f91c689 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
@@ -520,7 +520,8 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends
GridC
 
             Affinity<Object> aff = grid(i).affinity(DEFAULT_CACHE_NAME);
 
-            CachePartitionPartialCountersMap act = grid(i).cachex(DEFAULT_CACHE_NAME).context().topology().localUpdateCounters();
+            CachePartitionPartialCountersMap act = grid(i).cachex(DEFAULT_CACHE_NAME).context().topology()
+                .localUpdateCounters(false);
 
             for (Map.Entry<Integer, Long> e : updCntrs.entrySet()) {
                 if (aff.mapPartitionToPrimaryAndBackups(e.getKey()).contains(grid(i).localNode()))
{

http://git-wip-us.apache.org/repos/asf/ignite/blob/cfbd3275/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
index 2ec2c74..202486c 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
@@ -20,8 +20,6 @@ package org.apache.ignite.testsuites;
 import java.util.Set;
 import junit.framework.TestSuite;
 import org.apache.ignite.GridSuppressedExceptionSelfTest;
-import org.apache.ignite.internal.processors.database.SwapPathConstructionSelfTest;
-import org.apache.ignite.util.AttributeNodeFilterSelfTest;
 import org.apache.ignite.internal.ClusterGroupHostsSelfTest;
 import org.apache.ignite.internal.ClusterGroupSelfTest;
 import org.apache.ignite.internal.GridFailFastNodeFailureDetectionSelfTest;
@@ -57,6 +55,7 @@ import org.apache.ignite.internal.processors.database.BPlusTreeSelfTest;
 import org.apache.ignite.internal.processors.database.FreeListImplSelfTest;
 import org.apache.ignite.internal.processors.database.MemoryMetricsSelfTest;
 import org.apache.ignite.internal.processors.database.MetadataStorageSelfTest;
+import org.apache.ignite.internal.processors.database.SwapPathConstructionSelfTest;
 import org.apache.ignite.internal.processors.odbc.OdbcConfigurationValidationSelfTest;
 import org.apache.ignite.internal.processors.odbc.OdbcEscapeSequenceSelfTest;
 import org.apache.ignite.internal.processors.service.ClosureServiceClientsNodesTest;


Mime
View raw message