You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by mc...@apache.org on 2019/08/09 17:49:25 UTC

[cassandra] branch cassandra-3.11 updated (c7ca9b8 -> 5d72cdd)

This is an automated email from the ASF dual-hosted git repository.

mck pushed a change to branch cassandra-3.11
in repository https://gitbox.apache.org/repos/asf/cassandra.git.


    from c7ca9b8  Merge branch 'cassandra-3.0' into cassandra-3.11
     new 2374a74  Fix NPE when using allocate_tokens_for_keyspace on new DC/rack
     new 5d72cdd  Merge branch 'cassandra-3.0' into cassandra-3.11

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 CHANGES.txt                                                         | 1 +
 .../org/apache/cassandra/dht/tokenallocator/TokenAllocation.java    | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org


[cassandra] 01/01: Merge branch 'cassandra-3.0' into cassandra-3.11

Posted by mc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

mck pushed a commit to branch cassandra-3.11
in repository https://gitbox.apache.org/repos/asf/cassandra.git

commit 5d72cdde8e4480e441e01851d3a3f452e5c2d461
Merge: c7ca9b8 2374a74
Author: Mick Semb Wever <mc...@apache.org>
AuthorDate: Fri Aug 9 19:43:13 2019 +0200

    Merge branch 'cassandra-3.0' into cassandra-3.11

 CHANGES.txt                                                         | 1 +
 .../org/apache/cassandra/dht/tokenallocator/TokenAllocation.java    | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --cc CHANGES.txt
index a1107b4,e4f4d22..5da96e6
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,9 -1,5 +1,10 @@@
 -3.0.19
 +3.11.5
 + * Make sure user defined compaction transactions are always closed (CASSANDRA-15123)
 + * Fix cassandra-env.sh to use $CASSANDRA_CONF to find cassandra-jaas.config (CASSANDRA-14305)
 + * Fixed nodetool cfstats printing index name twice (CASSANDRA-14903)
 + * Add flag to disable SASI indexes, and warnings on creation (CASSANDRA-14866)
 +Merged from 3.0:
+  * Fix NPE when using allocate_tokens_for_keyspace on new DC/rack (CASSANDRA-14592)
   * Filter sstables earlier when running cleanup (CASSANDRA-15100)
   * Use mean row count instead of mean column count for index selectivity calculation (CASSANDRA-15259)
   * Avoid updating unchanged gossip states (CASSANDRA-15097)
diff --cc src/java/org/apache/cassandra/dht/tokenallocator/TokenAllocation.java
index 9c50613,5501378..8a3ede7
--- a/src/java/org/apache/cassandra/dht/tokenallocator/TokenAllocation.java
+++ b/src/java/org/apache/cassandra/dht/tokenallocator/TokenAllocation.java
@@@ -200,33 -198,12 +200,37 @@@ public class TokenAllocatio
          final String dc = snitch.getDatacenter(endpoint);
          final int replicas = rs.getReplicationFactor(dc);
  
 +        if (replicas == 0 || replicas == 1)
 +        {
 +            // No replication, each node is treated as separate.
 +            return new StrategyAdapter()
 +            {
 +                @Override
 +                public int replicas()
 +                {
 +                    return 1;
 +                }
 +
 +                @Override
 +                public Object getGroup(InetAddress unit)
 +                {
 +                    return unit;
 +                }
 +
 +                @Override
 +                public boolean inAllocationRing(InetAddress other)
 +                {
 +                    return dc.equals(snitch.getDatacenter(other));
 +                }
 +            };
 +        }
 +
          Topology topology = tokenMetadata.getTopology();
-         int racks = topology.getDatacenterRacks().get(dc).asMap().size();
+ 
+         // if topology hasn't been setup yet for this endpoint+rack then treat it as a separate unit
+         int racks = topology.getDatacenterRacks().get(dc) != null && topology.getDatacenterRacks().get(dc).containsKey(snitch.getRack(endpoint))
+                 ? topology.getDatacenterRacks().get(dc).asMap().size()
+                 : 1;
  
          if (racks >= replicas)
          {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org