Cassandra
  1. Cassandra
  2. CASSANDRA-960

getRangeToEndPointMap throws nullpointerexception when there are no non-system tables

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Invalid
    • Fix Version/s: 0.7 beta 1
    • Component/s: Core
    • Labels:
      None
    1. Cassandra-960.diff
      0.9 kB
      Tupshin Harper

      Activity

      Hide
      Tupshin Harper added a comment -

      index 4a4da3a..85bc5cd 100644
      — a/src/java/org/apache/cassandra/service/StorageService.java
      +++ b/src/java/org/apache/cassandra/service/StorageService.java
      @@ -451,8 +451,13 @@ public class StorageService implements IEndPointStateChangeSubscriber, StorageSe
      {
      // some people just want to get a visual representation of things. Allow null and set it to the first
      // non-system table.

      • if (keyspace == null)
      • keyspace = DatabaseDescriptor.getNonSystemTables().get(0);
        + if (keyspace == null) { + List<String> nonSystemTables = DatabaseDescriptor.getNonSystemTables(); + if (nonSystemTables.size() == 0) + return new HashMap<Range, List<String>>(); + else + keyspace = nonSystemTables.get(0); + }

      /* All the ranges for the tokens */
      Map<Range, List<String>> map = new HashMap<Range, List<String>>();

      Show
      Tupshin Harper added a comment - index 4a4da3a..85bc5cd 100644 — a/src/java/org/apache/cassandra/service/StorageService.java +++ b/src/java/org/apache/cassandra/service/StorageService.java @@ -451,8 +451,13 @@ public class StorageService implements IEndPointStateChangeSubscriber, StorageSe { // some people just want to get a visual representation of things. Allow null and set it to the first // non-system table. if (keyspace == null) keyspace = DatabaseDescriptor.getNonSystemTables().get(0); + if (keyspace == null) { + List<String> nonSystemTables = DatabaseDescriptor.getNonSystemTables(); + if (nonSystemTables.size() == 0) + return new HashMap<Range, List<String>>(); + else + keyspace = nonSystemTables.get(0); + } /* All the ranges for the tokens */ Map<Range, List<String>> map = new HashMap<Range, List<String>>();
      Hide
      Jonathan Ellis added a comment -

      can you submit the patch as an attachment so jira formatting doesn't muck it up?

      Show
      Jonathan Ellis added a comment - can you submit the patch as an attachment so jira formatting doesn't muck it up?
      Hide
      Tupshin Harper added a comment -

      as attachment to resolve formatting issues

      Show
      Tupshin Harper added a comment - as attachment to resolve formatting issues
      Hide
      Jonathan Ellis added a comment -

      Sorry, I thought we were on the same page here in IRC.

      Patching nodetool ring to not use RangeToEndPointMap (use TokenMetadata instead) = good

      Patching RangeToEndPointMap to give garbage out on garbage in = bad

      Show
      Jonathan Ellis added a comment - Sorry, I thought we were on the same page here in IRC. Patching nodetool ring to not use RangeToEndPointMap (use TokenMetadata instead) = good Patching RangeToEndPointMap to give garbage out on garbage in = bad
      Hide
      Jonathan Ellis added a comment -

      Specifically RangeToEndPointMap means "for a given table [which determines replication strategy], what nodes are responsible for which ranges?" asking this question for no table at all (= no replication strategy) is nonsense.

      Show
      Jonathan Ellis added a comment - Specifically RangeToEndPointMap means "for a given table [which determines replication strategy] , what nodes are responsible for which ranges?" asking this question for no table at all (= no replication strategy) is nonsense.

        People

        • Assignee:
          Unassigned
          Reporter:
          Tupshin Harper
        • Votes:
          0 Vote for this issue
          Watchers:
          0 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved:

            Development