cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brandonwilli...@apache.org
Subject [6/8] git commit: Don't check for expireTime is node isn't in REMOVED Patch by thobbs, reviewed by brandonwilliams for CASSANDRA-6564
Date Fri, 24 Jan 2014 18:53:10 GMT
Don't check for expireTime is node isn't in REMOVED
Patch by thobbs, reviewed by brandonwilliams for CASSANDRA-6564


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

Branch: refs/heads/trunk
Commit: a16986374450c0e8c1bd1de8933042998a079f13
Parents: b40b98d
Author: Brandon Williams <brandonwilliams@apache.org>
Authored: Fri Jan 24 12:50:34 2014 -0600
Committer: Brandon Williams <brandonwilliams@apache.org>
Committed: Fri Jan 24 12:50:34 2014 -0600

----------------------------------------------------------------------
 .../org/apache/cassandra/service/StorageService.java   |  3 ++-
 .../cassandra/service/LeaveAndBootstrapTest.java       | 13 +++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/a1698637/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 345d6c9..0870362 100644
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@ -1714,7 +1714,8 @@ public class StorageService extends NotificationBroadcasterSupport implements
IE
         }
         else // now that the gossiper has told us about this nonexistent member, notify the
gossiper to remove it
         {
-            addExpireTimeIfFound(endpoint, extractExpireTime(pieces));
+            if (VersionedValue.REMOVED_TOKEN.equals(pieces[0]))
+                addExpireTimeIfFound(endpoint, extractExpireTime(pieces));
             removeEndpoint(endpoint);
         }
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/a1698637/test/unit/org/apache/cassandra/service/LeaveAndBootstrapTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/service/LeaveAndBootstrapTest.java b/test/unit/org/apache/cassandra/service/LeaveAndBootstrapTest.java
index a9d8057..584768a 100644
--- a/test/unit/org/apache/cassandra/service/LeaveAndBootstrapTest.java
+++ b/test/unit/org/apache/cassandra/service/LeaveAndBootstrapTest.java
@@ -681,6 +681,19 @@ public class LeaveAndBootstrapTest
         assertEquals("rack42", SystemKeyspace.loadDcRackInfo().get(toRemove).get("rack"));
     }
 
+    @Test
+    public void testRemovingStatusForNonMember()  throws UnknownHostException
+    {
+        // create a ring of 1 node
+        StorageService ss = StorageService.instance;
+        VersionedValue.VersionedValueFactory valueFactory = new VersionedValue.VersionedValueFactory(partitioner);
+        Util.createInitialRing(ss, partitioner, new ArrayList<Token>(), new ArrayList<Token>(),
 new ArrayList<InetAddress>(), new ArrayList<UUID>(), 1);
+
+        // make a REMOVING state change on a non-member endpoint; without the CASSANDRA-6564
fix, this
+        // would result in an ArrayIndexOutOfBoundsException
+        ss.onChange(InetAddress.getByName("192.168.1.42"), ApplicationState.STATUS, valueFactory.removingNonlocal(UUID.randomUUID()));
+    }
+
     private static Collection<InetAddress> makeAddrs(String... hosts) throws UnknownHostException
     {
         ArrayList<InetAddress> addrs = new ArrayList<InetAddress>(hosts.length);


Mime
View raw message