mirror of https://github.com/apache/cassandra
[CASSANDRA-20736] Change trigger for UpgradeMigrationListener to merge local node state to gossip
This commit is contained in:
parent
00cd159564
commit
fda2d0c02d
|
|
@ -2234,7 +2234,9 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean,
|
|||
{
|
||||
checkProperThreadForStateMutation();
|
||||
assert !endpoint.equals(getBroadcastAddressAndPort()) || epstate.getHeartBeatState().getGeneration() > 0 :
|
||||
"We should not update epstates with generation = 0 for the local host";
|
||||
String.format("We should not update epstates with generation = 0 for the local host " +
|
||||
"(endpoint: %s, broadcast: %s, generation: %s)",
|
||||
endpoint, getBroadcastAddressAndPort(), epstate.getHeartBeatState().getGeneration());
|
||||
EndpointState old = endpointStateMap.get(endpoint);
|
||||
if (old == null)
|
||||
endpointStateMap.put(endpoint, epstate);
|
||||
|
|
|
|||
|
|
@ -47,17 +47,23 @@ public class UpgradeMigrationListener implements ChangeListener
|
|||
logger.info("Detected upgrade from gossip mode");
|
||||
return;
|
||||
}
|
||||
else if (prev.epoch.equals(Epoch.FIRST) && !next.directory.isEmpty()) // directory is non-empty after initialization during gossip upgrade
|
||||
else if (prev.epoch.equals(Epoch.FIRST) && !next.directory.isEmpty())
|
||||
{
|
||||
NodeId localId = next.myNodeId();
|
||||
if (localId != null)
|
||||
{
|
||||
logger.info("Initialized CMS, updating local host id to {}", next.myNodeId());
|
||||
SystemKeyspace.setLocalHostId(next.myNodeId().toUUID());
|
||||
Gossiper.instance.mergeNodeToGossip(next.myNodeId(), next);
|
||||
// assigning the local node id is done in Epoch.FIRST in one of two scenarios:
|
||||
// * during an upgrade from gossip, as all pre-existing nodes will have an id assigned
|
||||
// * during CMS initialization for a brand new cluster iff the local node is the first CMS member
|
||||
logger.info("Initialized CMS, updating local host id to {}", localId);
|
||||
SystemKeyspace.setLocalHostId(localId.toUUID());
|
||||
if (Gossiper.instance.isEnabled())
|
||||
{
|
||||
Gossiper.instance.mergeNodeToGossip(localId, next);
|
||||
if (Gossiper.instance.getQuarantineDisabled())
|
||||
Gossiper.instance.clearQuarantinedEndpoints();
|
||||
}
|
||||
}
|
||||
if (Gossiper.instance.getQuarantineDisabled())
|
||||
Gossiper.instance.clearQuarantinedEndpoints();
|
||||
}
|
||||
|
||||
CassandraVersion prevMinVersion = prev.directory.clusterMinVersion.cassandraVersion;
|
||||
|
|
|
|||
Loading…
Reference in New Issue