Updated Branches: refs/heads/cassandra-2.0 111c74ef9 -> c198b76c4
Fix NPE if StorageService.getOperationMode() is executed before full startup patch by cwarrington reviewed by dbrosius for cassandra-6166 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/c198b76c Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/c198b76c Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/c198b76c Branch: refs/heads/cassandra-2.0 Commit: c198b76c46e4beae45e2a98910322a8761b73684 Parents: 111c74e Author: Dave Brosius <dbros...@mebigfatguy.com> Authored: Tue Oct 8 20:37:50 2013 -0400 Committer: Dave Brosius <dbros...@mebigfatguy.com> Committed: Tue Oct 8 20:37:50 2013 -0400 ---------------------------------------------------------------------- CHANGES.txt | 1 + src/java/org/apache/cassandra/service/StorageService.java | 4 ++-- .../apache/cassandra/service/StorageServiceServerTest.java | 7 +++++++ 3 files changed, 10 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/c198b76c/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 4375475..2b37a39 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -21,6 +21,7 @@ * Disallow empty column names in cql (CASSANDRA-6136) * Use Java7 file-handling APIs and fix file moving on Windows (CASSANDRA-5383) * Save compaction history to system keyspace (CASSANDRA-5078) + * Fix NPE if StorageService.getOperationMode() is executed before full startup (CASSANDRA-6166) Merged from 1.2: * Limit CQL prepared statement cache by size instead of count (CASSANDRA-6107) * Tracing should log write failure rather than raw exceptions (CASSANDRA-6133) http://git-wip-us.apache.org/repos/asf/cassandra/blob/c198b76c/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 bff909e..33fa25d 100644 --- a/src/java/org/apache/cassandra/service/StorageService.java +++ b/src/java/org/apache/cassandra/service/StorageService.java @@ -175,8 +175,8 @@ public class StorageService extends NotificationBroadcasterSupport implements IE /* the probability for tracing any particular request, 0 disables tracing and 1 enables for all */ private double tracingProbability = 0.0; - private static enum Mode { NORMAL, CLIENT, JOINING, LEAVING, DECOMMISSIONED, MOVING, DRAINING, DRAINED, RELOCATING } - private Mode operationMode; + private static enum Mode { STARTING, NORMAL, CLIENT, JOINING, LEAVING, DECOMMISSIONED, MOVING, DRAINING, DRAINED, RELOCATING } + private Mode operationMode = Mode.STARTING; private final MigrationManager migrationManager = MigrationManager.instance; http://git-wip-us.apache.org/repos/asf/cassandra/blob/c198b76c/test/unit/org/apache/cassandra/service/StorageServiceServerTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/service/StorageServiceServerTest.java b/test/unit/org/apache/cassandra/service/StorageServiceServerTest.java index 503a730..7189a26 100644 --- a/test/unit/org/apache/cassandra/service/StorageServiceServerTest.java +++ b/test/unit/org/apache/cassandra/service/StorageServiceServerTest.java @@ -263,4 +263,11 @@ public class StorageServiceServerTest assert primaryRanges.size() == 1; assert primaryRanges.contains(new Range<Token>(new StringToken("B"), new StringToken("C"))); } + + @Test + public void testGetOperationMode() + { + String operationMode = StorageService.instance.getOperationMode(); + assert operationMode.equals("STARTING"); + } }