Updated Branches: refs/heads/trunk 3a2faf942 -> b7fdc674a
Gossiper notifies about states after all states have been applied. Patch by brandonwilliams, reviewed by eevans for CASSANDRA-4383 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/b7fdc674 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/b7fdc674 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/b7fdc674 Branch: refs/heads/trunk Commit: b7fdc674a9882db9e46078c0532add4493233377 Parents: 3a2faf9 Author: Brandon Williams <[email protected]> Authored: Wed Sep 5 11:16:01 2012 -0500 Committer: Brandon Williams <[email protected]> Committed: Wed Sep 5 11:16:01 2012 -0500 ---------------------------------------------------------------------- src/java/org/apache/cassandra/gms/Gossiper.java | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/b7fdc674/src/java/org/apache/cassandra/gms/Gossiper.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/gms/Gossiper.java b/src/java/org/apache/cassandra/gms/Gossiper.java index 2404e40..c9cbf7f 100644 --- a/src/java/org/apache/cassandra/gms/Gossiper.java +++ b/src/java/org/apache/cassandra/gms/Gossiper.java @@ -896,6 +896,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean 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()) { ApplicationState remoteKey = remoteEntry.getKey(); @@ -903,7 +904,10 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean assert remoteState.getHeartBeatState().getGeneration() == localState.getHeartBeatState().getGeneration(); localState.addApplicationState(remoteKey, remoteValue); - doNotifications(addr, remoteKey, remoteValue); + } + for (Entry<ApplicationState, VersionedValue> remoteEntry : remoteState.getApplicationStateMap().entrySet()) + { + doNotifications(addr, remoteEntry.getKey(), remoteEntry.getValue()); } }
