cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jji...@apache.org
Subject [1/6] cassandra git commit: Fix NPE issue in StorageService
Date Sat, 08 Apr 2017 02:56:22 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-3.0 833c993b8 -> fee2a3a09
  refs/heads/cassandra-3.11 8eeea07f5 -> 99881b971
  refs/heads/trunk 39bf436fa -> 7fa1577c2


Fix NPE issue in StorageService

Patch by Jay Zhuang; Reviewed by Jeff Jirsa for CASSANDRa-13060


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

Branch: refs/heads/cassandra-3.0
Commit: fee2a3a0958b801e1c3b26b7ad7d4ce1a79868bd
Parents: 833c993
Author: Jay Zhuang <jay.zhuang@yahoo.com>
Authored: Tue Dec 20 11:45:24 2016 -0800
Committer: Jeff Jirsa <jeff@jeffjirsa.net>
Committed: Fri Apr 7 19:52:30 2017 -0700

----------------------------------------------------------------------
 CHANGES.txt                                               | 1 +
 src/java/org/apache/cassandra/service/StorageService.java | 9 ++++++---
 2 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/fee2a3a0/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 33d5028..7b577dd 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -17,6 +17,7 @@
  * Add formatted row output to assertEmpty in CQL Tester (CASSANDRA-13238)
  * Legacy caching options can prevent 3.0 upgrade (CASSANDRA-13384)
  * Nodetool upgradesstables/scrub/compact ignores system tables (CASSANDRA-13410)
+ * Fix NPE issue in StorageService (CASSANDRA-13060)
 Merged from 2.2:
  * Honor truststore-password parameter in cassandra-stress (CASSANDRA-12773)
  * Discard in-flight shadow round responses (CASSANDRA-12653)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/fee2a3a0/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 aa3407b..143b402 100644
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@ -1850,13 +1850,16 @@ public class StorageService extends NotificationBroadcasterSupport
implements IE
 
     private boolean isStatus(InetAddress endpoint, String status)
     {
-        return Gossiper.instance.getEndpointStateForEndpoint(endpoint).getStatus().equals(status);
+        EndpointState state = Gossiper.instance.getEndpointStateForEndpoint(endpoint);
+        return state != null && state.getStatus().equals(status);
     }
 
     public boolean isRpcReady(InetAddress endpoint)
     {
-        return MessagingService.instance().getVersion(endpoint) < MessagingService.VERSION_22
||
-                Gossiper.instance.getEndpointStateForEndpoint(endpoint).isRpcReady();
+        if (MessagingService.instance().getVersion(endpoint) < MessagingService.VERSION_22)
+            return true;
+        EndpointState state = Gossiper.instance.getEndpointStateForEndpoint(endpoint);
+        return state != null && state.isRpcReady();
     }
 
     /**


Mime
View raw message