From 9322a7b37555832e41a25bbc556a34299b90204e Mon Sep 17 00:00:00 2001 From: Shalin Shekhar Mangar Date: Mon, 6 Apr 2020 07:25:14 +0530 Subject: [PATCH] SOLR-12067: Remove support for autoReplicaFailoverWaitAfterExpiration This closes #1402. --- solr/CHANGES.txt | 2 ++ .../java/org/apache/solr/cloud/Overseer.java | 2 +- .../autoscaling/OverseerTriggerThread.java | 9 +++---- .../autoscaling/sim/SimCloudManager.java | 7 ++---- .../org/apache/solr/core/CloudConfig.java | 25 ++++--------------- .../org/apache/solr/core/SolrXmlConfig.java | 3 --- .../src/test-files/solr/solr-jmxreporter.xml | 1 - .../src/test-files/solr/solr-solrreporter.xml | 1 - .../solr/solr-trackingshardhandler.xml | 1 - solr/core/src/test-files/solr/solr.xml | 1 - .../AutoAddReplicasIntegrationTest.java | 6 +++++ .../src/major-changes-in-solr-9.adoc | 3 +++ .../src/solrcloud-autoscaling-triggers.adoc | 25 ++++++++++++++++--- 13 files changed, 44 insertions(+), 42 deletions(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 3a2d500bb4d..a9aa7a35d21 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -53,6 +53,8 @@ Other Changes * SOLR-13893: Remove support to read BlobRepository's max jar size from deprecated `runtme.lib.size` system property (Erick Erickson, Kesharee Nandan Vishwakarma, Munendra S N) +* SOLR-12067: Remove support for `autoReplicaFailoverWaitAfterExpiration`. (marcussorealheis, shalin) + ================== 8.6.0 ================== Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release. diff --git a/solr/core/src/java/org/apache/solr/cloud/Overseer.java b/solr/core/src/java/org/apache/solr/cloud/Overseer.java index a89926f45d6..89582f4e4ca 100644 --- a/solr/core/src/java/org/apache/solr/cloud/Overseer.java +++ b/solr/core/src/java/org/apache/solr/cloud/Overseer.java @@ -578,7 +578,7 @@ public class Overseer implements SolrCloseable { ThreadGroup triggerThreadGroup = new ThreadGroup("Overseer autoscaling triggers"); OverseerTriggerThread trigger = new OverseerTriggerThread(zkController.getCoreContainer().getResourceLoader(), - zkController.getSolrCloudManager(), config); + zkController.getSolrCloudManager()); triggerThread = new OverseerThread(triggerThreadGroup, trigger, "OverseerAutoScalingTriggerThread-" + id); updaterThread.start(); diff --git a/solr/core/src/java/org/apache/solr/cloud/autoscaling/OverseerTriggerThread.java b/solr/core/src/java/org/apache/solr/cloud/autoscaling/OverseerTriggerThread.java index a73743c8e87..14bfb0bf92e 100644 --- a/solr/core/src/java/org/apache/solr/cloud/autoscaling/OverseerTriggerThread.java +++ b/solr/core/src/java/org/apache/solr/cloud/autoscaling/OverseerTriggerThread.java @@ -39,7 +39,6 @@ import org.apache.solr.common.SolrCloseable; import org.apache.solr.common.cloud.ZkStateReader; import org.apache.solr.common.util.IOUtils; import org.apache.solr.common.util.Utils; -import org.apache.solr.core.CloudConfig; import org.apache.solr.core.SolrResourceLoader; import org.apache.zookeeper.KeeperException; import org.apache.zookeeper.WatchedEvent; @@ -60,12 +59,11 @@ public class OverseerTriggerThread implements Runnable, SolrCloseable { public static final String MARKER_STATE = "state"; public static final String MARKER_ACTIVE = "active"; public static final String MARKER_INACTIVE = "inactive"; + public static final int DEFAULT_AUTO_ADD_REPLICA_WAIT_FOR_SECONDS = 120; private final SolrCloudManager cloudManager; - private final CloudConfig cloudConfig; - private final ScheduledTriggers scheduledTriggers; private final AutoScaling.TriggerFactory triggerFactory; @@ -87,9 +85,8 @@ public class OverseerTriggerThread implements Runnable, SolrCloseable { private AutoScalingConfig autoScalingConfig; - public OverseerTriggerThread(SolrResourceLoader loader, SolrCloudManager cloudManager, CloudConfig cloudConfig) { + public OverseerTriggerThread(SolrResourceLoader loader, SolrCloudManager cloudManager) { this.cloudManager = cloudManager; - this.cloudConfig = cloudConfig; scheduledTriggers = new ScheduledTriggers(loader, cloudManager); triggerFactory = new AutoScaling.TriggerFactoryImpl(loader, cloudManager); } @@ -366,7 +363,7 @@ public class OverseerTriggerThread implements Runnable, SolrCloseable { } } // need to add - triggerProps.computeIfPresent("waitFor", (k, v) -> (long) (cloudConfig.getAutoReplicaFailoverWaitAfterExpiration() / 1000)); + triggerProps.computeIfPresent("waitFor", (k, v) -> (long) (DEFAULT_AUTO_ADD_REPLICA_WAIT_FOR_SECONDS)); AutoScalingConfig.TriggerConfig config = new AutoScalingConfig.TriggerConfig(triggerName, triggerProps); autoScalingConfig = autoScalingConfig.withTriggerConfig(config); // need to add SystemLogListener explicitly here diff --git a/solr/core/src/java/org/apache/solr/cloud/autoscaling/sim/SimCloudManager.java b/solr/core/src/java/org/apache/solr/cloud/autoscaling/sim/SimCloudManager.java index e20f61da3c3..40157cd6e6c 100644 --- a/solr/core/src/java/org/apache/solr/cloud/autoscaling/sim/SimCloudManager.java +++ b/solr/core/src/java/org/apache/solr/cloud/autoscaling/sim/SimCloudManager.java @@ -89,7 +89,6 @@ import org.apache.solr.common.util.NamedList; import org.apache.solr.common.util.ObjectCache; import org.apache.solr.common.util.SimpleOrderedMap; import org.apache.solr.common.util.TimeSource; -import org.apache.solr.core.CloudConfig; import org.apache.solr.core.SolrInfoBean; import org.apache.solr.core.SolrResourceLoader; import org.apache.solr.handler.admin.MetricsHandler; @@ -268,8 +267,7 @@ public class SimCloudManager implements SolrCloudManager { triggerThreadGroup = new ThreadGroup("Simulated Overseer autoscaling triggers"); - OverseerTriggerThread trigger = new OverseerTriggerThread(loader, this, - new CloudConfig.CloudConfigBuilder("nonexistent", 0, "sim").build()); + OverseerTriggerThread trigger = new OverseerTriggerThread(loader, this); triggerThread = new Overseer.OverseerThread(triggerThreadGroup, trigger, "Simulated OverseerAutoScalingTriggerThread"); triggerThread.start(); } @@ -613,8 +611,7 @@ public class SimCloudManager implements SolrCloudManager { } simCloudManagerPool = ExecutorUtil.newMDCAwareFixedThreadPool(200, new DefaultSolrThreadFactory("simCloudManagerPool")); - OverseerTriggerThread trigger = new OverseerTriggerThread(loader, this, - new CloudConfig.CloudConfigBuilder("nonexistent", 0, "sim").build()); + OverseerTriggerThread trigger = new OverseerTriggerThread(loader, this); triggerThread = new Overseer.OverseerThread(triggerThreadGroup, trigger, "Simulated OverseerAutoScalingTriggerThread"); triggerThread.start(); diff --git a/solr/core/src/java/org/apache/solr/core/CloudConfig.java b/solr/core/src/java/org/apache/solr/core/CloudConfig.java index 1c65a4605f0..df608336d07 100644 --- a/solr/core/src/java/org/apache/solr/core/CloudConfig.java +++ b/solr/core/src/java/org/apache/solr/core/CloudConfig.java @@ -36,8 +36,6 @@ public class CloudConfig { private final int leaderConflictResolveWait; - private final int autoReplicaFailoverWaitAfterExpiration; - private final String zkCredentialsProviderClass; private final String zkACLProviderClass; @@ -51,9 +49,9 @@ public class CloudConfig { private final String pkiHandlerPublicKeyPath; CloudConfig(String zkHost, int zkClientTimeout, int hostPort, String hostName, String hostContext, boolean useGenericCoreNames, - int leaderVoteWait, int leaderConflictResolveWait, int autoReplicaFailoverWaitAfterExpiration, - String zkCredentialsProviderClass, String zkACLProviderClass, int createCollectionWaitTimeTillActive, - boolean createCollectionCheckLeaderActive, String pkiHandlerPrivateKeyPath, String pkiHandlerPublicKeyPath) { + int leaderVoteWait, int leaderConflictResolveWait, String zkCredentialsProviderClass, String zkACLProviderClass, + int createCollectionWaitTimeTillActive, boolean createCollectionCheckLeaderActive, String pkiHandlerPrivateKeyPath, + String pkiHandlerPublicKeyPath) { this.zkHost = zkHost; this.zkClientTimeout = zkClientTimeout; this.hostPort = hostPort; @@ -62,7 +60,6 @@ public class CloudConfig { this.useGenericCoreNames = useGenericCoreNames; this.leaderVoteWait = leaderVoteWait; this.leaderConflictResolveWait = leaderConflictResolveWait; - this.autoReplicaFailoverWaitAfterExpiration = autoReplicaFailoverWaitAfterExpiration; this.zkCredentialsProviderClass = zkCredentialsProviderClass; this.zkACLProviderClass = zkACLProviderClass; this.createCollectionWaitTimeTillActive = createCollectionWaitTimeTillActive; @@ -112,10 +109,6 @@ public class CloudConfig { return leaderConflictResolveWait; } - public int getAutoReplicaFailoverWaitAfterExpiration() { - return autoReplicaFailoverWaitAfterExpiration; - } - public boolean getGenericCoreNodeNames() { return useGenericCoreNames; } @@ -144,8 +137,6 @@ public class CloudConfig { private static final int DEFAULT_CREATE_COLLECTION_ACTIVE_WAIT = 45; // 45 seconds private static final boolean DEFAULT_CREATE_COLLECTION_CHECK_LEADER_ACTIVE = false; - private static final int DEFAULT_AUTO_REPLICA_FAILOVER_WAIT_AFTER_EXPIRATION = 120000; - private String zkHost = System.getProperty("zkHost"); private int zkClientTimeout = Integer.getInteger("zkClientTimeout", DEFAULT_ZK_CLIENT_TIMEOUT); private final int hostPort; @@ -154,7 +145,6 @@ public class CloudConfig { private boolean useGenericCoreNames; private int leaderVoteWait = DEFAULT_LEADER_VOTE_WAIT; private int leaderConflictResolveWait = DEFAULT_LEADER_CONFLICT_RESOLVE_WAIT; - private int autoReplicaFailoverWaitAfterExpiration = DEFAULT_AUTO_REPLICA_FAILOVER_WAIT_AFTER_EXPIRATION; private String zkCredentialsProviderClass; private String zkACLProviderClass; private int createCollectionWaitTimeTillActive = DEFAULT_CREATE_COLLECTION_ACTIVE_WAIT; @@ -196,12 +186,7 @@ public class CloudConfig { this.leaderConflictResolveWait = leaderConflictResolveWait; return this; } - - public CloudConfigBuilder setAutoReplicaFailoverWaitAfterExpiration(int autoReplicaFailoverWaitAfterExpiration) { - this.autoReplicaFailoverWaitAfterExpiration = autoReplicaFailoverWaitAfterExpiration; - return this; - } - + public CloudConfigBuilder setZkCredentialsProviderClass(String zkCredentialsProviderClass) { this.zkCredentialsProviderClass = zkCredentialsProviderClass; return this; @@ -234,7 +219,7 @@ public class CloudConfig { public CloudConfig build() { return new CloudConfig(zkHost, zkClientTimeout, hostPort, hostName, hostContext, useGenericCoreNames, leaderVoteWait, - leaderConflictResolveWait, autoReplicaFailoverWaitAfterExpiration, zkCredentialsProviderClass, zkACLProviderClass, createCollectionWaitTimeTillActive, + leaderConflictResolveWait, zkCredentialsProviderClass, zkACLProviderClass, createCollectionWaitTimeTillActive, createCollectionCheckLeaderActive, pkiHandlerPrivateKeyPath, pkiHandlerPublicKeyPath); } } diff --git a/solr/core/src/java/org/apache/solr/core/SolrXmlConfig.java b/solr/core/src/java/org/apache/solr/core/SolrXmlConfig.java index e61836f5ceb..0ca2a58bf73 100644 --- a/solr/core/src/java/org/apache/solr/core/SolrXmlConfig.java +++ b/solr/core/src/java/org/apache/solr/core/SolrXmlConfig.java @@ -397,9 +397,6 @@ public class SolrXmlConfig { case "zkClientTimeout": builder.setZkClientTimeout(parseInt(name, value)); break; - case "autoReplicaFailoverWaitAfterExpiration": - builder.setAutoReplicaFailoverWaitAfterExpiration(parseInt(name, value)); - break; case "zkHost": builder.setZkHost(value); break; diff --git a/solr/core/src/test-files/solr/solr-jmxreporter.xml b/solr/core/src/test-files/solr/solr-jmxreporter.xml index 825147fded1..92ba4121b55 100644 --- a/solr/core/src/test-files/solr/solr-jmxreporter.xml +++ b/solr/core/src/test-files/solr/solr-jmxreporter.xml @@ -32,7 +32,6 @@ ${leaderVoteWait:10000} ${distribUpdateConnTimeout:45000} ${distribUpdateSoTimeout:340000} - ${autoReplicaFailoverWaitAfterExpiration:10000} ${createCollectionWaitTimeTillActive:30} diff --git a/solr/core/src/test-files/solr/solr-solrreporter.xml b/solr/core/src/test-files/solr/solr-solrreporter.xml index 205e12d1e4a..d238ac53260 100644 --- a/solr/core/src/test-files/solr/solr-solrreporter.xml +++ b/solr/core/src/test-files/solr/solr-solrreporter.xml @@ -32,7 +32,6 @@ ${leaderVoteWait:10000} ${distribUpdateConnTimeout:45000} ${distribUpdateSoTimeout:340000} - ${autoReplicaFailoverWaitAfterExpiration:10000} diff --git a/solr/core/src/test-files/solr/solr-trackingshardhandler.xml b/solr/core/src/test-files/solr/solr-trackingshardhandler.xml index 975502524fc..491d6460151 100644 --- a/solr/core/src/test-files/solr/solr-trackingshardhandler.xml +++ b/solr/core/src/test-files/solr/solr-trackingshardhandler.xml @@ -33,7 +33,6 @@ ${genericCoreNodeNames:true} ${distribUpdateConnTimeout:45000} ${distribUpdateSoTimeout:340000} - ${autoReplicaFailoverWaitAfterExpiration:10000} ${leaderConflictResolveWait:45000} ${distribUpdateConnTimeout:5000} ${distribUpdateSoTimeout:30000} - ${autoReplicaFailoverWaitAfterExpiration:10000} diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoAddReplicasIntegrationTest.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoAddReplicasIntegrationTest.java index cd92ce68dca..e28165f7127 100644 --- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoAddReplicasIntegrationTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoAddReplicasIntegrationTest.java @@ -73,6 +73,12 @@ public class AutoAddReplicasIntegrationTest extends SolrCloudTestCase { .withPayload("{set-obj-property:{defaults : {cluster: {useLegacyReplicaAssignment:true}}}}") .build() .process(cluster.getSolrClient()); + + new V2Request.Builder("/cluster/autoscaling") + .withMethod(SolrRequest.METHOD.POST) + .withPayload("{'set-trigger':{'name':'.auto_add_replicas','event':'nodeLost','waitFor':'5s','enabled':'true','actions':[{'name':'auto_add_replicas_plan','class':'solr.AutoAddReplicasPlanAction'},{'name':'auto_add_replicas_plan','class':'solr.ExecutePlanAction'}]}}") + .build() + .process(cluster.getSolrClient()); } @After diff --git a/solr/solr-ref-guide/src/major-changes-in-solr-9.adoc b/solr/solr-ref-guide/src/major-changes-in-solr-9.adoc index e699eda15c1..bfb6472bed2 100644 --- a/solr/solr-ref-guide/src/major-changes-in-solr-9.adoc +++ b/solr/solr-ref-guide/src/major-changes-in-solr-9.adoc @@ -100,6 +100,9 @@ _(raw; not yet edited)_ * SOLR-14344: Remove Deprecated HttpSolrClient.RemoteSolrException and HttpSolrClient.RemoteExcecutionException. All the usages are replaced by BaseHttpSolrClient.RemoteSolrException and BaseHttpSolrClient.RemoteExcecutionException. (Munendra S N) + +* SOLR-12720: To change the auto add replica wait period modify the `waitFor` attribute of the `.auto_add_replicas` trigger. + (marcussorealheis, shalin) === Upgrade Prerequisites in Solr 9 diff --git a/solr/solr-ref-guide/src/solrcloud-autoscaling-triggers.adoc b/solr/solr-ref-guide/src/solrcloud-autoscaling-triggers.adoc index bf1b9691ec5..131e4955247 100644 --- a/solr/solr-ref-guide/src/solrcloud-autoscaling-triggers.adoc +++ b/solr/solr-ref-guide/src/solrcloud-autoscaling-triggers.adoc @@ -205,10 +205,29 @@ to add replicas on the live nodes to maintain the expected replication factor). Refer to the section <> to learn more about how the `.autoAddReplicas` trigger works. -In addition to the parameters described at <>, this trigger supports one parameter, which is defined in the `` section of `solr.xml`: +If you would like to change the value of `.autoAddReplicas` trigger, you need to call the autoscaling API and use the `set-trigger` command to add a value for `waitFor`. -`autoReplicaFailoverWaitAfterExpiration`:: -The minimum time in milliseconds to wait for initiating replacement of a replica after first noticing it not being live. This is important to prevent false positives while stopping or starting the cluster. The default is `120000` (2 minutes). The value provided for this parameter is used as the value for the `waitFor` parameter in the `.auto_add_replicas` trigger. +.Example: Updating Trigger with wait for 5 seconds +---- +{ + "set-trigger": { + "name": ".auto_add_replicas", + "event": "nodeLost, + "waitFor": "5s", + "enabled": true, + "actions": [ + { + "name": "auto_add_replicas_plan", + "class": "solr.AutoAddReplicasPlanAction" + }, + { + "name": "auto_add_replicas_plan", + "class": "solr.ExecutePlanAction" + } + ] + } +} +---- TIP: See < Element>> for more details about how to work with `solr.xml`.