mirror of https://github.com/apache/cassandra
Fix RandomReplicationAwareTokenAllocatorTest.testExistingCluster
Patch by Stefania Alborghetti; reviewed by Branimir Lambov for CASSANDRA-12812
This commit is contained in:
parent
26ee16b5f7
commit
e6d22da918
|
|
@ -1,4 +1,5 @@
|
|||
3.10
|
||||
* Fix RandomReplicationAwareTokenAllocatorTest.testExistingCluster (CASSANDRA-12812)
|
||||
* Upgrade commons-codec to 1.9 (CASSANDRA-12790)
|
||||
* Make the fanout size for LeveledCompactionStrategy to be configurable (CASSANDRA-11550)
|
||||
* Add duration data type (CASSANDRA-11873)
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ public class RandomPartitioner implements IPartitioner
|
|||
|
||||
public BigIntegerToken getRandomToken(Random random)
|
||||
{
|
||||
BigInteger token = FBUtilities.hashToBigInteger(GuidGenerator.guidAsBytes(random, 0));
|
||||
BigInteger token = FBUtilities.hashToBigInteger(GuidGenerator.guidAsBytes(random, "host/127.0.0.1", 0));
|
||||
if ( token.signum() == -1 )
|
||||
token = token.multiply(BigInteger.valueOf(-1L));
|
||||
return new BigIntegerToken(token);
|
||||
|
|
|
|||
|
|
@ -76,12 +76,11 @@ public class GuidGenerator
|
|||
return convertToStandardFormat( sb.toString() );
|
||||
}
|
||||
|
||||
public static ByteBuffer guidAsBytes(Random random, long time)
|
||||
public static ByteBuffer guidAsBytes(Random random, String hostId, long time)
|
||||
{
|
||||
StringBuilder sbValueBeforeMD5 = new StringBuilder();
|
||||
long rand = 0;
|
||||
rand = random.nextLong();
|
||||
sbValueBeforeMD5.append(s_id)
|
||||
long rand = random.nextLong();
|
||||
sbValueBeforeMD5.append(hostId)
|
||||
.append(":")
|
||||
.append(Long.toString(time))
|
||||
.append(":")
|
||||
|
|
@ -93,7 +92,7 @@ public class GuidGenerator
|
|||
|
||||
public static ByteBuffer guidAsBytes()
|
||||
{
|
||||
return guidAsBytes(myRand, System.currentTimeMillis());
|
||||
return guidAsBytes(myRand, s_id, System.currentTimeMillis());
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in New Issue