cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [5/6] cassandra git commit: Merge branch 'cassandra-3.0' into cassandra-3.11
Date Tue, 07 Nov 2017 16:11:33 GMT
Merge branch 'cassandra-3.0' into cassandra-3.11


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

Branch: refs/heads/cassandra-3.11
Commit: ab6201c65b193c2df4c2f25f779a591c917b1df8
Parents: 6d429cd 58daf13
Author: Sam Tunnicliffe <sam@beobal.com>
Authored: Tue Nov 7 13:59:20 2017 +0000
Committer: Sam Tunnicliffe <sam@beobal.com>
Committed: Tue Nov 7 13:59:20 2017 +0000

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../apache/cassandra/dht/RandomPartitioner.java | 43 ++++++++++++++++++--
 .../org/apache/cassandra/utils/FBUtilities.java | 19 ---------
 3 files changed, 40 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/ab6201c6/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 275294f,3f4f3f2..1269dcf
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,8 -1,5 +1,9 @@@
 -3.0.16
 +3.11.2
 + * Round buffer size to powers of 2 for the chunk cache (CASSANDRA-13897)
 + * Update jackson JSON jars (CASSANDRA-13949)
 + * Avoid locks when checking LCS fanout and if we should defrag (CASSANDRA-13930)
 +Merged from 3.0:
+  * Tracing interferes with digest requests when using RandomPartitioner (CASSANDRA-13964)
   * Add flag to disable materialized views, and warnings on creation (CASSANDRA-13959)
   * Don't let user drop or generally break tables in system_distributed (CASSANDRA-13813)
   * Provide a JMX call to sync schema with local storage (CASSANDRA-13954)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/ab6201c6/src/java/org/apache/cassandra/dht/RandomPartitioner.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/dht/RandomPartitioner.java
index 82c2493,c7837c9..bdf8b85
--- a/src/java/org/apache/cassandra/dht/RandomPartitioner.java
+++ b/src/java/org/apache/cassandra/dht/RandomPartitioner.java
@@@ -117,20 -103,7 +141,20 @@@ public class RandomPartitioner implemen
          return new BigIntegerToken(token);
      }
  
 -    private final Token.TokenFactory tokenFactory = new Token.TokenFactory() {
 +    public BigIntegerToken getRandomToken(Random random)
 +    {
-         BigInteger token = FBUtilities.hashToBigInteger(GuidGenerator.guidAsBytes(random,
"host/127.0.0.1", 0));
++        BigInteger token = hashToBigInteger(GuidGenerator.guidAsBytes(random, "host/127.0.0.1",
0));
 +        if ( token.signum() == -1 )
 +            token = token.multiply(BigInteger.valueOf(-1L));
 +        return new BigIntegerToken(token);
 +    }
 +
 +    private boolean isValidToken(BigInteger token) {
 +        return token.compareTo(ZERO) >= 0 && token.compareTo(MAXIMUM) <= 0;
 +    }
 +
 +    private final Token.TokenFactory tokenFactory = new Token.TokenFactory()
 +    {
          public ByteBuffer toByteArray(Token token)
          {
              BigIntegerToken bigIntegerToken = (BigIntegerToken) token;
@@@ -275,9 -230,14 +300,19 @@@
          return partitionOrdering;
      }
  
 +    public Optional<Splitter> splitter()
 +    {
 +        return Optional.of(splitter);
 +    }
 +
+     private static BigInteger hashToBigInteger(ByteBuffer data)
+     {
+         MessageDigest messageDigest = localMD5Digest.get();
+         if (data.hasArray())
+             messageDigest.update(data.array(), data.arrayOffset() + data.position(), data.remaining());
+         else
+             messageDigest.update(data.duplicate());
+ 
+         return new BigInteger(messageDigest.digest()).abs();
+     }
  }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/ab6201c6/src/java/org/apache/cassandra/utils/FBUtilities.java
----------------------------------------------------------------------


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


Mime
View raw message