diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/AffinityServiceImpl.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/AffinityServiceImpl.java index 14719573b1dca..cbe936dbff02d 100644 --- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/AffinityServiceImpl.java +++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/AffinityServiceImpl.java @@ -56,8 +56,8 @@ public void cacheSharedContext(GridCacheSharedContext cacheSharedContext) if (cacheId == CU.UNDEFINED_CACHE_ID) return k -> k == null ? 0 : U.safeAbs(k.hashCode()); - AffinityFunction affinity = cacheSharedContext.cacheContext(cacheId).group().affinityFunction(); + AffinityFunction aff = cacheSharedContext.cacheContext(cacheId).group().affinityFunction(); - return affinity::partition; + return aff::partition; } } diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/trait/DistributionFunction.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/trait/DistributionFunction.java index 4191ef9083e82..d5368e39d2b6b 100644 --- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/trait/DistributionFunction.java +++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/trait/DistributionFunction.java @@ -261,10 +261,10 @@ private static final class HashDistribution extends DistributionFunction { assert F.isEmpty(assignment) || assignment.size() == 1; } - AffinityAdapter affinity = new AffinityAdapter<>(affSrvc.affinity(CU.UNDEFINED_CACHE_ID), k.toIntArray(), + AffinityAdapter aff = new AffinityAdapter<>(affSrvc.affinity(CU.UNDEFINED_CACHE_ID), k.toIntArray(), ctx.rowHandler()); - return new Partitioned<>(assignments, affinity); + return new Partitioned<>(assignments, aff); } } @@ -312,9 +312,9 @@ public AffinityDistribution(int cacheId, Object identity) { assert F.isEmpty(assignment) || assignment.size() == 1; } - AffinityAdapter affinity = new AffinityAdapter<>(affSrvc.affinity(cacheId), k.toIntArray(), ctx.rowHandler()); + AffinityAdapter aff = new AffinityAdapter<>(affSrvc.affinity(cacheId), k.toIntArray(), ctx.rowHandler()); - return new Partitioned<>(assignments, affinity); + return new Partitioned<>(assignments, aff); } /** {@inheritDoc} */ diff --git a/modules/checkstyle/src/main/resources/abbrevations.csv b/modules/checkstyle/src/main/resources/abbrevations.csv index 82840f6518b29..8d62828d91231 100644 --- a/modules/checkstyle/src/main/resources/abbrevations.csv +++ b/modules/checkstyle/src/main/resources/abbrevations.csv @@ -1,7 +1,7 @@ # First word is wrong full term, other is correct abbrevations to build helpfull error message. address,addr addresses,addrs -#affinity,aff +affinity,aff #argument,arg array,arr #attribute,attr diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinPartitionAwarenessReconnectionAndFailoverSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinPartitionAwarenessReconnectionAndFailoverSelfTest.java index e01e2909be3fb..d440561159e11 100644 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinPartitionAwarenessReconnectionAndFailoverSelfTest.java +++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinPartitionAwarenessReconnectionAndFailoverSelfTest.java @@ -424,12 +424,12 @@ public void testQueryFailover() throws Exception { stmt.execute(sql); stmt.execute(sql); - AffinityCache affinityCache = GridTestUtils.getFieldValue(conn, "affinityCache"); + AffinityCache affCache = GridTestUtils.getFieldValue(conn, "affinityCache"); - Integer part = ((PartitionSingleNode)affinityCache.partitionResult( + Integer part = ((PartitionSingleNode)affCache.partitionResult( new QualifiedSQLQuery("PUBLIC", sql)).partitionResult().tree()).value(); - UUID nodeId = affinityCache.cacheDistribution(GridCacheUtils.cacheId(cacheName))[part]; + UUID nodeId = affCache.cacheDistribution(GridCacheUtils.cacheId(cacheName))[part]; int gridIdx = new Integer(Ignition.ignite(nodeId).name().substring(getTestIgniteInstanceName().length())); stopGrid(gridIdx); diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinPartitionAwarenessSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinPartitionAwarenessSelfTest.java index 7dfe06128e390..c2752fca63222 100644 --- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinPartitionAwarenessSelfTest.java +++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinPartitionAwarenessSelfTest.java @@ -368,15 +368,15 @@ public void testChangeTopologyDetectionWithinPartitionDistributionResponse() thr stmt.executeQuery(sqlQry); - AffinityCache affinityCache = GridTestUtils.getFieldValue(conn, "affinityCache"); + AffinityCache affCache = GridTestUtils.getFieldValue(conn, "affinityCache"); startGrid(3); stmt.executeQuery(sqlQry); - AffinityCache recreatedAffinityCache = GridTestUtils.getFieldValue(conn, "affinityCache"); + AffinityCache recreatedAffCache = GridTestUtils.getFieldValue(conn, "affinityCache"); - assertTrue(recreatedAffinityCache.version().compareTo(affinityCache.version()) > 0); + assertTrue(recreatedAffCache.version().compareTo(affCache.version()) > 0); } /** @@ -392,15 +392,15 @@ public void testChangeTopologyDetectionWithinQueryExecutionResponse() throws Exc stmt.executeQuery(sqlQry); stmt.executeQuery(sqlQry); - AffinityCache affinityCache = GridTestUtils.getFieldValue(conn, "affinityCache"); + AffinityCache affCache = GridTestUtils.getFieldValue(conn, "affinityCache"); startGrid(4); stmt.executeQuery("select * from Person where _key = 2"); - AffinityCache recreatedAffinityCache = GridTestUtils.getFieldValue(conn, "affinityCache"); + AffinityCache recreatedAffCache = GridTestUtils.getFieldValue(conn, "affinityCache"); - assertTrue(recreatedAffinityCache.version().compareTo(affinityCache.version()) > 0); + assertTrue(recreatedAffCache.version().compareTo(affCache.version()) > 0); } /** @@ -415,15 +415,15 @@ public void testChangeTopologyDetectionWithinPartitionAwarenessUnrelatedQuery() ResultSet rs = stmt.executeQuery(sqlQry); - AffinityCache affinityCache = GridTestUtils.getFieldValue(conn, "affinityCache"); + AffinityCache affCache = GridTestUtils.getFieldValue(conn, "affinityCache"); startGrid(5); rs.getMetaData(); - AffinityCache recreatedAffinityCache = GridTestUtils.getFieldValue(conn, "affinityCache"); + AffinityCache recreatedAffCache = GridTestUtils.getFieldValue(conn, "affinityCache"); - assertTrue(recreatedAffinityCache.version().compareTo(affinityCache.version()) > 0); + assertTrue(recreatedAffCache.version().compareTo(affCache.version()) > 0); } /** @@ -445,9 +445,9 @@ public void testPartitionAwarenessIsSkippedIfItIsSwitchedOff() throws Exception stmt.executeQuery("select * from \"" + cacheName + "\".Person where _key = 1"); - AffinityCache affinityCache = GridTestUtils.getFieldValue(conn, "affinityCache"); + AffinityCache affCache = GridTestUtils.getFieldValue(conn, "affinityCache"); - assertNull("Affinity cache is not null.", affinityCache); + assertNull("Affinity cache is not null.", affCache); } } @@ -470,9 +470,9 @@ public void testPartitionAwarenessIsSkippedByDefault() throws Exception { stmt.executeQuery("select * from \"" + cacheName + "\".Person where _key = 1"); - AffinityCache affinityCache = GridTestUtils.getFieldValue(conn, "affinityCache"); + AffinityCache affCache = GridTestUtils.getFieldValue(conn, "affinityCache"); - assertNull("Affinity cache is not null.", affinityCache); + assertNull("Affinity cache is not null.", affCache); } } @@ -500,10 +500,10 @@ public void testAffinityCacheStoresSchemaBindedQueries() throws Exception { stmt.execute("select * from \"" + cacheName.toUpperCase() + "\".Person where _key = 1"); - AffinityCache affinityCache = GridTestUtils.getFieldValue(conn, "affinityCache"); + AffinityCache affCache = GridTestUtils.getFieldValue(conn, "affinityCache"); GridBoundedLinkedHashMap sqlCache = - GridTestUtils.getFieldValue(affinityCache, "sqlCache"); + GridTestUtils.getFieldValue(affCache, "sqlCache"); Set schemas = sqlCache.keySet().stream().map(QualifiedSQLQuery::schemaName).collect(Collectors.toSet()); @@ -534,13 +534,13 @@ public void testAffinityCacheCompactsPartitionDistributions() throws Exception { stmt.execute("select * from \"" + cacheName + "\".Person where _key = 2"); stmt.execute("select * from \"" + cacheName + "\".Person where _key = 2"); - AffinityCache affinityCache = GridTestUtils.getFieldValue(conn, "affinityCache"); + AffinityCache affCache = GridTestUtils.getFieldValue(conn, "affinityCache"); GridBoundedLinkedHashMap sqlCache = - GridTestUtils.getFieldValue(affinityCache, "sqlCache"); + GridTestUtils.getFieldValue(affCache, "sqlCache"); GridBoundedLinkedHashMap cachePartitionsDistribution = - GridTestUtils.getFieldValue(affinityCache, "cachePartitionsDistribution"); + GridTestUtils.getFieldValue(affCache, "cachePartitionsDistribution"); assertEquals("Sql sub-cache of affinity cache has unexpected number of elements.", 2, sqlCache.size()); @@ -588,13 +588,13 @@ public void testPartitionAwarenessLimitedCacheSize() throws Exception { stmt.executeQuery("select * from \"" + cacheName2 + "\".Person where _key = 1"); stmt.executeQuery("select * from \"" + cacheName2 + "\".Person where _key = 1"); - AffinityCache affinityCache = GridTestUtils.getFieldValue(conn, "affinityCache"); + AffinityCache affCache = GridTestUtils.getFieldValue(conn, "affinityCache"); GridBoundedLinkedHashMap partitionsDistributionCache = - GridTestUtils.getFieldValue(affinityCache, "cachePartitionsDistribution"); + GridTestUtils.getFieldValue(affCache, "cachePartitionsDistribution"); GridBoundedLinkedHashMap sqlCache = - GridTestUtils.getFieldValue(affinityCache, "sqlCache"); + GridTestUtils.getFieldValue(affCache, "sqlCache"); assertEquals("Unexpected count of partitions distributions.", 1, partitionsDistributionCache.size()); @@ -650,9 +650,9 @@ protected void verifyPartitionResultIsNull(String sqlQry, int expRowsCnt) throws assertEquals("Rows counter doesn't match expected value.", expRowsCnt, rowCntr); - AffinityCache affinityCache = GridTestUtils.getFieldValue(conn, "affinityCache"); + AffinityCache affCache = GridTestUtils.getFieldValue(conn, "affinityCache"); - PartitionResult gotPartRes = affinityCache.partitionResult( + PartitionResult gotPartRes = affCache.partitionResult( new QualifiedSQLQuery("default", sqlQry)).partitionResult(); assertNull("Partition result descriptor is not null.", gotPartRes); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/GridClientAbstractProjection.java b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/GridClientAbstractProjection.java index 8ae8cce21b9b1..48c56b5448a7f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/GridClientAbstractProjection.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/GridClientAbstractProjection.java @@ -178,10 +178,10 @@ protected GridClientFuture withReconnectHandling(ClientProjectionClosure< */ protected GridClientFuture withReconnectHandling(ClientProjectionClosure c, String cacheName, @Nullable Object affKey) { - GridClientDataAffinity affinity = client.affinity(cacheName); + GridClientDataAffinity aff = client.affinity(cacheName); // If pinned (fixed-nodes) or no affinity provided use balancer. - if (nodes != null || affinity == null || affKey == null) + if (nodes != null || aff == null || affKey == null) return withReconnectHandling(c); try { @@ -191,7 +191,7 @@ protected GridClientFuture withReconnectHandling(ClientProjectionClosure< throw new GridServerUnreachableException("Failed to get affinity node (no nodes in topology were " + "accepted by the filter): " + filter); - GridClientNode node = affinity.node(affKey, prjNodes); + GridClientNode node = aff.node(affKey, prjNodes); for (int i = 0; i < RETRY_CNT; i++) { GridClientConnection conn = null; diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/GridClientDataImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/GridClientDataImpl.java index 06572616635ce..a2eaa13776672 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/GridClientDataImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/GridClientDataImpl.java @@ -259,9 +259,9 @@ public class GridClientDataImpl extends GridClientAbstractProjection UUID affinity(K key) throws GridClientException { A.notNull(key, "key"); - GridClientDataAffinity affinity = client.affinity(cacheName); + GridClientDataAffinity aff = client.affinity(cacheName); - if (affinity == null) + if (aff == null) return null; Collection prj = projectionNodes(); @@ -270,7 +270,7 @@ public class GridClientDataImpl extends GridClientAbstractProjection entry : overallCaches.entrySet()) { - GridClientDataAffinity affinity = affinity(entry.getKey()); + GridClientDataAffinity aff = affinity(entry.getKey()); - if (affinity instanceof GridClientPartitionAffinity && entry.getValue() != + if (aff instanceof GridClientPartitionAffinity && entry.getValue() != GridClientCacheMode.PARTITIONED) log.warning(GridClientPartitionAffinity.class.getSimpleName() + " is used for a cache configured " + "for non-partitioned mode [cacheName=" + entry.getKey() + ", cacheMode=" + entry.getValue() + ']'); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientCacheAffinityMapping.java b/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientCacheAffinityMapping.java index b0e47e0b59435..69e2ba18b6ca2 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientCacheAffinityMapping.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientCacheAffinityMapping.java @@ -84,17 +84,17 @@ public Collection cacheIds() { * @return Affinity node id or {@code null} if affinity node can't be determined for given cache and key. */ public UUID affinityNode(IgniteBinary binary, int cacheId, Object key) { - CacheAffinityInfo affinityInfo = cacheAffinity.get(cacheId); + CacheAffinityInfo affInfo = cacheAffinity.get(cacheId); - if (affinityInfo == null || affinityInfo == NOT_APPLICABLE_CACHE_AFFINITY_INFO) + if (affInfo == null || affInfo == NOT_APPLICABLE_CACHE_AFFINITY_INFO) return null; Object binaryKey = binary.toBinary(key); - if (!affinityInfo.keyCfg.isEmpty()) { + if (!affInfo.keyCfg.isEmpty()) { int typeId = binary.typeId(key.getClass().getName()); - Integer fieldId = affinityInfo.keyCfg.get(typeId); + Integer fieldId = affInfo.keyCfg.get(typeId); if (fieldId != null) { if (binaryKey instanceof BinaryObjectExImpl) @@ -104,7 +104,7 @@ public UUID affinityNode(IgniteBinary binary, int cacheId, Object key) { } } - return affinityInfo.nodeForKey(binaryKey); + return affInfo.nodeForKey(binaryKey); } /** diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientIgniteSetImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientIgniteSetImpl.java index 2d451b477c11a..71195d14f2bae 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientIgniteSetImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientIgniteSetImpl.java @@ -140,9 +140,9 @@ public ClientIgniteSetImpl( }; if (colocated) { - Object affinityKey = name.hashCode(); + Object affKey = name.hashCode(); - return ch.affinityService(cacheId, affinityKey, ClientOperation.OP_SET_ITERATOR_START, payloadWriter, payloadReader); + return ch.affinityService(cacheId, affKey, ClientOperation.OP_SET_ITERATOR_START, payloadWriter, payloadReader); } return ch.service(ClientOperation.OP_SET_ITERATOR_START, payloadWriter, payloadReader); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinConnection.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinConnection.java index 737cbebb80fb1..562c53a280f1d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinConnection.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinConnection.java @@ -1162,15 +1162,15 @@ private UUID[] retrieveCacheDistribution(int cacheId, int partCnt) throws IOExce assert res.status() == ClientListenerResponse.STATUS_SUCCESS; - AffinityTopologyVersion resAffinityVer = res.affinityVersion(); + AffinityTopologyVersion resAffVer = res.affinityVersion(); - if (affinityCache.version().compareTo(resAffinityVer) < 0) { + if (affinityCache.version().compareTo(resAffVer) < 0) { affinityCache = new AffinityCache( - resAffinityVer, + resAffVer, connProps.getPartitionAwarenessPartitionDistributionsCacheSize(), connProps.getPartitionAwarenessSqlCacheSize()); } - else if (affinityCache.version().compareTo(resAffinityVer) > 0) { + else if (affinityCache.version().compareTo(resAffVer) > 0) { // Jdbc thin affinity cache is binded to the newer affinity topology version, so we should ignore retrieved // partition distribution. Given situation might occur in case of concurrent race and is not // possible in single-threaded jdbc thin client, so it's a reserve for the future. diff --git a/modules/core/src/main/java/org/apache/ignite/internal/management/cache/CacheListCommand.java b/modules/core/src/main/java/org/apache/ignite/internal/management/cache/CacheListCommand.java index 9b8f692b7943d..f76c4a258a664 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/management/cache/CacheListCommand.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/management/cache/CacheListCommand.java @@ -192,7 +192,7 @@ private void printCachesConfig( private static Map mapToPairs(CacheConfiguration cfg) { Map params = new LinkedHashMap<>(); - CacheAffinityConfiguration affinityCfg = cfg.getAffinityConfiguration(); + CacheAffinityConfiguration affCfg = cfg.getAffinityConfiguration(); CacheNearConfiguration nearCfg = cfg.getNearConfiguration(); CacheRebalanceConfiguration rebalanceCfg = cfg.getRebalanceConfiguration(); CacheEvictionConfiguration evictCfg = cfg.getEvictionConfiguration(); @@ -225,11 +225,11 @@ private static Map mapToPairs(CacheConfiguration cfg) { params.put("Write Synchronization Mode", cfg.getWriteSynchronizationMode()); params.put("Invalidate", cfg.isInvalidate()); - params.put("Affinity Function", affinityCfg.getFunction()); - params.put("Affinity Backups", affinityCfg.getPartitionedBackups()); - params.put("Affinity Partitions", affinityCfg.getPartitions()); - params.put("Affinity Exclude Neighbors", affinityCfg.isExcludeNeighbors()); - params.put("Affinity Mapper", affinityCfg.getMapper()); + params.put("Affinity Function", affCfg.getFunction()); + params.put("Affinity Backups", affCfg.getPartitionedBackups()); + params.put("Affinity Partitions", affCfg.getPartitions()); + params.put("Affinity Exclude Neighbors", affCfg.isExcludeNeighbors()); + params.put("Affinity Mapper", affCfg.getMapper()); params.put("Rebalance Mode", rebalanceCfg.getMode()); params.put("Rebalance Batch Size", rebalanceCfg.getBatchSize()); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java index e5628392f2e5c..0806b7f4a7543 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java @@ -367,9 +367,9 @@ public IdealAffinityAssignment calculate( boolean skipCalculation = true; for (DiscoveryEvent event : events.events()) { - boolean affinityNode = CU.affinityNode(event.eventNode(), nodeFilter); + boolean affNode = CU.affinityNode(event.eventNode(), nodeFilter); - if (affinityNode || event.type() == EVT_DISCOVERY_CUSTOM_EVT) { + if (affNode || event.type() == EVT_DISCOVERY_CUSTOM_EVT) { skipCalculation = false; break; @@ -465,17 +465,17 @@ private void recalculateBaselineAssignment( List sorted, BaselineTopology blt ) { - List baselineAffinityNodes = blt.createBaselineView(sorted, nodeFilter); + List baselineAffNodes = blt.createBaselineView(sorted, nodeFilter); List> calculated = aff.assignPartitions(new GridAffinityFunctionContextImpl( - baselineAffinityNodes, + baselineAffNodes, prevAssignment != null ? prevAssignment.assignment() : null, events != null ? events.lastEvent() : null, topVer, backups )); - baselineAssignment = IdealAffinityAssignment.create(topVer, baselineAffinityNodes, calculated); + baselineAssignment = IdealAffinityAssignment.create(topVer, baselineAffNodes, calculated); } /** diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/IdealAffinityAssignment.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/IdealAffinityAssignment.java index 58fb3415cbdca..80a2be229b572 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/IdealAffinityAssignment.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/IdealAffinityAssignment.java @@ -99,10 +99,10 @@ public static Map> calculatePrimaries( Map> primaryPartitions = U.newHashMap(nodesSize); for (int size = assignment.size(), p = 0; p < size; p++) { - List affinityNodes = assignment.get(p); + List affNodes = assignment.get(p); - if (!affinityNodes.isEmpty()) { - ClusterNode primary = affinityNodes.get(0); + if (!affNodes.isEmpty()) { + ClusterNode primary = affNodes.get(0); primaryPartitions.computeIfAbsent(primary.consistentId(), id -> new HashSet<>(U.capacity(size / nodesSize * 2))).add(p); diff --git 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 index ca76782b125f6..94e880b0755d3 100644 --- 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 @@ -1283,10 +1283,10 @@ private void processAffinityAssignmentResponse(UUID nodeId, GridDhtAffinityAssig * @param c Cache closure. */ private void forAllRegisteredCacheGroups(IgniteInClosureX c) { - Collection affinityCaches = new ArrayList<>(cachesRegistry.allGroups().values()); + Collection affCaches = new ArrayList<>(cachesRegistry.allGroups().values()); try { - U.doInParallel(cctx.kernalContext().pools().getSystemExecutorService(), affinityCaches, t -> { + U.doInParallel(cctx.kernalContext().pools().getSystemExecutorService(), affCaches, t -> { c.applyx(t); return null; @@ -1301,12 +1301,12 @@ private void forAllRegisteredCacheGroups(IgniteInClosureX * @param c Closure. */ private void forAllCacheGroups(IgniteInClosureX c) { - Collection affinityCaches = grpHolders.values().stream() + Collection affCaches = grpHolders.values().stream() .map(CacheGroupHolder::affinity) .collect(Collectors.toList()); try { - U.doInParallel(cctx.kernalContext().pools().getSystemExecutorService(), affinityCaches, t -> { + U.doInParallel(cctx.kernalContext().pools().getSystemExecutorService(), affCaches, t -> { c.applyx(t); return null; @@ -1517,7 +1517,7 @@ public Set onLocalJoin( // Such cache group may exist if cache is already destroyed on server nodes // and coordinator have no affinity for that group. - final Set noAffinityGroups = new GridConcurrentHashSet<>(); + final Set noAffGroups = new GridConcurrentHashSet<>(); forAllRegisteredCacheGroups(new IgniteInClosureX() { @Override public void applyx(CacheGroupDescriptor desc) throws IgniteCheckedException { @@ -1535,7 +1535,7 @@ public Set onLocalJoin( CacheGroupAffinityMessage affMsg = receivedAff.get(aff.groupId()); if (affMsg == null) { - noAffinityGroups.add(aff.groupId()); + noAffGroups.add(aff.groupId()); // Use ideal affinity to resume cache initialize process. calculateAndInit(evts, aff, evts.topologyVersion()); @@ -1573,7 +1573,7 @@ else if (grp != null && fut.cacheGroupAddedOnExchange(aff.groupId(), grp.receive } }); - return noAffinityGroups; + return noAffGroups; } /** @@ -1988,7 +1988,7 @@ public IgniteInternalFuture initCoordinatorCaches( assert idx >= 0 && idx < exchFuts.size() - 1 : "Invalid exchange futures state [cur=" + idx + ", total=" + exchFuts.size() + ']'; - GridDhtPartitionsExchangeFuture futureToFetchAffinity = null; + GridDhtPartitionsExchangeFuture futureToFetchAff = null; for (int i = idx + 1; i < exchFuts.size(); i++) { GridDhtPartitionsExchangeFuture prev = exchFuts.get(i); @@ -1998,32 +1998,32 @@ public IgniteInternalFuture initCoordinatorCaches( if (prev.isMerged()) continue; - futureToFetchAffinity = prev; + futureToFetchAff = prev; break; } - if (futureToFetchAffinity == null) + if (futureToFetchAff == null) throw new IgniteCheckedException("Failed to find completed exchange future to fetch affinity."); if (log.isDebugEnabled()) { log.debug("Need initialize affinity on coordinator [" + "cacheGrp=" + desc.cacheOrGroupName() + - "prevAff=" + futureToFetchAffinity.topologyVersion() + ']'); + "prevAff=" + futureToFetchAff.topologyVersion() + ']'); } GridDhtAssignmentFetchFuture fetchFut = new GridDhtAssignmentFetchFuture( cctx, desc.groupId(), - futureToFetchAffinity.topologyVersion(), - futureToFetchAffinity.events().discoveryCache() + futureToFetchAff.topologyVersion(), + futureToFetchAff.events().discoveryCache() ); fetchFut.init(false); final GridFutureAdapter affFut = new GridFutureAdapter<>(); - final GridDhtPartitionsExchangeFuture futureToFetchAffinity0 = futureToFetchAffinity; + final GridDhtPartitionsExchangeFuture futureToFetchAffinity0 = futureToFetchAff; fetchFut.listen(new IgniteInClosureX>() { @Override public void applyx(IgniteInternalFuture fetchFut) diff --git 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 index ce42781f7968f..2187b5caae392 100644 --- 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 @@ -5492,9 +5492,9 @@ private class CacheRecoveryLifecycle implements MetastorageLifecycleListener, Da DetachedClusterNode clusterNode = new DetachedClusterNode(consistentId, ctx.nodeAttributes()); for (DynamicCacheDescriptor cacheDescriptor : persistentCaches()) { - boolean affinityNode = CU.affinityNode(clusterNode, cacheDescriptor.cacheConfiguration().getNodeFilter()); + boolean affNode = CU.affinityNode(clusterNode, cacheDescriptor.cacheConfiguration().getNodeFilter()); - if (!affinityNode) + if (!affNode) continue; startCacheInRecoveryMode(cacheDescriptor); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java index 8878d158e7935..7f988d36cabd0 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java @@ -1637,27 +1637,27 @@ public static void validateKeyConfigiration( IgniteLogger log, boolean fail ) throws IgniteCheckedException { - Map rmtAffinityKeys = CU.validateKeyConfigiration(groupName, cacheName, rmtCacheKeyCfgs, log, fail); + Map rmtAffKeys = CU.validateKeyConfigiration(groupName, cacheName, rmtCacheKeyCfgs, log, fail); - Map locAffinityKey = CU.validateKeyConfigiration(groupName, cacheName, locCacheKeyCfgs, log, fail); + Map locAffKey = CU.validateKeyConfigiration(groupName, cacheName, locCacheKeyCfgs, log, fail); - if (rmtAffinityKeys.size() != locAffinityKey.size()) { + if (rmtAffKeys.size() != locAffKey.size()) { throwIgniteCheckedException(log, fail, "Affinity key configuration mismatch" + "[" + (groupName != null ? "cacheGroup=" + groupName + ", " : "") + "cacheName=" + cacheName + ", " + - "remote keyConfiguration.length=" + rmtAffinityKeys.size() + ", " + - "local keyConfiguration.length=" + locAffinityKey.size() + + "remote keyConfiguration.length=" + rmtAffKeys.size() + ", " + + "local keyConfiguration.length=" + locAffKey.size() + (rmtNodeId != null ? ", rmtNodeId=" + rmtNodeId : "") + ']'); } - for (Map.Entry rmtAffinityKey : rmtAffinityKeys.entrySet()) { - String rmtTypeName = rmtAffinityKey.getKey(); + for (Map.Entry rmtAffKey : rmtAffKeys.entrySet()) { + String rmtTypeName = rmtAffKey.getKey(); - String rmtFieldName = rmtAffinityKey.getValue(); + String rmtFieldName = rmtAffKey.getValue(); - String locFieldName = locAffinityKey.get(rmtTypeName); + String locFieldName = locAffKey.get(rmtTypeName); if (!rmtFieldName.equals(locFieldName)) { throwIgniteCheckedException(log, fail, "Affinity key configuration mismatch [" + 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 81687c2415059..b6f2c727d440f 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 @@ -2225,7 +2225,7 @@ private void sendAllPartitions( } // Find any single message with affinity request. This request exists only for newly joined nodes. - Optional singleMsgWithAffinityReq = nodes.stream() + Optional singleMsgWithAffReq = nodes.stream() .flatMap(node -> Optional.ofNullable(msgs.get(node.id())) .filter(singleMsg -> singleMsg.cacheGroupsAffinityRequest() != null) .map(Stream::of) @@ -2233,7 +2233,7 @@ private void sendAllPartitions( .findAny(); // Prepare full message for newly joined nodes with affinity request. - final GridDhtPartitionsFullMessage fullMsgWithAffinity = singleMsgWithAffinityReq + final GridDhtPartitionsFullMessage fullMsgWithAff = singleMsgWithAffReq .filter(singleMessage -> affinityForJoinedNodes != null) .map(singleMessage -> fullMsg.copy().joinedNodeAffinity(affinityForJoinedNodes)) .orElse(null); @@ -2242,7 +2242,7 @@ private void sendAllPartitions( nodes.stream() .map(node -> { // No joined nodes, just send a regular full message. - if (fullMsgWithAffinity == null) + if (fullMsgWithAff == null) return new T2<>(node, fullMsg); return new T2<>( @@ -2250,7 +2250,7 @@ private void sendAllPartitions( // If single message contains affinity request, use special full message for such single messages. Optional.ofNullable(msgs.get(node.id())) .filter(singleMsg -> singleMsg.cacheGroupsAffinityRequest() != null) - .map(singleMsg -> fullMsgWithAffinity) + .map(singleMsg -> fullMsgWithAff) .orElse(fullMsg) ); }) @@ -4676,11 +4676,11 @@ private void processFullMessage(boolean checkCrd, ClusterNode node, GridDhtParti exchCtx.events().processEvents(this); if (localJoinExchange()) { - Set noAffinityGroups = cctx.affinity().onLocalJoin(this, msg.joinedNodeAffinity(), resTopVer); + Set noAffGroups = cctx.affinity().onLocalJoin(this, msg.joinedNodeAffinity(), resTopVer); // Prevent cache usage by a user. - if (!noAffinityGroups.isEmpty()) { - List closedCaches = cctx.cache().blockGateways(noAffinityGroups); + if (!noAffGroups.isEmpty()) { + List closedCaches = cctx.cache().blockGateways(noAffGroups); closedCaches.forEach(cache -> log.warning("Affinity for cache " + cache.context().name() + " has not received from coordinator during local join. " diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcResponse.java index 01347de710b98..4a941a6ffd278 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcResponse.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcResponse.java @@ -159,9 +159,9 @@ public void activeTransaction(boolean activeTx) { if (protoCtx.isAffinityAwarenessSupported()) { activeTx = reader.readBoolean(); - boolean affinityVerChanged = reader.readBoolean(); + boolean affVerChanged = reader.readBoolean(); - if (affinityVerChanged) { + if (affVerChanged) { long topVer = reader.readLong(); int minorTopVer = reader.readInt(); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientAffinityTopologyVersion.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientAffinityTopologyVersion.java index 446238bc875a5..4c1587082d291 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientAffinityTopologyVersion.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientAffinityTopologyVersion.java @@ -61,10 +61,10 @@ public AffinityTopologyVersion getVersion() { * @param writer Writer. */ public void write(BinaryRawWriter writer) { - AffinityTopologyVersion affinityVer0 = version; + AffinityTopologyVersion affVer0 = version; - writer.writeLong(affinityVer0.topologyVersion()); - writer.writeInt(affinityVer0.minorTopologyVersion()); + writer.writeLong(affVer0.topologyVersion()); + writer.writeInt(affVer0.minorTopologyVersion()); } /** {@inheritDoc} */ diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCachePartitionAwarenessGroup.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCachePartitionAwarenessGroup.java index a5bc57c8c269f..6ce5e43e0375c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCachePartitionAwarenessGroup.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCachePartitionAwarenessGroup.java @@ -110,10 +110,10 @@ private static void writeCacheKeyConfiguration( for (CacheKeyConfiguration keyCfg : keyCfgs) { int keyTypeId = binProc.typeId(keyCfg.getTypeName()); - int affinityKeyFieldId = binProc.binaryContext().fieldId(keyTypeId, keyCfg.getAffinityKeyFieldName()); + int affKeyFieldId = binProc.binaryContext().fieldId(keyTypeId, keyCfg.getAffinityKeyFieldName()); writer.writeInt(keyTypeId); - writer.writeInt(affinityKeyFieldId); + writer.writeInt(affKeyFieldId); } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCachePartitionsRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCachePartitionsRequest.java index 44c8dfe265bfe..228c0f32361e2 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCachePartitionsRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCachePartitionsRequest.java @@ -85,7 +85,7 @@ public ClientCachePartitionsRequest(BinaryRawReader reader, ClientProtocolContex return new ClientResponse(requestId(), "Cannot perform cache operation because the cluster is inactive."); Map grps = new HashMap<>(cacheIds.length); - ClientAffinityTopologyVersion affinityVer = ctx.checkAffinityTopologyVersion(); + ClientAffinityTopologyVersion affVer = ctx.checkAffinityTopologyVersion(); Set affectedGroupIds = Arrays.stream(cacheIds) .mapToObj(id -> ctx.kernalContext().cache().cacheDescriptor(id)) @@ -102,7 +102,7 @@ public ClientCachePartitionsRequest(BinaryRawReader reader, ClientProtocolContex // As a first step, get a set of mappings that we need to return. // To do that, check if any of the caches listed in request can be grouped. for (List affected : F.view(allCaches, affectedGroupIds::contains).values()) { - ClientCachePartitionAwarenessGroup grp = processCache(ctx, affinityVer, F.first(affected), withCustomMappings); + ClientCachePartitionAwarenessGroup grp = processCache(ctx, affVer, F.first(affected), withCustomMappings); if (grp == null) continue; @@ -114,7 +114,7 @@ public ClientCachePartitionsRequest(BinaryRawReader reader, ClientProtocolContex // As a second step, check all other caches and add them to groups they are compatible with. for (List descs : F.view(allCaches, new NotContainsPredicate<>(affectedGroupIds)).values()) { - ClientCachePartitionAwarenessGroup grp = processCache(ctx, affinityVer, F.first(descs), withCustomMappings); + ClientCachePartitionAwarenessGroup grp = processCache(ctx, affVer, F.first(descs), withCustomMappings); if (grp == null) continue; @@ -125,7 +125,7 @@ public ClientCachePartitionsRequest(BinaryRawReader reader, ClientProtocolContex grp0.addAll(descs); } - return new ClientCachePartitionsResponse(requestId(), new ArrayList<>(grps.keySet()), affinityVer); + return new ClientCachePartitionsResponse(requestId(), new ArrayList<>(grps.keySet()), affVer); } /** diff --git a/modules/core/src/test/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunctionSimpleBenchmark.java b/modules/core/src/test/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunctionSimpleBenchmark.java index aacb1f79024ea..fde954d4515ee 100644 --- a/modules/core/src/test/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunctionSimpleBenchmark.java +++ b/modules/core/src/test/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunctionSimpleBenchmark.java @@ -549,9 +549,9 @@ public void testPartitionsMigrate() { affPrev = affCur; } - double goldenChangeAffinity = (double)aff1.partitions() / nodesCnt * (backups + 1); + double goldenChangeAff = (double)aff1.partitions() / nodesCnt * (backups + 1); info(String.format("Test %d nodes. Golden: %.1f; %s: %.1f; %s: %.1f;", - nodesCnt, goldenChangeAffinity, + nodesCnt, goldenChangeAff, aff0.getClass().getSimpleName(), (double)diffCnt0 / (MAX_EXPERIMENTS - 1), aff1.getClass().getSimpleName(), diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridAffinityNoCacheSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridAffinityNoCacheSelfTest.java index bd3ff5e04c2e2..76db1624f7607 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/GridAffinityNoCacheSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/GridAffinityNoCacheSelfTest.java @@ -72,13 +72,13 @@ public void testAffinityProxyNoCacheCacheObject() throws Exception { private void checkAffinityProxyNoCache(Object key) { IgniteEx ignite = grid(0); - final Affinity affinity = ignite.affinity("noCache"); + final Affinity aff = ignite.affinity("noCache"); - assertFalse("Affinity proxy instance expected", affinity instanceof GridCacheAffinityImpl); + assertFalse("Affinity proxy instance expected", aff instanceof GridCacheAffinityImpl); final ClusterNode n = ignite.cluster().localNode(); - assertAffinityMethodsException(affinity, key, n); + assertAffinityMethodsException(aff, key, n); } /** @@ -109,9 +109,9 @@ private void checkAffinityImplCacheDeleted(Object key) throws InterruptedExcepti awaitPartitionMapExchange(); - Affinity affinity = grid.affinity(cacheName); + Affinity aff = grid.affinity(cacheName); - assertTrue(affinity instanceof GridCacheAffinityImpl); + assertTrue(aff instanceof GridCacheAffinityImpl); final ClusterNode n = grid.cluster().localNode(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentV2Test.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentV2Test.java index 438dc472f1bf6..5d8e966851c3c 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentV2Test.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentV2Test.java @@ -89,7 +89,7 @@ public class GridAffinityAssignmentV2Test { */ @Test public void testPrimaryBackupPartitions() { - GridAffinityAssignment gridAffinityAssignment = new GridAffinityAssignment( + GridAffinityAssignment gridAffAssignment = new GridAffinityAssignment( new AffinityTopologyVersion(1, 0), Arrays.asList( Arrays.asList(clusterNode1, clusterNode2, clusterNode3, clusterNode4), @@ -99,7 +99,7 @@ public void testPrimaryBackupPartitions() { new ArrayList<>() ); - GridAffinityAssignmentV2 gridAffinityAssignment2 = new GridAffinityAssignmentV2( + GridAffinityAssignmentV2 gridAffAssignment2 = new GridAffinityAssignmentV2( new AffinityTopologyVersion(1, 0), Arrays.asList( Arrays.asList(clusterNode1, clusterNode2, clusterNode3, clusterNode4), @@ -109,17 +109,17 @@ public void testPrimaryBackupPartitions() { new ArrayList<>() ); - assertPartitions(gridAffinityAssignment); + assertPartitions(gridAffAssignment); - assertPartitions(gridAffinityAssignment2); + assertPartitions(gridAffAssignment2); if (AffinityAssignment.IGNITE_DISABLE_AFFINITY_MEMORY_OPTIMIZATION) - assertSame(gridAffinityAssignment2.getIds(0), gridAffinityAssignment2.getIds(0)); + assertSame(gridAffAssignment2.getIds(0), gridAffAssignment2.getIds(0)); else - assertNotSame(gridAffinityAssignment2.getIds(0), gridAffinityAssignment2.getIds(0)); + assertNotSame(gridAffAssignment2.getIds(0), gridAffAssignment2.getIds(0)); try { - gridAffinityAssignment2.primaryPartitions(clusterNode1.id()).add(1000); + gridAffAssignment2.primaryPartitions(clusterNode1.id()).add(1000); fail("Unmodifiable exception expected"); } @@ -128,7 +128,7 @@ public void testPrimaryBackupPartitions() { } try { - gridAffinityAssignment2.backupPartitions(clusterNode1.id()).add(1000); + gridAffAssignment2.backupPartitions(clusterNode1.id()).add(1000); fail("Unmodifiable exception expected"); } @@ -137,7 +137,7 @@ public void testPrimaryBackupPartitions() { } Set unwrapped = U.field( - gridAffinityAssignment2.primaryPartitions(clusterNode1.id()), + gridAffAssignment2.primaryPartitions(clusterNode1.id()), "delegate" ); @@ -188,13 +188,13 @@ public void testBackupsMoreThanThreshold() { for (int i = 0; i < 10; i++) nodes.add(node(metrics, ver, "1" + i)); - GridAffinityAssignment gridAffinityAssignment = new GridAffinityAssignment( + GridAffinityAssignment gridAffAssignment = new GridAffinityAssignment( new AffinityTopologyVersion(1, 0), Collections.singletonList(nodes), new ArrayList<>() ); - assertSame(gridAffinityAssignment.getIds(0), gridAffinityAssignment.getIds(0)); + assertSame(gridAffAssignment.getIds(0), gridAffAssignment.getIds(0)); } /** @@ -208,7 +208,7 @@ public void testSerialization() throws IOException, ClassNotFoundException { for (int i = 0; i < 10; i++) nodes.add(node(metrics, ver, "1" + i)); - GridAffinityAssignmentV2 gridAffinityAssignment2 = new GridAffinityAssignmentV2( + GridAffinityAssignmentV2 gridAffAssignment2 = new GridAffinityAssignmentV2( new AffinityTopologyVersion(1, 0), Collections.singletonList(nodes), new ArrayList<>() @@ -218,13 +218,13 @@ public void testSerialization() throws IOException, ClassNotFoundException { ObjectOutputStream outputStream = new ObjectOutputStream(byteArrOutputStream); - outputStream.writeObject(gridAffinityAssignment2); + outputStream.writeObject(gridAffAssignment2); ObjectInputStream inputStream = new ObjectInputStream(new ByteArrayInputStream(byteArrOutputStream.toByteArray())); GridAffinityAssignmentV2 deserialized = (GridAffinityAssignmentV2)inputStream.readObject(); - assertEquals(deserialized.topologyVersion(), gridAffinityAssignment2.topologyVersion()); + assertEquals(deserialized.topologyVersion(), gridAffAssignment2.topologyVersion()); } /** diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java index 6a846dfbfef1a..95177ac4d7d9b 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java @@ -6584,12 +6584,12 @@ public CheckPrimaryKeysTask(int startFrom, int cnt) { @Override public List call(Ignite ignite, IgniteCache cache) throws Exception { List found = new ArrayList<>(); - Affinity affinity = ignite.affinity(cache.getName()); + Affinity aff = ignite.affinity(cache.getName()); for (int i = startFrom; i < startFrom + 100_000; i++) { String key = "key" + i; - if (affinity.isPrimary(ignite.cluster().localNode(), key)) { + if (aff.isPrimary(ignite.cluster().localNode(), key)) { found.add(key); if (found.size() == cnt) diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java index b6598a77f9426..7a8b0c83a62c7 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java @@ -121,9 +121,9 @@ protected void checkMessages(boolean clientMode) throws Exception { for (int i = 0; i < putCnt; i++) { ClusterNode locNode = grid(0).localNode(); - Affinity affinity = ignite(0).affinity(DEFAULT_CACHE_NAME); + Affinity aff = ignite(0).affinity(DEFAULT_CACHE_NAME); - if (affinity.isPrimary(locNode, i)) + if (aff.isPrimary(locNode, i)) expDhtCnt++; else expNearSingleCnt++; diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLifecycleAwareSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLifecycleAwareSelfTest.java index 74d2da18abcc7..be6510c00861d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLifecycleAwareSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLifecycleAwareSelfTest.java @@ -290,11 +290,11 @@ public TestTopologyValidator() { lifecycleAwares.add(store.lifecycleAware); - TestAffinityFunction affinity = new TestAffinityFunction(); + TestAffinityFunction aff = new TestAffinityFunction(); - ccfg.setAffinity(affinity); + ccfg.setAffinity(aff); - lifecycleAwares.add(affinity); + lifecycleAwares.add(aff); TestEvictionFilter evictionFilter = new TestEvictionFilter(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java index fcca87b2b31de..d0f01d0fe01a2 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java @@ -6450,12 +6450,12 @@ public CheckPrimaryKeysTask(int startFrom, int cnt) { @Override public List call(Ignite ignite, IgniteCache cache) throws Exception { List found = new ArrayList<>(); - Affinity affinity = ignite.affinity(cache.getName()); + Affinity aff = ignite.affinity(cache.getName()); for (int i = startFrom; i < startFrom + 100_000; i++) { String key = "key" + i; - if (affinity.isPrimary(ignite.cluster().localNode(), key)) { + if (aff.isPrimary(ignite.cluster().localNode(), key)) { found.add(key); if (found.size() == cnt) @@ -6533,12 +6533,12 @@ public CheckPrimaryTestObjectKeysTask(int startFrom, int cnt, DataMode mode) { @Override public List call(Ignite ignite, IgniteCache cache) throws Exception { List found = new ArrayList<>(); - Affinity affinity = ignite.affinity(cache.getName()); + Affinity aff = ignite.affinity(cache.getName()); for (int i = startFrom; i < startFrom + 100_000; i++) { Object key = key(i, mode); - if (affinity.isPrimary(ignite.cluster().localNode(), key)) { + if (aff.isPrimary(ignite.cluster().localNode(), key)) { found.add(key); if (found.size() == cnt) diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java index 29bba06908247..dd3affa32ea87 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java @@ -316,10 +316,10 @@ static class MyClass3{} public void testInvokeAllAppliedOnceOnBinaryTypeRegistration() { IgniteCache cache = jcache(); - Affinity affinity = grid(0).affinity(cache.getName()); + Affinity aff = grid(0).affinity(cache.getName()); for (int i = 0; i < gridCount(); i++) { - if (!affinity.isPrimary(grid(i).localNode(), new MyKey(""))) { + if (!aff.isPrimary(grid(i).localNode(), new MyKey(""))) { cache = jcache(i); break; } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java index e57aeb3e502f9..113f3516c277f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java @@ -729,15 +729,15 @@ private T2 offheapKeysCount(int nodeIdx, int part) throws Igni //First count entries... int cnt = (int)offheapManager.cacheEntriesCount(ctx.cacheId(), part); - GridCacheAffinityManager affinity = ctx.affinity(); - AffinityTopologyVersion topVer = affinity.affinityTopologyVersion(); + GridCacheAffinityManager aff = ctx.affinity(); + AffinityTopologyVersion topVer = aff.affinityTopologyVersion(); //And then find out whether they are primary or backup ones. int primaryCnt = 0; int backupCnt = 0; - if (affinity.primaryByPartition(ctx.localNode(), part, topVer)) + if (aff.primaryByPartition(ctx.localNode(), part, topVer)) primaryCnt = cnt; - else if (affinity.backupByPartition(ctx.localNode(), part, topVer)) + else if (aff.backupByPartition(ctx.localNode(), part, topVer)) backupCnt = cnt; return new T2<>(primaryCnt, backupCnt); } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheClientModesAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheClientModesAbstractSelfTest.java index 14cbf57788f45..762eca37c0ee9 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheClientModesAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheClientModesAbstractSelfTest.java @@ -217,7 +217,7 @@ public void testNearOnlyAffinity() throws Exception { } else { boolean foundEntry = false; - boolean foundAffinityNode = false; + boolean foundAffNode = false; for (int k = 0; k < 10000; k++) { String key = "key" + k; @@ -226,11 +226,11 @@ public void testNearOnlyAffinity() throws Exception { foundEntry = true; if (g.affinity(DEFAULT_CACHE_NAME).mapKeyToPrimaryAndBackups(key).contains(g.cluster().localNode())) - foundAffinityNode = true; + foundAffNode = true; } assertTrue("Did not found primary or backup entry for grid: " + i, foundEntry); - assertTrue("Did not found affinity node for grid: " + i, foundAffinityNode); + assertTrue("Did not found affinity node for grid: " + i, foundAffNode); } } } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientReconnectTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientReconnectTest.java index 997594a996d57..67e6d566a9834 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientReconnectTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientReconnectTest.java @@ -207,10 +207,10 @@ private void verifyPartitionToNodeMappings() { for (int i = 0; i < CACHES; i++) { cacheName = "cache-" + i; - Affinity refAffinity = refSrv.affinity(cacheName); + Affinity refAff = refSrv.affinity(cacheName); for (int j = 0; j < PARTITIONS_CNT; j++) { - ClusterNode refAffNode = refAffinity.mapPartitionToNode(j); + ClusterNode refAffNode = refAff.mapPartitionToNode(j); assertNotNull("Affinity node for " + j + " partition is null", refAffNode); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAbstractTransformWriteThroughSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAbstractTransformWriteThroughSelfTest.java index 7a2e092ef4862..0e19dacd9d635 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAbstractTransformWriteThroughSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAbstractTransformWriteThroughSelfTest.java @@ -313,18 +313,18 @@ private Collection keysForType(int nodeType) { while (keys.size() < 30) { String key = String.valueOf(numKey); - Affinity affinity = ignite(0).affinity(DEFAULT_CACHE_NAME); + Affinity aff = ignite(0).affinity(DEFAULT_CACHE_NAME); if (nodeType == NEAR_NODE) { - if (!affinity.isPrimaryOrBackup(grid(0).localNode(), key)) + if (!aff.isPrimaryOrBackup(grid(0).localNode(), key)) keys.add(key); } else if (nodeType == PRIMARY_NODE) { - if (affinity.isPrimary(grid(0).localNode(), key)) + if (aff.isPrimary(grid(0).localNode(), key)) keys.add(key); } else if (nodeType == BACKUP_NODE) { - if (affinity.isBackup(grid(0).localNode(), key)) + if (aff.isBackup(grid(0).localNode(), key)) keys.add(key); } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedTopologyChangeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedTopologyChangeSelfTest.java index 7f0b5d5c02f20..5315c29ed38c3 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedTopologyChangeSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedTopologyChangeSelfTest.java @@ -510,9 +510,9 @@ private void checkTxNodeLeft(int nodeType) throws Exception { txFut.get(1000); for (int i = 0; i < 3; i++) { - Affinity affinity = grid(i).affinity(DEFAULT_CACHE_NAME); + Affinity aff = grid(i).affinity(DEFAULT_CACHE_NAME); - ConcurrentMap addedNodes = U.field(affinity, "addedNodes"); + ConcurrentMap addedNodes = U.field(aff, "addedNodes"); assertFalse(addedNodes.containsKey(leftNodeId)); } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/CacheNodeSafeAssertion.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/CacheNodeSafeAssertion.java index bf6b63fa7639e..8ac8b41dade0d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/CacheNodeSafeAssertion.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/CacheNodeSafeAssertion.java @@ -57,9 +57,9 @@ protected Ignite ignite() { /** {@inheritDoc} */ @Override public void test() throws AssertionError { - Affinity affinity = ignite.affinity(cacheName); + Affinity aff = ignite.affinity(cacheName); - int partCnt = affinity.partitions(); + int partCnt = aff.partitions(); boolean hostSafe = true; @@ -68,7 +68,7 @@ protected Ignite ignite() { for (int x = 0; x < partCnt; ++x) { // Results are returned with the primary node first and backups after. We want to ensure that there is at // least one backup on a different host. - Collection results = affinity.mapPartitionToPrimaryAndBackups(x); + Collection results = aff.mapPartitionToPrimaryAndBackups(x); Iterator nodes = results.iterator(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingOrderingTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingOrderingTest.java index 3fbb796989ff0..e80b562aa6c88 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingOrderingTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingOrderingTest.java @@ -213,9 +213,9 @@ private static Set getMissingKeys(IgniteCache c * @return Map of partition number to randomly generated key. */ private Map generateKeysForPartitions(Ignite ignite, IgniteCache cache) { - Affinity affinity = ignite.affinity(cache.getName()); + Affinity aff = ignite.affinity(cache.getName()); - int parts = affinity.partitions(); + int parts = aff.partitions(); Map keyMap = new HashMap<>(parts); @@ -225,7 +225,7 @@ private Map generateKeysForPartitions(Ignite ignite, Ignite do { IntegerKey key = new IntegerKey(RANDOM.nextInt(10000)); - if (affinity.partition(key) == i) { + if (aff.partition(key) == i) { keyMap.put(i, key); found = true; } @@ -233,13 +233,13 @@ private Map generateKeysForPartitions(Ignite ignite, Ignite } // Sanity check. - if (keyMap.size() != affinity.partitions()) + if (keyMap.size() != aff.partitions()) throw new IllegalStateException("Inconsistent partition count"); for (int i = 0; i < parts; i++) { IntegerKey key = keyMap.get(i); - if (affinity.partition(key) != i) + if (aff.partition(key) != i) throw new IllegalStateException("Inconsistent partition"); } @@ -285,13 +285,13 @@ public void testEvents() throws Exception { for (Map.Entry entry : keyMap.entrySet()) { Integer part = entry.getKey(); - int affinity = entry.getValue().getKey(); + int aff = entry.getValue().getKey(); int cnt = RANDOM.nextInt(10) + 1; Set keys = new HashSet<>(cnt); for (int i = 0; i < cnt; i++) { - IntegerKey key = new IntegerKey(RANDOM.nextInt(10000), affinity); + IntegerKey key = new IntegerKey(RANDOM.nextInt(10000), aff); keys.add(key); cache.put(key, RANDOM.nextInt()); } @@ -306,7 +306,7 @@ public void testEvents() throws Exception { X.println(entry.getKey() + ": " + entry.getValue()); // Validate keys across all partitions. - Affinity affinity = ignite.affinity(cache.getName()); + Affinity aff = ignite.affinity(cache.getName()); Map validatorMap = new HashMap<>(partMap.size()); @@ -327,12 +327,12 @@ public void testEvents() throws Exception { for (Map.Entry> result : results.entrySet()) { try { if (result.getValue().get() == KeySetValidator.Result.RETRY) - retries.add(affinity.partition(result.getKey())); + retries.add(aff.partition(result.getKey())); } catch (Exception e) { X.println("!!! " + e.getMessage()); e.printStackTrace(); - failures.add(affinity.partition(result.getKey())); + failures.add(aff.partition(result.getKey())); } } @@ -383,7 +383,7 @@ public static class KeySetValidator implements EntryProcessor cache = ignite.cache(TEST_CACHE_NAME); - Affinity affinity = ignite.affinity(TEST_CACHE_NAME); + Affinity aff = ignite.affinity(TEST_CACHE_NAME); Set exp = this.keys; @@ -391,9 +391,9 @@ public static class KeySetValidator implements EntryProcessor rebTopVer.equals(readyAffinity), + assertTrue("Can not wait for rebalance topology [cur=" + rebTopVer + ", expect: " + readyAff + ']', + GridTestUtils.waitForCondition(() -> rebTopVer.equals(readyAff), 10_000)); } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/AbstractSnapshotSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/AbstractSnapshotSelfTest.java index 2a56d8ceb2414..bc0d3b1e8c694 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/AbstractSnapshotSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/AbstractSnapshotSelfTest.java @@ -678,7 +678,7 @@ protected void checkSnapshot(String snpName, String snpPath) throws IgniteChecke expPartCopiesInSnp = 1; else { int backups = -1; - int affinityNodes = 0; + int affNodes = 0; for (Ignite node: G.allGrids()) { if (!filter.test(node)) @@ -690,17 +690,17 @@ protected void checkSnapshot(String snpName, String snpPath) throws IgniteChecke backups = grpCtx.config().getBackups(); parts = grpCtx.affinity().partitions(); - affinityNodes++; + affNodes++; } } assertTrue(backups != -1); assertTrue(parts != -1); - assertTrue(affinityNodes > 0); + assertTrue(affNodes > 0); expPartCopiesInSnp = backups == Integer.MAX_VALUE - ? affinityNodes - : Math.min(backups + 1, affinityNodes); + ? affNodes + : Math.min(backups + 1, affNodes); } Map cacheParts = entry.getValue(); diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryTransformerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryTransformerSelfTest.java index 692066370bddb..8a275b9cc07b9 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryTransformerSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryTransformerSelfTest.java @@ -171,13 +171,13 @@ public void testGetObjectField() throws Exception { public void testGetObjectFieldPartitioned() throws Exception { IgniteCache cache = grid().createCache("test-cache"); - Affinity affinity = affinity(cache); + Affinity aff = affinity(cache); try { int[] keys = new int[50]; for (int i = 0, j = 0; i < keys.length; j++) { - if (affinity.partition(j) == 0) + if (aff.partition(j) == 0) keys[i++] = j; } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/AbstractTransactionIntergrityTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/AbstractTransactionIntergrityTest.java index 07a8e2a2cbc6a..e00235b8014fa 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/AbstractTransactionIntergrityTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/AbstractTransactionIntergrityTest.java @@ -539,12 +539,12 @@ private void updateInTransaction(IgniteCache cache) throw if (accIdFrom == accIdTo) continue; - Affinity affinity = ignite.affinity(cacheName); + Affinity aff = ignite.affinity(cacheName); - ClusterNode primaryForAccFrom = affinity.mapKeyToNode(accIdFrom); + ClusterNode primaryForAccFrom = aff.mapKeyToNode(accIdFrom); assertNotNull(primaryForAccFrom); - ClusterNode primaryForAccTo = affinity.mapKeyToNode(accIdTo); + ClusterNode primaryForAccTo = aff.mapKeyToNode(accIdTo); assertNotNull(primaryForAccTo); // Allows only transaction between accounts that primary on the same node if corresponding flag is enabled. diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxOptimisticOnPartitionExchangeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxOptimisticOnPartitionExchangeTest.java index f2b11b0d66f5c..fa88911c7e9a5 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxOptimisticOnPartitionExchangeTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxOptimisticOnPartitionExchangeTest.java @@ -130,10 +130,10 @@ public void doTest(final TransactionIsolation isolation, boolean txInitiatorPrim ClusterNode node = ignite(0).cluster().node(); - GridCacheAffinityManager affinity = ((IgniteCacheProxy)cache).context().affinity(); + GridCacheAffinityManager aff = ((IgniteCacheProxy)cache).context().affinity(); for (int i = 0; txValues.size() < TX_SIZE; i++) { - if (!txInitiatorPrimary && node.equals(affinity.primaryByKey(i, NONE))) + if (!txInitiatorPrimary && node.equals(aff.primaryByKey(i, NONE))) continue; txValues.put(i, i); diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/affinity/PartitionExtractor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/affinity/PartitionExtractor.java index 11e6ceea4d061..b04cc8638845e 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/affinity/PartitionExtractor.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/affinity/PartitionExtractor.java @@ -164,7 +164,7 @@ else if (!aff.isCompatible(qryRes.affinity())) // Merge. PartitionNode tree = null; - AffinityTopologyVersion affinityTopVer = null; + AffinityTopologyVersion affTopVer = null; for (GridCacheSqlQuery qry : qrys) { PartitionResult qryRes = (PartitionResult)qry.derivedPartitions(); @@ -174,10 +174,10 @@ else if (!aff.isCompatible(qryRes.affinity())) else tree = new PartitionCompositeNode(tree, qryRes.tree(), PartitionCompositeNodeOperator.OR); - if (affinityTopVer == null) - affinityTopVer = qryRes.topologyVersion(); + if (affTopVer == null) + affTopVer = qryRes.topologyVersion(); else - assert affinityTopVer.equals(qryRes.topologyVersion()); + assert affTopVer.equals(qryRes.topologyVersion()); } // Optimize. @@ -194,9 +194,9 @@ else if (!aff.isCompatible(qryRes.affinity())) // Affinity topology version expected to be the same for all partition results derived from map queries. // TODO: 09.04.19 IGNITE-11507: SQL: Ensure that affinity topology version doesn't change // TODO: during PartitionResult construction/application. - assert affinityTopVer != null; + assert affTopVer != null; - return new PartitionResult(tree, aff, affinityTopVer); + return new PartitionResult(tree, aff, affTopVer); } /** diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsQueryTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsQueryTest.java index cb7f666362126..4302834585d38 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsQueryTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsQueryTest.java @@ -228,7 +228,7 @@ public void testLocalScanQuery() throws Exception { IgniteCache cache = jcache(); ClusterNode locNode = testedGrid().cluster().localNode(); - Affinity affinity = testedGrid().affinity(cacheName()); + Affinity aff = testedGrid().affinity(cacheName()); Map map = new HashMap<>(); @@ -238,7 +238,7 @@ public void testLocalScanQuery() throws Exception { cache.put(key, val); - if (!isClientMode() && (cacheMode() == REPLICATED || affinity.isPrimary(locNode, key))) + if (!isClientMode() && (cacheMode() == REPLICATED || aff.isPrimary(locNode, key))) map.put(key, val); } @@ -312,7 +312,7 @@ public void testScanQueryPartitionFilter() throws Exception { @Override public void run() throws Exception { IgniteCache cache = jcache(); - Affinity affinity = testedGrid().affinity(cacheName()); + Affinity aff = testedGrid().affinity(cacheName()); Map> partMap = new HashMap<>(); @@ -332,7 +332,7 @@ public void testScanQueryPartitionFilter() throws Exception { cache.put(key, val); if (filter.apply(key, val)) { - int part = affinity.partition(key); + int part = aff.partition(key); Map map = partMap.get(part); @@ -343,7 +343,7 @@ public void testScanQueryPartitionFilter() throws Exception { } } - for (int part = 0; part < affinity.partitions(); part++) { + for (int part = 0; part < aff.partitions(); part++) { try { Map expMap = partMap.get(part); diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedPartitionQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedPartitionQuerySelfTest.java index a458e5896325d..8b488a7fb0bcb 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedPartitionQuerySelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedPartitionQuerySelfTest.java @@ -69,9 +69,9 @@ public void testJoinQueryClient() throws Exception { /** Tests local query over partitions. */ @Test public void testLocalQuery() { - Affinity affinity = grid(0).affinity("cl"); + Affinity aff = grid(0).affinity("cl"); - int[] parts = affinity.primaryPartitions(grid(0).localNode()); + int[] parts = aff.primaryPartitions(grid(0).localNode()); Arrays.sort(parts); @@ -84,7 +84,7 @@ public void testLocalQuery() { List> clients = cl.query(qry1).getAll(); for (Cache.Entry client : clients) - assertEquals("Incorrect partition", parts[0], affinity.partition(client.getKey())); + assertEquals("Incorrect partition", parts[0], aff.partition(client.getKey())); SqlFieldsQuery qry2 = new SqlFieldsQuery("select cl._KEY, cl._VAL from \"cl\".Client cl"); qry2.setLocal(true); @@ -93,6 +93,6 @@ public void testLocalQuery() { List> rows = cl.query(qry2).getAll(); for (List row : rows) - assertEquals("Incorrect partition", parts[0], affinity.partition(row.get(0))); + assertEquals("Incorrect partition", parts[0], aff.partition(row.get(0))); } } diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlCreateTableTemplateTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlCreateTableTemplateTest.java index 769f701dfffd8..eab2fe688508c 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlCreateTableTemplateTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlCreateTableTemplateTest.java @@ -44,9 +44,9 @@ public class IgniteSqlCreateTableTemplateTest extends AbstractIndexingCommonTest customCacheConfiguration.setName("CUSTOM_TEMPLATE*"); - MockAffinityKeyMapper customAffinityMapper = new MockAffinityKeyMapper(); + MockAffinityKeyMapper customAffMapper = new MockAffinityKeyMapper(); - customCacheConfiguration.setAffinityMapper(customAffinityMapper); + customCacheConfiguration.setAffinityMapper(customAffMapper); configuration.setCacheConfiguration(defaultCacheConfiguration, customCacheConfiguration); diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/RunningQueriesTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/RunningQueriesTest.java index fa09f8ebc33ba..13ca745de22aa 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/RunningQueriesTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/RunningQueriesTest.java @@ -542,21 +542,21 @@ public void testMultiStatement() throws Exception { int key = 0; - int[] notAffinityKey = new int[2]; + int[] notAffKey = new int[2]; - for (int i = 0; i < notAffinityKey.length; i++) { + for (int i = 0; i < notAffKey.length; i++) { while (ignite.affinity(DEFAULT_CACHE_NAME).isPrimary(ignite.localNode(), key)) key++; - notAffinityKey[i] = key; + notAffKey[i] = key; key++; } String[] queries = { "create table test(ID int primary key, NAME varchar(20))", - "insert into test (ID, NAME) values (" + notAffinityKey[0] + ", 'name')", - "insert into test (ID, NAME) values (" + notAffinityKey[1] + ", 'name')", + "insert into test (ID, NAME) values (" + notAffKey[0] + ", 'name')", + "insert into test (ID, NAME) values (" + notAffKey[1] + ", 'name')", "SELECT * FROM test" }; diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java index faca4daf1671d..81775879db19d 100644 --- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java @@ -491,20 +491,20 @@ private void preLoading() throws Exception { */ private Map> personCachePartitions(String cacheName) { // Getting affinity for person cache. - Affinity affinity = ignite().affinity(cacheName); + Affinity aff = ignite().affinity(cacheName); // Building a list of all partitions numbers. List rndParts = new ArrayList<>(10); - if (affinity.partitions() <= SCAN_QUERY_PARTITION_AMOUNT) - for (int i = 0; i < affinity.partitions(); i++) + if (aff.partitions() <= SCAN_QUERY_PARTITION_AMOUNT) + for (int i = 0; i < aff.partitions(); i++) rndParts.add(i); else { for (int i = 0; i < SCAN_QUERY_PARTITION_AMOUNT; i++) { int partNum; do - partNum = nextRandom(affinity.partitions()); + partNum = nextRandom(aff.partitions()); while (rndParts.contains(partNum)); rndParts.add(partNum); @@ -514,7 +514,7 @@ private Map> personCachePartitions(String cacheName) { Collections.sort(rndParts); // Getting partition to node mapping. - Map partPerNodes = affinity.mapPartitionsToNodes(rndParts); + Map partPerNodes = aff.mapPartitionsToNodes(rndParts); // Building node to partitions mapping. Map> nodesToPart = new HashMap<>();