Skip to content

Commit

Permalink
ignite-4557 Fixed wrong affinity manager call.
Browse files Browse the repository at this point in the history
  • Loading branch information
zstan authored and sboikov committed Jan 19, 2017
1 parent cdb550b commit 4e81e94
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
Expand Up @@ -378,16 +378,16 @@ public Collection<ClusterNode> remoteNodes(Iterable keys, AffinityTopologyVersio
* @param topVer Topology version.
* @return {@code true} if given key belongs to local node.
*/
public boolean localNode(Object key, AffinityTopologyVersion topVer) {
return localNode(partition(key), topVer);
public boolean keyLocalNode(Object key, AffinityTopologyVersion topVer) {
return partitionLocalNode(partition(key), topVer);
}

/**
* @param part Partition number to check.
* @param topVer Topology version.
* @return {@code true} if given partition belongs to local node.
*/
public boolean localNode(int part, AffinityTopologyVersion topVer) {
public boolean partitionLocalNode(int part, AffinityTopologyVersion topVer) {
assert part >= 0 : "Invalid partition: " + part;

return nodes(part, topVer).contains(cctx.localNode());
Expand Down
Expand Up @@ -622,7 +622,7 @@ else if (!node2part.nodeId().equals(loc.id())) {
for (int p = 0; p < num; p++) {
GridDhtLocalPartition locPart = localPartition(p, topVer, false, false);

if (cctx.affinity().localNode(p, topVer)) {
if (cctx.affinity().partitionLocalNode(p, topVer)) {
// This partition will be created during next topology event,
// which obviously has not happened at this point.
if (locPart == null) {
Expand Down Expand Up @@ -763,7 +763,7 @@ private GridDhtLocalPartition localPartition(int p,

state = loc != null ? loc.state() : null;

boolean belongs = cctx.affinity().localNode(p, topVer);
boolean belongs = cctx.affinity().partitionLocalNode(p, topVer);

if (loc != null && state == EVICTED) {
locParts.set(p, loc = null);
Expand Down
Expand Up @@ -651,7 +651,7 @@ public void handleSupplyMessage(
for (Map.Entry<Integer, CacheEntryInfoCollection> e : supply.infos().entrySet()) {
int p = e.getKey();

if (cctx.affinity().localNode(p, topVer)) {
if (cctx.affinity().partitionLocalNode(p, topVer)) {
GridDhtLocalPartition part = top.localPartition(p, topVer, true);

assert part != null;
Expand Down Expand Up @@ -721,7 +721,7 @@ public void handleSupplyMessage(

// Only request partitions based on latest topology version.
for (Integer miss : supply.missed()) {
if (cctx.affinity().localNode(miss, topVer))
if (cctx.affinity().partitionLocalNode(miss, topVer))
fut.partitionMissed(id, miss);
}

Expand Down Expand Up @@ -1416,7 +1416,7 @@ private void demandFromNode(
for (Map.Entry<Integer, CacheEntryInfoCollection> e : supply.infos().entrySet()) {
int p = e.getKey();

if (cctx.affinity().localNode(p, topVer)) {
if (cctx.affinity().partitionLocalNode(p, topVer)) {
GridDhtLocalPartition part = top.localPartition(p, topVer, true);

assert part != null;
Expand Down Expand Up @@ -1493,7 +1493,7 @@ private void demandFromNode(

// Only request partitions based on latest topology version.
for (Integer miss : s.supply().missed()) {
if (cctx.affinity().localNode(miss, topVer))
if (cctx.affinity().partitionLocalNode(miss, topVer))
fut.partitionMissed(node.id(), miss);
}

Expand Down
Expand Up @@ -289,7 +289,7 @@ private IgniteCheckedException stopError() {
}

// If partition belongs to local node.
if (cctx.affinity().localNode(p, topVer)) {
if (cctx.affinity().partitionLocalNode(p, topVer)) {
GridDhtLocalPartition part = top.localPartition(p, topVer, true);

assert part != null;
Expand Down
Expand Up @@ -725,7 +725,7 @@ private Map<K, V> loadEntries(
info.unmarshalValue(cctx, cctx.deploy().globalLoader());

// Entries available locally in DHT should not be loaded into near cache for reading.
if (!cctx.affinity().localNode(info.key(), cctx.affinity().affinityTopologyVersion())) {
if (!cctx.affinity().keyLocalNode(info.key(), cctx.affinity().affinityTopologyVersion())) {
GridNearCacheEntry entry = savedEntries.get(info.key());

if (entry == null)
Expand Down
Expand Up @@ -350,7 +350,7 @@ else if (err != null)
GridCacheContext cacheCtx = e.context();

try {
if (e.op() != NOOP && !cacheCtx.affinity().localNode(e.key(), topVer)) {
if (e.op() != NOOP && !cacheCtx.affinity().keyLocalNode(e.key(), topVer)) {
GridCacheEntryEx entry = cacheCtx.cache().peekEx(e.key());

if (entry != null)
Expand Down
Expand Up @@ -5875,7 +5875,7 @@ public CheckEntriesTask(Collection<String> keys) {
ctx = ctx.near().dht().context();

for (String key : keys) {
if (ctx.affinity().localNode(key, ctx.discovery().topologyVersionEx())) {
if (ctx.affinity().keyLocalNode(key, ctx.discovery().topologyVersionEx())) {
GridCacheEntryEx e = ctx.cache().entryEx(key);

assert e != null : "Entry is null [idx=" + idx + ", key=" + key + ", ctx=" + ctx + ']';
Expand Down Expand Up @@ -5912,7 +5912,7 @@ private static class CheckCacheSizeTask extends TestIgniteIdxRunnable {
int size = 0;

for (String key : map.keySet())
if (ctx.affinity().localNode(key, ctx.discovery().topologyVersionEx()))
if (ctx.affinity().keyLocalNode(key, ctx.discovery().topologyVersionEx()))
size++;

assertEquals("Incorrect key size on cache #" + idx, size, ignite.cache(ctx.name()).localSize(ALL));
Expand Down Expand Up @@ -6155,7 +6155,7 @@ public CheckKeySizeTask(Collection<String> keys) {
int size = 0;

for (String key : keys)
if (ctx.affinity().localNode(key, ctx.discovery().topologyVersionEx()))
if (ctx.affinity().keyLocalNode(key, ctx.discovery().topologyVersionEx()))
size++;

assertEquals("Incorrect key size on cache #" + idx, size, ignite.cache(null).localSize(ALL));
Expand Down
Expand Up @@ -5557,7 +5557,7 @@ private static class CheckEntriesTask extends TestIgniteIdxRunnable {
ctx = ctx.near().dht().context();

for (String key : keys) {
if (ctx.affinity().localNode(key, ctx.discovery().topologyVersionEx())) {
if (ctx.affinity().keyLocalNode(key, ctx.discovery().topologyVersionEx())) {
GridCacheEntryEx e = ctx.cache().entryEx(key);

assert e != null : "Entry is null [idx=" + idx + ", key=" + key + ", ctx=" + ctx + ']';
Expand Down Expand Up @@ -5600,7 +5600,7 @@ private static class CheckCacheSizeTask extends TestIgniteIdxRunnable {
int size = 0;

for (String key : map.keySet())
if (ctx.affinity().localNode(key, ctx.discovery().topologyVersionEx()))
if (ctx.affinity().keyLocalNode(key, ctx.discovery().topologyVersionEx()))
size++;

assertEquals("Incorrect key size on cache #" + idx, size, ignite.cache(ctx.name()).localSize(ALL));
Expand Down Expand Up @@ -5861,7 +5861,7 @@ public CheckKeySizeTask(Collection<String> keys, String s) {
int size = 0;

for (String key : keys)
if (ctx.affinity().localNode(key, ctx.discovery().topologyVersionEx()))
if (ctx.affinity().keyLocalNode(key, ctx.discovery().topologyVersionEx()))
size++;

assertEquals("Incorrect key size on cache #" + idx, size, ignite.cache(cacheName).localSize(ALL));
Expand Down

0 comments on commit 4e81e94

Please sign in to comment.