use of com.yahoo.document.BucketId in project vespa by vespa-engine.
the class DistributionTestCase method testHierarchicalDistributionDeep.
@Test
public void testHierarchicalDistributionDeep() throws Exception {
System.out.println(new StorDistributionConfig(buildHierarchicalConfig(8, 5, 3, "*|*", 3)));
test = new DistributionTestFactory("hierarchical-grouping-deep").setNodeCount(500).setDistribution(buildHierarchicalConfig(8, 5, 3, "*|*", 3));
for (BucketId bucket : getTestBuckets()) {
test.recordResult(bucket).assertNodeCount(1);
}
Set<ConfiguredNode> nodes = test.getDistribution().getNodes();
// Despite setNodeCount(500) above, the actual distribution config
// itself only has 375 actual leaf nodes.
assertEquals(375, nodes.size());
}
use of com.yahoo.document.BucketId in project vespa by vespa-engine.
the class BucketDistributionTestCase method testNumBucketBits.
public void testNumBucketBits() {
Random rnd = new Random();
BucketDistribution bd = new BucketDistribution(1, 4);
for (int i = 0; i <= 0xf; ++i) {
assertEquals(0, bd.getColumn(new BucketId(32, (rnd.nextLong() << 4) & i)));
}
bd = new BucketDistribution(1, 8);
for (int i = 0; i <= 0xff; ++i) {
assertEquals(0, bd.getColumn(new BucketId(32, (rnd.nextLong() << 8) & i)));
}
bd = new BucketDistribution(1, 16);
for (int i = 0; i <= 0xffff; ++i) {
assertEquals(0, bd.getColumn(new BucketId(32, (rnd.nextLong() << 16) & i)));
}
}
use of com.yahoo.document.BucketId in project vespa by vespa-engine.
the class DistributionTestFactory method parse.
public void parse(String serialized) throws Exception {
JSONObject json = new JSONObject(serialized);
upStates = json.getString("up-states");
nodeCount = json.getInt("redundancy");
redundancy = json.getInt("redundancy");
state = new ClusterState(json.getString("cluster-state"));
distributionConfig = deserializeConfig(json.getString("distribution"));
nodeType = NodeType.get(json.getString("node-type"));
JSONArray results = json.getJSONArray("result");
for (int i = 0; i < results.length(); ++i) {
JSONObject result = results.getJSONObject(i);
Test t = new Test(new BucketId(Long.parseLong(result.getString("bucket"), 16)));
{
JSONArray nodes = result.getJSONArray("nodes");
for (int j = 0; j < nodes.length(); ++j) {
t.nodes.add(nodes.getInt(j));
}
}
if (nodeType == NodeType.STORAGE) {
JSONArray disks = result.getJSONArray("disks");
for (int j = 0; j < disks.length(); ++j) {
t.disks.add(disks.getInt(j));
}
}
t.failure = Failure.valueOf(result.getString("failure"));
this.results.add(t);
}
}
use of com.yahoo.document.BucketId in project vespa by vespa-engine.
the class ContinuationHitTest method createMultiBucketProgress.
/**
* Returns a ProgressToken whose base 64 representation will be _more_ than 76 bytes (MIME line limit)
*/
private ProgressToken createMultiBucketProgress() {
ProgressToken token = new ProgressToken(16);
Set<BucketId> buckets = new TreeSet<>();
buckets.add(new BucketId(58, 0x123456789abcfeffL));
buckets.add(new BucketId(58, 0x123456789abcfefaL));
buckets.add(new BucketId(58, 0x123456789abcfefbL));
// "Prime" the token.
VisitorIterator.createFromExplicitBucketSet(buckets, 16, token);
return token;
}
use of com.yahoo.document.BucketId in project vespa by vespa-engine.
the class ContinuationHitTest method createSingleBucketProgress.
/**
* Returns a ProgressToken whose base 64 representation will be _less_ than 76 bytes (MIME line limit)
*/
private ProgressToken createSingleBucketProgress() {
ProgressToken token = new ProgressToken(16);
// Use explicit bucket set so we can better control the binary representation
// of the buckets, and thus the values written as base 64.
Set<BucketId> buckets = new TreeSet<>();
// This particular bucket ID will contain +/ chars when output as non-URL safe base 64.
buckets.add(new BucketId(58, 0x123456789abcfeffL));
// "Prime" the token.
VisitorIterator.createFromExplicitBucketSet(buckets, 16, token);
return token;
}
Aggregations