cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject [02/15] cassandra git commit: Clone HeartBeatState when building gossip messages. Make its generation/version volatile.
Date Mon, 24 Jul 2017 20:26:46 GMT
Clone HeartBeatState when building gossip messages. Make its generation/version volatile.

Patch by Joel Knighton; reviewed by Jason Brown for CASSANDRA-13700


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/2290c0d4
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/2290c0d4
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/2290c0d4

Branch: refs/heads/cassandra-2.2
Commit: 2290c0d4b0c20ce3407ae2c542e580c75a5ab337
Parents: 77aba07
Author: Joel Knighton <jkni@apache.org>
Authored: Thu Jul 20 11:08:08 2017 -0500
Committer: Joel Knighton <jkni@apache.org>
Committed: Mon Jul 24 14:45:09 2017 -0500

----------------------------------------------------------------------
 CHANGES.txt                                           | 1 +
 src/java/org/apache/cassandra/gms/Gossiper.java       | 5 +++--
 src/java/org/apache/cassandra/gms/HeartBeatState.java | 4 ++--
 3 files changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/2290c0d4/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 5173b10..4dbd984 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.1.19
+ * Clone HeartBeatState when building gossip messages. Make its generation/version volatile
(CASSANDRA-13700)
 
 
 2.1.18

http://git-wip-us.apache.org/repos/asf/cassandra/blob/2290c0d4/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 889806c..7c37917 100644
--- a/src/java/org/apache/cassandra/gms/Gossiper.java
+++ b/src/java/org/apache/cassandra/gms/Gossiper.java
@@ -860,10 +860,11 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
              * than the version passed in. In this case we also send the old
              * heart beat and throw it away on the receiver if it is redundant.
             */
+            int localHbGeneration = epState.getHeartBeatState().getGeneration();
             int localHbVersion = epState.getHeartBeatState().getHeartBeatVersion();
             if (localHbVersion > version)
             {
-                reqdEndpointState = new EndpointState(epState.getHeartBeatState());
+                reqdEndpointState = new EndpointState(new HeartBeatState(localHbGeneration,
localHbVersion));
                 if (logger.isTraceEnabled())
                     logger.trace("local heartbeat version " + localHbVersion + " greater
than " + version + " for " + forEndpoint);
             }
@@ -876,7 +877,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
                 {
                     if (reqdEndpointState == null)
                     {
-                        reqdEndpointState = new EndpointState(epState.getHeartBeatState());
+                        reqdEndpointState = new EndpointState(new HeartBeatState(localHbGeneration,
localHbVersion));
                     }
                     final ApplicationState key = entry.getKey();
                     if (logger.isTraceEnabled())

http://git-wip-us.apache.org/repos/asf/cassandra/blob/2290c0d4/src/java/org/apache/cassandra/gms/HeartBeatState.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/gms/HeartBeatState.java b/src/java/org/apache/cassandra/gms/HeartBeatState.java
index 0ae48bf..901f1c7 100644
--- a/src/java/org/apache/cassandra/gms/HeartBeatState.java
+++ b/src/java/org/apache/cassandra/gms/HeartBeatState.java
@@ -30,8 +30,8 @@ class HeartBeatState
 {
     public static final IVersionedSerializer<HeartBeatState> serializer = new HeartBeatStateSerializer();
 
-    private int generation;
-    private int version;
+    private volatile int generation;
+    private volatile int version;
 
     HeartBeatState(int gen)
     {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org


Mime
View raw message