When doing a host replacement, -Dcassandra.broadcast_interval_ms is used to know when to check the ring but checks that the ring wasn't changed in -Dcassandra.ring_delay_ms, changes to ring delay should not depend on when we publish load stats
patch by David Capwell; reviewed by Brandon Williams, Caleb Rackliffe for CASSANDRA-17776
diff --git a/CHANGES.txt b/CHANGES.txt
index 63e8fdd..554b626 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
4.2
+ * When doing a host replacement, -Dcassandra.broadcast_interval_ms is used to know when to check the ring but checks that the ring wasn't changed in -Dcassandra.ring_delay_ms, changes to ring delay should not depend on when we publish load stats (CASSANDRA-17776)
* When bootstrap fails, CassandraRoleManager may attempt to do read queries that fail with "Cannot read from a bootstrapping node", and increments unavailables counters (CASSANDRA-17754)
* Add guardrail to disallow DROP KEYSPACE commands (CASSANDRA-17767)
* Remove ephemeral snapshot marker file and introduce a flag to SnapshotManifest (CASSANDRA-16911)
diff --git a/src/java/org/apache/cassandra/service/StorageService.java b/src/java/org/apache/cassandra/service/StorageService.java
index 957daf3..ee79b33 100644
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@ -1776,11 +1776,18 @@
{
if (!isReplacingSameAddress())
{
+ // Historically BROADCAST_INTERVAL was used, but this is unrelated to ring_delay, so using it to know
+ // how long to sleep only works with the default settings (ring_delay=30s, broadcast=60s). For users
+ // who are aware of this relationship, this coupling should not be broken, but for most users this
+ // relationship isn't known and instead we should rely on the ring_delay.
+ // See CASSANDRA-17776
+ long sleepDelayMillis = Math.max(LoadBroadcaster.BROADCAST_INTERVAL, ringTimeoutMillis * 2);
try
{
// Sleep additionally to make sure that the server actually is not alive
// and giving it more time to gossip if alive.
- Thread.sleep(LoadBroadcaster.BROADCAST_INTERVAL);
+ logger.info("Sleeping for {}ms waiting to make sure no new gossip updates happen for {}", sleepDelayMillis, DatabaseDescriptor.getReplaceAddress());
+ Thread.sleep(sleepDelayMillis);
}
catch (InterruptedException e)
{