Search in sources :

Example 1 with PendingRangeMaps

use of org.apache.cassandra.locator.PendingRangeMaps in project cassandra by apache.

the class PendingRangesBench method setUp.

@Setup
public void setUp() throws UnknownHostException {
    pendingRangeMaps = new PendingRangeMaps();
    oldPendingRanges = HashMultimap.create();
    InetAddress[] addresses = { InetAddress.getByName("127.0.0.1"), InetAddress.getByName("127.0.0.2") };
    for (int i = 0; i < maxToken; i++) {
        for (int j = 0; j < ThreadLocalRandom.current().nextInt(2); j++) {
            Range<Token> range = genRange(Integer.toString(i * 10 + 5), Integer.toString(i * 10 + 15));
            pendingRangeMaps.addPendingRange(range, addresses[j]);
            oldPendingRanges.put(range, addresses[j]);
        }
    }
    // add the wrap around range
    for (int j = 0; j < ThreadLocalRandom.current().nextInt(2); j++) {
        Range<Token> range = genRange(Integer.toString(maxToken * 10 + 5), Integer.toString(5));
        pendingRangeMaps.addPendingRange(range, addresses[j]);
        oldPendingRanges.put(range, addresses[j]);
    }
}
Also used : Token(org.apache.cassandra.dht.Token) PendingRangeMaps(org.apache.cassandra.locator.PendingRangeMaps) InetAddress(java.net.InetAddress)

Aggregations

InetAddress (java.net.InetAddress)1 Token (org.apache.cassandra.dht.Token)1 PendingRangeMaps (org.apache.cassandra.locator.PendingRangeMaps)1