cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [28/50] [abbrv] git commit: Prevent gossiper from adding itself to saved endpoints. Patch by brandonwilliams reviewed by Paul Cannon for CASSANDRA-3485.
Date Thu, 05 Jan 2012 20:00:30 GMT
Prevent gossiper from adding itself to saved endpoints.
Patch by brandonwilliams reviewed by Paul Cannon for CASSANDRA-3485.

git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-0.8@1212624 13f79535-47bb-0310-9956-ffa450edef68


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

Branch: refs/heads/trunk
Commit: 96d92fb5d9e16e1d7b5871e0c1117f00e2e166c6
Parents: a7d0cde
Author: Brandon Williams <brandonwilliams@apache.org>
Authored: Fri Dec 9 20:56:08 2011 +0000
Committer: Brandon Williams <brandonwilliams@apache.org>
Committed: Fri Dec 9 20:56:08 2011 +0000

----------------------------------------------------------------------
 src/java/org/apache/cassandra/db/SystemTable.java  |    2 ++
 src/java/org/apache/cassandra/gms/Gossiper.java    |    5 +++++
 .../apache/cassandra/service/StorageService.java   |   12 ++++++++++--
 3 files changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/96d92fb5/src/java/org/apache/cassandra/db/SystemTable.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/SystemTable.java b/src/java/org/apache/cassandra/db/SystemTable.java
index a1fc77f..d88c91a 100644
--- a/src/java/org/apache/cassandra/db/SystemTable.java
+++ b/src/java/org/apache/cassandra/db/SystemTable.java
@@ -100,6 +100,8 @@ public class SystemTable
      */
     public static synchronized void updateToken(InetAddress ep, Token token)
     {
+        if (ep == FBUtilities.getBroadcastAddress())
+            return;
         IPartitioner p = StorageService.getPartitioner();
         ColumnFamily cf = ColumnFamily.create(Table.SYSTEM_TABLE, STATUS_CF);
         cf.addColumn(new Column(p.getTokenFactory().toByteArray(token), ByteBuffer.wrap(ep.getAddress()),
System.currentTimeMillis()));

http://git-wip-us.apache.org/repos/asf/cassandra/blob/96d92fb5/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 9992983..b4d453a 100644
--- a/src/java/org/apache/cassandra/gms/Gossiper.java
+++ b/src/java/org/apache/cassandra/gms/Gossiper.java
@@ -995,6 +995,11 @@ public class Gossiper implements IFailureDetectionEventListener
      */
     public void addSavedEndpoint(InetAddress ep)
     {
+        if (ep == FBUtilities.getBroadcastAddress())
+        {
+            logger.debug("Attempt to add self as saved endpoint");
+            return;
+        }
         EndpointState epState = new EndpointState(new HeartBeatState(0));
         epState.markDead();
         epState.setHasToken(true);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/96d92fb5/src/java/org/apache/cassandra/service/StorageService.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/StorageService.java b/src/java/org/apache/cassandra/service/StorageService.java
index a51629f..15329db 100644
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@ -387,8 +387,16 @@ public class StorageService implements IEndpointStateChangeSubscriber,
StorageSe
             logger_.info("Loading persisted ring state");
             for (Map.Entry<Token, InetAddress> entry : SystemTable.loadTokens().entrySet())
             {
-                tokenMetadata_.updateNormalToken(entry.getKey(), entry.getValue());
-                Gossiper.instance.addSavedEndpoint(entry.getValue());
+                if (entry.getValue() == FBUtilities.getBroadcastAddress())
+                {
+                    // entry has been mistakenly added, delete it
+                    SystemTable.removeToken(entry.getKey());
+                }
+                else
+                {
+                    tokenMetadata_.updateNormalToken(entry.getKey(), entry.getValue());
+                    Gossiper.instance.addSavedEndpoint(entry.getValue());
+                }
             }
         }
 


Mime
View raw message