Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

javadocs

Noble Paulcfe5cffdddcf
diff --git a/solr/solrj/src/java/org/apache/solr/cloud/autoscaling/Policy.java b/solr/solrj/src/java/org/apache/solr/cloud/autoscaling/Policy.java
index de82fd59391..8a1292d1490 100644
--- a/solr/solrj/src/java/org/apache/solr/cloud/autoscaling/Policy.java
+++ b/solr/solrj/src/java/org/apache/solr/cloud/autoscaling/Policy.java
@@ -46,16 +46,25 @@ import static java.util.Collections.emptyList;
import static java.util.Collections.emptyMap;
import static java.util.stream.Collectors.toList;
+/*The class that reads, parses and applies policies specified in
+ * autoscaling.json
+ *
+ * Create one instance of this class per unique autoscaling.json.
+ * This is immutable and is thread-safe
+ *
+ * Create a fresh new session for each use
+ *
+ */
public class Policy implements MapWriter {
public static final String EACH = "#EACH";
public static final String ANY = "#ANY";
public static final String CLUSTER_POLICY = "cluster-policy";
public static final String CLUSTER_PREFERENCE = "cluster-preferences";
public static final Set<String> GLOBAL_ONLY_TAGS = Collections.unmodifiableSet(new HashSet<>(Arrays.asList("cores")));
- Map<String, List<Clause>> policies = new HashMap<>();
- List<Clause> clusterPolicy;
- List<Preference> clusterPreferences;
- List<String> params = new ArrayList<>();
+ final Map<String, List<Clause>> policies = new HashMap<>();
+ final List<Clause> clusterPolicy;
+ final List<Preference> clusterPreferences;
+ final List<String> params = new ArrayList<>();
public Policy(Map<String, Object> jsonMap) {
@@ -121,6 +130,10 @@ public class Policy implements MapWriter {
}
+ /*This stores the logical state of the system, given a policy and
+ * a cluster state.
+ *
+ */
public class Session implements MapWriter {
final List<String> nodes;
final ClusterDataProvider dataProvider;
@@ -301,6 +314,14 @@ public class Policy implements MapWriter {
}
+ /* A suggester is capable of suggesting a collection operation
+ * given a particular session. Before it suggests a new operation,
+ * it ensures that ,
+ * a) the node that it lightens load on the 'most loaded node' and/or 'lightens load'
+ * on the least loaded node
+ * b) it causes no new violations
+ *
+ */
public static abstract class Suggester {
protected final EnumMap<Hint, Object> hints = new EnumMap<>(Hint.class);
Policy.Session session;