You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ho...@apache.org on 2022/01/14 18:35:04 UTC
[solr] branch main updated: SOLR-15209: Rename the LegacyPlacementPolicy to the SimplePlacementPolicy
This is an automated email from the ASF dual-hosted git repository.
houston pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/main by this push:
new da7ce14 SOLR-15209: Rename the LegacyPlacementPolicy to the SimplePlacementPolicy
da7ce14 is described below
commit da7ce14ee9da3a7eae935d5f22240131127d7036
Author: Houston Putman <ho...@apache.org>
AuthorDate: Fri Jan 14 12:52:02 2022 -0500
SOLR-15209: Rename the LegacyPlacementPolicy to the SimplePlacementPolicy
---
solr/CHANGES.txt | 2 +-
.../src/java/org/apache/solr/cloud/api/collections/Assign.java | 6 +++---
.../apache/solr/cluster/placement/PlacementPluginFactory.java | 4 ++--
...LegacyPlacementFactory.java => SimplePlacementFactory.java} | 8 ++++----
solr/solr-ref-guide/src/replica-placement-plugins.adoc | 10 ++++++----
5 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index ac19b1a..5b739c0 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -229,7 +229,7 @@ when told to. The admin UI now tells it to. (Nazerke Seidan, David Smiley)
* SOLR-14608: Faster sorting for the /export handler (Joel Bernstein)
-* SOLR-15209: The old LegacyAssignStrategy has been refactored into the LegacyPlacementPlugin. This is still the default
+* SOLR-15209: The old LegacyAssignStrategy has been refactored into the SimplePlacementPlugin. This is still the default
placement policy for Solr. (Houston Putman, Ilan Ginzburg)
Build
diff --git a/solr/core/src/java/org/apache/solr/cloud/api/collections/Assign.java b/solr/core/src/java/org/apache/solr/cloud/api/collections/Assign.java
index 02a573c..f20726d 100644
--- a/solr/core/src/java/org/apache/solr/cloud/api/collections/Assign.java
+++ b/solr/core/src/java/org/apache/solr/cloud/api/collections/Assign.java
@@ -30,7 +30,7 @@ import org.apache.solr.client.solrj.cloud.BadVersionException;
import org.apache.solr.client.solrj.cloud.VersionedData;
import org.apache.solr.cluster.placement.PlacementPlugin;
import org.apache.solr.cluster.placement.impl.PlacementPluginAssignStrategy;
-import org.apache.solr.cluster.placement.plugins.LegacyPlacementFactory;
+import org.apache.solr.cluster.placement.plugins.SimplePlacementFactory;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.cloud.ClusterState;
import org.apache.solr.common.cloud.DocCollection;
@@ -463,7 +463,7 @@ public class Assign {
/**
* Creates the appropriate instance of {@link AssignStrategy} based on how the cluster and/or individual collections are
* configured.
- * <p>If {@link PlacementPlugin} instance is null this call will return a strategy from {@link LegacyPlacementFactory}, otherwise
+ * <p>If {@link PlacementPlugin} instance is null this call will return a strategy from {@link SimplePlacementFactory}, otherwise
* {@link PlacementPluginAssignStrategy} will be used.</p>
*/
public static AssignStrategy createAssignStrategy(CoreContainer coreContainer) {
@@ -472,7 +472,7 @@ public class Assign {
if (placementPlugin == null) {
// Otherwise use the default
// TODO: Replace this with a better options, such as the AffinityPlacementFactory
- placementPlugin = (new LegacyPlacementFactory()).createPluginInstance();
+ placementPlugin = (new SimplePlacementFactory()).createPluginInstance();
}
return new PlacementPluginAssignStrategy(placementPlugin);
}
diff --git a/solr/core/src/java/org/apache/solr/cluster/placement/PlacementPluginFactory.java b/solr/core/src/java/org/apache/solr/cluster/placement/PlacementPluginFactory.java
index 138aab2..ccd3f9f 100644
--- a/solr/core/src/java/org/apache/solr/cluster/placement/PlacementPluginFactory.java
+++ b/solr/core/src/java/org/apache/solr/cluster/placement/PlacementPluginFactory.java
@@ -18,7 +18,7 @@
package org.apache.solr.cluster.placement;
import org.apache.solr.api.ConfigurablePlugin;
-import org.apache.solr.cluster.placement.plugins.LegacyPlacementFactory;
+import org.apache.solr.cluster.placement.plugins.SimplePlacementFactory;
/**
* Factory implemented by client code and configured in container plugins
@@ -40,7 +40,7 @@ public interface PlacementPluginFactory<T extends PlacementPluginConfig> extends
* instances of a plugin can be used in parallel (for example if configuration has to change, but plugin instances with
* the previous configuration are still being used).
* <p>If this method returns null then a simple default assignment strategy will be used
- * (see {@link LegacyPlacementFactory}).</p>
+ * (see {@link SimplePlacementFactory}).</p>
*/
PlacementPlugin createPluginInstance();
diff --git a/solr/core/src/java/org/apache/solr/cluster/placement/plugins/LegacyPlacementFactory.java b/solr/core/src/java/org/apache/solr/cluster/placement/plugins/SimplePlacementFactory.java
similarity index 96%
rename from solr/core/src/java/org/apache/solr/cluster/placement/plugins/LegacyPlacementFactory.java
rename to solr/core/src/java/org/apache/solr/cluster/placement/plugins/SimplePlacementFactory.java
index c14a737..420d3cb 100644
--- a/solr/core/src/java/org/apache/solr/cluster/placement/plugins/LegacyPlacementFactory.java
+++ b/solr/core/src/java/org/apache/solr/cluster/placement/plugins/SimplePlacementFactory.java
@@ -40,19 +40,19 @@ import java.util.Set;
import java.util.stream.Collectors;
/**
- * <p>Factory for creating {@link LegacyPlacementPlugin}, a placement plugin implementing the logic from the old <code>LegacyAssignStrategy</code>.
+ * <p>Factory for creating {@link SimplePlacementPlugin}, a placement plugin implementing the logic from the old <code>LegacyAssignStrategy</code>.
* This chooses nodes with the fewest cores (especially cores of the same collection).</p>
*
* <p>See {@link AffinityPlacementFactory} for a more realistic example and documentation.</p>
*/
-public class LegacyPlacementFactory implements PlacementPluginFactory<PlacementPluginFactory.NoConfig> {
+public class SimplePlacementFactory implements PlacementPluginFactory<PlacementPluginFactory.NoConfig> {
@Override
public PlacementPlugin createPluginInstance() {
- return new LegacyPlacementPlugin();
+ return new SimplePlacementPlugin();
}
- public static class LegacyPlacementPlugin implements PlacementPlugin {
+ public static class SimplePlacementPlugin implements PlacementPlugin {
@Override
public List<PlacementPlan> computePlacements(Collection<PlacementRequest> requests, PlacementContext placementContext) throws PlacementException {
List<PlacementPlan> placementPlans = new ArrayList<>(requests.size());
diff --git a/solr/solr-ref-guide/src/replica-placement-plugins.adoc b/solr/solr-ref-guide/src/replica-placement-plugins.adoc
index d1ea48c..eca81ee 100644
--- a/solr/solr-ref-guide/src/replica-placement-plugins.adoc
+++ b/solr/solr-ref-guide/src/replica-placement-plugins.adoc
@@ -34,7 +34,7 @@ The configuration entry may also contain a `config` element if the plugin implem
== Placement Plugins Included with Solr
The following placement plugins are available out-of-the-box in Solr 9.0.
-If no placement plugin is defined, Solr will default to using the <<#legacyplacementfactory,LegacyPlacementPlugin>>
+If no placement plugin is defined, Solr will default to using the <<#simpleplacementfactory,SimplePlacementPlugin>>.
In order to use a plugin its configuration must be added using the `/cluster/plugin` API.
For example, in order to use the `AffinityPlacementFactory` plugin the following command should be executed:
@@ -66,16 +66,18 @@ Similarly, the configuration can be updated or removed.
NOTE: Placement plugin configuration MUST use the predefined name `.placement-plugin`.
There can be only one (or none) placement configuration defined.
-=== LegacyPlacementFactory
-By default Solr 9.0 uses a legacy method for replica placements, the `LegacyPlacementFactory`.
+=== SimplePlacementFactory
+By default Solr 9.0 uses a legacy method for replica placements, the `SimplePlacementFactory`.
This method is used whenever the placement plugin configuration is missing or invalid.
-Legacy placement simply assigns new replicas to live nodes in a round-robin fashion: first it prepares a sorted list of nodes with the smallest number of existing replicas, especially of the collection.
+Simple placement simply assigns new replicas to live nodes in a round-robin fashion: first it prepares a sorted list of nodes with the smallest number of existing replicas, especially of the collection.
Then for each shard in the request it adds the replicas to consecutive nodes in this order, wrapping around to the first node if the number of replicas is larger than the number of nodes.
This placement strategy doesn't ensure that no more than 1 replica of a shard is placed on the same node.
Also, the round-robin assignment only roughly approximates an even spread of replicas across the nodes.
+NOTE: This was the default non-autoscaling behavior prior to 9.0, at the time called the LegacyAssignStrategy.
+
=== RandomPlacementFactory
This plugin creates random placements, while preventing two replicas of the same shard from being placed on the same node.
If there are too few nodes to satisfy these constraints an exception is thrown, and the request is rejected.