mirror of https://github.com/apache/cassandra
Fix rare race where older gossip states can be shadowed
Patch by brandonwilliams, reviewed by Richard Low for CASSANDRA-10366
This commit is contained in:
parent
718e47f084
commit
6f8e07ab06
|
|
@ -1,4 +1,5 @@
|
|||
2.0.17
|
||||
* Fix rare race where older gossip states can be shadowed (CASSANDRA-10366)
|
||||
* Fix consolidating racks violating the RF contract (CASSANDRA-10238)
|
||||
* Disallow decommission when node is in drained state (CASSANDRA-8741)
|
||||
* Backport CASSANDRA-8013 to 2.0 (CASSANDRA-10144)
|
||||
|
|
|
|||
|
|
@ -1139,7 +1139,6 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
|
|||
localState.setHeartBeatState(remoteState.getHeartBeatState());
|
||||
if (logger.isTraceEnabled())
|
||||
logger.trace("Updating heartbeat state version to " + localState.getHeartBeatState().getHeartBeatVersion() + " from " + oldVersion + " for " + addr + " ...");
|
||||
|
||||
// we need to make two loops here, one to apply, then another to notify, this way all states in an update are present and current when the notifications are received
|
||||
for (Entry<ApplicationState, VersionedValue> remoteEntry : remoteState.getApplicationStateMap().entrySet())
|
||||
{
|
||||
|
|
@ -1385,8 +1384,9 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
|
|||
logger.trace("Adding saved endpoint " + ep + " " + epState.getHeartBeatState().getGeneration());
|
||||
}
|
||||
|
||||
public void addLocalApplicationState(ApplicationState state, VersionedValue value)
|
||||
private void addLocalApplicationStateInternal(ApplicationState state, VersionedValue value)
|
||||
{
|
||||
assert taskLock.isHeldByCurrentThread();
|
||||
EndpointState epState = endpointStateMap.get(FBUtilities.getBroadcastAddress());
|
||||
InetAddress epAddr = FBUtilities.getBroadcastAddress();
|
||||
assert epState != null;
|
||||
|
|
@ -1401,6 +1401,11 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
|
|||
doOnChangeNotifications(epAddr, state, value);
|
||||
}
|
||||
|
||||
public void addLocalApplicationState(ApplicationState applicationState, VersionedValue value)
|
||||
{
|
||||
addLocalApplicationStates(Arrays.asList(Pair.create(applicationState, value)));
|
||||
}
|
||||
|
||||
public void addLocalApplicationStates(List<Pair<ApplicationState, VersionedValue>> states)
|
||||
{
|
||||
taskLock.lock();
|
||||
|
|
@ -1408,7 +1413,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
|
|||
{
|
||||
for (Pair<ApplicationState, VersionedValue> pair : states)
|
||||
{
|
||||
addLocalApplicationState(pair.left, pair.right);
|
||||
addLocalApplicationStateInternal(pair.left, pair.right);
|
||||
}
|
||||
}
|
||||
finally
|
||||
|
|
|
|||
Loading…
Reference in New Issue