use of com.yahoo.vdslib.state.ClusterState in project vespa by vespa-engine.
the class DistributionTestFactory method setNodeCount.
public DistributionTestFactory setNodeCount(int count) throws Exception {
nodeCount = count;
distributionConfig = deserializeConfig(Distribution.getDefaultDistributionConfig(redundancy, nodeCount));
state = new ClusterState("distributor:" + nodeCount);
return this;
}
use of com.yahoo.vdslib.state.ClusterState 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.vdslib.state.ClusterState in project vespa by vespa-engine.
the class MessageBusVisitorSession method handleWrongDistributionReply.
private void handleWrongDistributionReply(WrongDistributionReply reply) {
try {
ClusterState newState = new ClusterState(reply.getSystemState());
int stateBits = newState.getDistributionBitCount();
if (stateBits != progress.getIterator().getDistributionBitCount()) {
log.log(LogLevel.DEBUG, "System state changed; now at " + stateBits + " distribution bits");
// Update the internal state of the visitor iterator. If we're increasing
// the number of distribution bits, this may lead to splitting of pending
// buckets. If we're decreasing, it may lead to merging of pending buckets
// and potential loss of sub-bucket progress. In either way, the iterator
// will not let any new buckets out before all active buckets have been
// updated.
progress.getIterator().setDistributionBitCount(stateBits);
}
} catch (Exception e) {
log.log(LogLevel.ERROR, "Failed to parse new system state string: " + reply.getSystemState());
transitionTo(new StateDescription(State.FAILED, "Failed to parse cluster state '" + reply.getSystemState() + "'"));
}
}
Aggregations