Check for endpoint collision with hibernating nodes

Patch by Stefan Miklosovic, reviewed by brandonwillias for
CASSANDRA-14599
This commit is contained in:
Stefan Miklosovic 2020-08-03 08:37:00 +02:00 committed by Brandon Williams
parent 2844454669
commit c94ececec0
2 changed files with 14 additions and 2 deletions

View File

@ -1,4 +1,5 @@
3.0.22:
* Check for endpoint collision with hibernating nodes (CASSANDRA-14599)
* Operational improvements and hardening for replica filtering protection (CASSANDRA-15907)
* stop_paranoid disk failure policy is ignored on CorruptSSTableException after node is up (CASSANDRA-15191)
* 3.x fails to start if commit log has range tombstones from a column which is also deleted (CASSANDRA-15970)

View File

@ -33,6 +33,7 @@ import com.google.common.util.concurrent.ListenableFutureTask;
import com.google.common.util.concurrent.Uninterruptibles;
import io.netty.util.concurrent.FastThreadLocal;
import org.apache.cassandra.db.SystemKeyspace;
import org.apache.cassandra.utils.ExecutorUtils;
import org.apache.cassandra.utils.MBeanWrapper;
import org.apache.cassandra.utils.NoSpamLogger;
@ -794,12 +795,22 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
{
EndpointState epState = epStates.get(endpoint);
// if there's no previous state, or the node was previously removed from the cluster, we're good
if (epState == null || isDeadState(epState))
// if there's no previous state, we're good
if (epState == null)
return true;
String status = getGossipStatus(epState);
if (status.equals(VersionedValue.HIBERNATE)
&& !SystemKeyspace.bootstrapComplete())
{
logger.warn("A node with the same IP in hibernate status was detected. Was a replacement already attempted?");
return false;
}
if (isDeadState(epState))
return true;
// these states are not allowed to join the cluster as it would not be safe
final List<String> unsafeStatuses = new ArrayList<String>() {{
add(""); // failed bootstrap but we did start gossiping