This is an automated email from the ASF dual-hosted git repository. brandonwilliams pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/cassandra.git
The following commit(s) were added to refs/heads/trunk by this push: new 12b6102 Don't manually remove endpoints in distributed tests 12b6102 is described below commit 12b610246bc42dc6af33abfe0885b2f989fc2c73 Author: Brandon Williams <brandonwilli...@apache.org> AuthorDate: Wed Jan 20 12:46:23 2021 -0600 Don't manually remove endpoints in distributed tests Patch by brandonwilliams, reviewed by ycai and edimitrova for CASSANDRA-16229 --- src/java/org/apache/cassandra/gms/Gossiper.java | 10 ---------- .../org/apache/cassandra/distributed/action/GossipHelper.java | 8 +------- .../org/apache/cassandra/distributed/impl/Instance.java | 2 -- .../cassandra/distributed/test/ring/NodeNotInRingTest.java | 11 ++++++++--- 4 files changed, 9 insertions(+), 22 deletions(-) diff --git a/src/java/org/apache/cassandra/gms/Gossiper.java b/src/java/org/apache/cassandra/gms/Gossiper.java index a3be834..74abea3 100644 --- a/src/java/org/apache/cassandra/gms/Gossiper.java +++ b/src/java/org/apache/cassandra/gms/Gossiper.java @@ -710,16 +710,6 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean assassinateEndpoint(address); } - @VisibleForTesting - public void unsafeAnulEndpoint(InetAddressAndPort endpoint) - { - removeEndpoint(endpoint); - justRemovedEndpoints.remove(endpoint); - endpointStateMap.remove(endpoint); - expireTimeEndpointMap.remove(endpoint); - unreachableEndpoints.remove(endpoint); - } - /** * Do not call this method unless you know what you are doing. * It will try extremely hard to obliterate any endpoint from the ring, diff --git a/test/distributed/org/apache/cassandra/distributed/action/GossipHelper.java b/test/distributed/org/apache/cassandra/distributed/action/GossipHelper.java index 229cb39..255f6e2 100644 --- a/test/distributed/org/apache/cassandra/distributed/action/GossipHelper.java +++ b/test/distributed/org/apache/cassandra/distributed/action/GossipHelper.java @@ -399,12 +399,6 @@ public class GossipHelper VersionedValue vv = toVersionedValue(newState); currentState.addApplicationState(as, vv); StorageService.instance.onChange(endpoint, as, vv); - - // remove from gossip - Gossiper.runInGossipStageBlocking(() -> Gossiper.instance.unsafeAnulEndpoint(endpoint)); - SystemKeyspace.removeEndpoint(endpoint); - PendingRangeCalculatorService.instance.update(); - PendingRangeCalculatorService.instance.blockUntilFinished(); }); }; } @@ -463,4 +457,4 @@ public class GossipHelper System.setProperty(prop, before); } } -} \ No newline at end of file +} diff --git a/test/distributed/org/apache/cassandra/distributed/impl/Instance.java b/test/distributed/org/apache/cassandra/distributed/impl/Instance.java index 87d84c8..7c94a21 100644 --- a/test/distributed/org/apache/cassandra/distributed/impl/Instance.java +++ b/test/distributed/org/apache/cassandra/distributed/impl/Instance.java @@ -603,9 +603,7 @@ public class Instance extends IsolatedExecutor implements IInvokableInstance StorageService.instance.onChange(addressAndPort, ApplicationState.STATUS, new VersionedValue.VersionedValueFactory(partitioner).left(Collections.singleton(token), 0L)); - Gossiper.instance.removeEndpoint(addressAndPort); }); - PendingRangeCalculatorService.instance.blockUntilFinished(); } catch (Throwable e) // UnknownHostException { diff --git a/test/distributed/org/apache/cassandra/distributed/test/ring/NodeNotInRingTest.java b/test/distributed/org/apache/cassandra/distributed/test/ring/NodeNotInRingTest.java index 2333077..e973e33 100644 --- a/test/distributed/org/apache/cassandra/distributed/test/ring/NodeNotInRingTest.java +++ b/test/distributed/org/apache/cassandra/distributed/test/ring/NodeNotInRingTest.java @@ -29,6 +29,7 @@ import org.apache.cassandra.distributed.api.ConsistencyLevel; import org.apache.cassandra.distributed.api.ICluster; import org.apache.cassandra.distributed.test.TestBaseImpl; import org.apache.cassandra.net.Verb; +import org.apache.cassandra.service.StorageService; import static org.apache.cassandra.distributed.api.Feature.GOSSIP; import static org.apache.cassandra.distributed.api.Feature.NETWORK; @@ -52,14 +53,18 @@ public class NodeNotInRingTest extends TestBaseImpl .drop() .on(); cluster.run(GossipHelper.removeFromRing(cluster.get(3)), 1, 2); + cluster.run(inst -> inst.runsOnInstance(() -> { + Assert.assertEquals("There should be 2 remaining nodes in ring", + 2, StorageService.instance.effectiveOwnershipWithPort(KEYSPACE).size()); + }), 1, 2); populate(cluster, 0, 50, 1, ConsistencyLevel.ALL); populate(cluster, 50, 100, 2, ConsistencyLevel.ALL); Map<Integer, Long> counts = BootstrapTest.count(cluster); - Assert.assertEquals(counts.get(1).longValue(), 100L); - Assert.assertEquals(counts.get(2).longValue(), 100L); - Assert.assertEquals(counts.get(3).longValue(), 0L); + Assert.assertEquals(0L, counts.get(3).longValue()); + Assert.assertEquals(100L, counts.get(2).longValue()); + Assert.assertEquals(100L, counts.get(1).longValue()); } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org