summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config-model/src/main/java/com/yahoo/config/model/provision/SingleNodeProvisioner.java1
-rw-r--r--configdefinitions/src/vespa/distribution.def28
-rw-r--r--configdefinitions/src/vespa/document-protocol-policies.def25
-rw-r--r--configdefinitions/src/vespa/stor-distribution.def6
-rw-r--r--vdslib/src/main/java/com/yahoo/vdslib/distribution/Distribution.java17
-rw-r--r--vdslib/src/main/java/com/yahoo/vdslib/distribution/Group.java2
6 files changed, 74 insertions, 5 deletions
diff --git a/config-model/src/main/java/com/yahoo/config/model/provision/SingleNodeProvisioner.java b/config-model/src/main/java/com/yahoo/config/model/provision/SingleNodeProvisioner.java
index d6cccc9f2be..0cfe35a51b5 100644
--- a/config-model/src/main/java/com/yahoo/config/model/provision/SingleNodeProvisioner.java
+++ b/config-model/src/main/java/com/yahoo/config/model/provision/SingleNodeProvisioner.java
@@ -10,7 +10,6 @@ import com.yahoo.config.provision.HostSpec;
import com.yahoo.config.provision.NodeResources;
import com.yahoo.config.provision.ProvisionLogger;
import com.yahoo.net.HostName;
-import com.yahoo.vespa.config.content.StorDistributionConfig;
import java.util.ArrayList;
import java.util.List;
diff --git a/configdefinitions/src/vespa/distribution.def b/configdefinitions/src/vespa/distribution.def
new file mode 100644
index 00000000000..f2027fa4eb7
--- /dev/null
+++ b/configdefinitions/src/vespa/distribution.def
@@ -0,0 +1,28 @@
+# Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+namespace=vespa.config.content
+
+##
+## Super config for distribution in each content cluster, keyed by cluster id.
+##
+
+# How many copies of a document are stored, across nodes.
+cluster{}.redundancy int default=3
+
+# Hierarchical grouping divides the nodes into a tree of groups. The index is the
+# string representation of a path from the root node in this tree, e.g., "1.2.1".
+cluster{}.group[].index string
+
+# Each group needs to have a name. Obviously. Duh.
+cluster{}.group[].name string
+
+# Capacity of the given group.
+cluster{}.group[].capacity double default=1
+
+# Partitions define how copies are divided among child groups/nodes.
+cluster{}.group[].partitions string default=""
+
+# Leaf groups will have a set of nodes within them. Branch groups will have none.
+cluster{}.group[].nodes[].index int
+
+# Whether this node is retired, and data should migrate out of it.
+cluster{}.group[].nodes[].retired bool default=false \ No newline at end of file
diff --git a/configdefinitions/src/vespa/document-protocol-policies.def b/configdefinitions/src/vespa/document-protocol-policies.def
new file mode 100644
index 00000000000..e752a542cbd
--- /dev/null
+++ b/configdefinitions/src/vespa/document-protocol-policies.def
@@ -0,0 +1,25 @@
+# Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+namespace=messagebus.documentapi
+
+##
+## Super config for all policies in the document protocol, keyed by content cluster ids.
+## Note: ContentPolicy also uses the "distribution" config.
+##
+
+#
+# Config used by MessageTypeRouteSelectorPolicy
+#
+# Default route if no override is set for a type.
+cluster{}.defaultRoute string
+
+# The name of the route.
+cluster{}.route[].name string
+
+# The document protocol message type triggering this route.
+cluster{}.route[].messageType int
+
+#
+# Config used by DocumentRouteSelectorPolicy
+#
+# The document selector for this cluster route.
+cluster{}.selector string
diff --git a/configdefinitions/src/vespa/stor-distribution.def b/configdefinitions/src/vespa/stor-distribution.def
index 518626228c1..c8a9f30be91 100644
--- a/configdefinitions/src/vespa/stor-distribution.def
+++ b/configdefinitions/src/vespa/stor-distribution.def
@@ -10,14 +10,17 @@ redundancy int default=3
## a subset of all copies have been persisted (known as initial persistence
## in BCP terms).
## Set to 0 to disable and use normal redundancy behavior instead.
+## TODO: seems unused
initial_redundancy int default=0
## If set, requires that the primary nodes copy should always be persisted
## before an n-of-m initial persistence operation can complete.
+## TODO: seems unused
ensure_primary_persisted bool default=true
## The number of copies that should be "ready" to be active.
## Maximum is redundancy.
+## TODO: seems unused
ready_copies int default=0
## If this option is set true, the distributor will try to enforce one active copy
@@ -29,6 +32,7 @@ ready_copies int default=0
## - ready_copies == redundancy
## - Only one level of hierarchical grouping defined.
## - That level distributes copies to all defined groups.
+## TODO: seems unused
active_per_leaf_group bool default=false
## Search have some unfortunate properties with some queries, adding a static
@@ -36,6 +40,7 @@ active_per_leaf_group bool default=false
## these cases they use many small groups to be able to scale. In such cases,
## where groups are small, having distributors able to take over when none are
## available in a group is useful.
+## TODO: seems unused, i.e., always true
distributor_auto_ownership_transfer_on_whole_group_down bool default=true
## Hierarchical grouping divides the nodes into a tree of groups. Due to config
@@ -67,4 +72,5 @@ group[].nodes[].retired bool default=false
## MODULO_INDEX with node index in seed
## MODULO_KNUTH with random(node index) in seed
## MODULO_BID using all used bits, except count bits, and random(node index)
+## TODO: seems unused
disk_distribution enum { MODULO, MODULO_INDEX, MODULO_KNUTH, MODULO_BID } default=MODULO_BID
diff --git a/vdslib/src/main/java/com/yahoo/vdslib/distribution/Distribution.java b/vdslib/src/main/java/com/yahoo/vdslib/distribution/Distribution.java
index c9acd625373..16f18cf8f8b 100644
--- a/vdslib/src/main/java/com/yahoo/vdslib/distribution/Distribution.java
+++ b/vdslib/src/main/java/com/yahoo/vdslib/distribution/Distribution.java
@@ -68,7 +68,7 @@ public class Distribution {
try{
Group root = null;
for (int i=0; i<config.group().size(); ++i) {
- StorDistributionConfig.Group cg = config.group().get(i);
+ StorDistributionConfig.Group cg = config.group(i);
int[] path = new int[0];
if (root != null) {
path = getGroupPath(cg.index());
@@ -172,6 +172,7 @@ public class Distribution {
return Double.compare(o.score, score);
}
}
+
private static class ScoredNode {
int index;
int reliability;
@@ -179,6 +180,7 @@ public class Distribution {
ScoredNode(int index, int reliability, double score) { this.index = index; this.reliability = reliability; this.score = score; }
}
+
private static boolean allDistributorsDown(Group g, ClusterState clusterState) {
if (g.isLeafGroup()) {
for (ConfiguredNode node : g.getNodes()) {
@@ -192,6 +194,7 @@ public class Distribution {
}
return true;
}
+
private Group getIdealDistributorGroup(boolean distributorAutoOwnershipTransferOnWholeGroupDown,
BucketId bucket, ClusterState clusterState, Group parent, int redundancy) {
if (parent.isLeafGroup()) {
@@ -220,6 +223,7 @@ public class Distribution {
}
return getIdealDistributorGroup(distributorAutoOwnershipTransferOnWholeGroupDown, bucket, clusterState, results.first().group, redundancyArray[0]);
}
+
private static class ResultGroup implements Comparable<ResultGroup> {
Group group;
int redundancy;
@@ -234,6 +238,7 @@ public class Distribution {
return group.compareTo(o.group);
}
}
+
private void getIdealGroups(BucketId bucketId, ClusterState clusterState, Group parent,
int redundancy, List<ResultGroup> results) {
if (parent.isLeafGroup()) {
@@ -424,11 +429,13 @@ public class Distribution {
super(message);
}
}
+
public static class NoDistributorsAvailableException extends Exception {
NoDistributorsAvailableException(String message) {
super(message);
}
}
+
public int getIdealDistributorNode(ClusterState state, BucketId bucket, String upStates) throws TooFewBucketBitsInUseException, NoDistributorsAvailableException {
if (bucket.getUsedBits() < state.getDistributionBitCount()) {
throw new TooFewBucketBitsInUseException("Cannot get ideal state for bucket " + bucket + " using " + bucket.getUsedBits()
@@ -474,6 +481,7 @@ public class Distribution {
}
return node.index;
}
+
private boolean visitGroups(GroupVisitor visitor, Map<Integer, Group> groups) {
for (Group g : groups.values()) {
if (!visitor.visitGroup(g)) return false;
@@ -485,12 +493,14 @@ public class Distribution {
}
return true;
}
+
public void visitGroups(GroupVisitor visitor) {
Map<Integer, Group> groups = new TreeMap<>();
Group nodeGraph = config.getAcquire().nodeGraph;
groups.put(nodeGraph.getIndex(), nodeGraph);
visitGroups(visitor, groups);
}
+
public Set<ConfiguredNode> getNodes() {
final Set<ConfiguredNode> nodes = new HashSet<>();
GroupVisitor visitor = new GroupVisitor() {
@@ -524,9 +534,11 @@ public class Distribution {
sb.append("disk_distribution ").append(diskDistribution.toString()).append("\n");
return sb.toString();
}
+
public static String getSimpleGroupConfig(int redundancy, int nodeCount) {
return getSimpleGroupConfig(redundancy, nodeCount, StorDistributionConfig.Disk_distribution.Enum.MODULO_BID);
}
+
private static String getSimpleGroupConfig(int redundancy, int nodeCount, StorDistributionConfig.Disk_distribution.Enum diskDistribution) {
StringBuilder sb = new StringBuilder();
sb.append("raw:redundancy ").append(redundancy).append("\n").append("group[4]\n");
@@ -561,6 +573,5 @@ public class Distribution {
sb.append("disk_distribution ").append(diskDistribution.toString()).append("\n");
return sb.toString();
}
-}
-
+}
diff --git a/vdslib/src/main/java/com/yahoo/vdslib/distribution/Group.java b/vdslib/src/main/java/com/yahoo/vdslib/distribution/Group.java
index 680021893f7..458ab6e291c 100644
--- a/vdslib/src/main/java/com/yahoo/vdslib/distribution/Group.java
+++ b/vdslib/src/main/java/com/yahoo/vdslib/distribution/Group.java
@@ -196,7 +196,7 @@ public class Group implements Comparable<Group> {
/**
* The distribution class keeps precalculated arrays for distributions for all legal redundancies. The class is
- * immutable, such that it can be returned safely out from the group object.
+ * immutable, such that it can be returned safely out from the group object. (Actually, it's not immutable.)
*/
public static class Distribution {