You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by no...@apache.org on 2023/08/23 08:20:28 UTC
[solr] branch branch_9x updated: SOLR-16946: Updated Cluster Singleton plugins are stopped correctly when the Overseer is closed (#1862)
This is an automated email from the ASF dual-hosted git repository.
noble pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/branch_9x by this push:
new 56d322464a8 SOLR-16946: Updated Cluster Singleton plugins are stopped correctly when the Overseer is closed (#1862)
56d322464a8 is described below
commit 56d322464a8022a3198f54f9f4fad824c746831f
Author: pjmcarthur <92...@users.noreply.github.com>
AuthorDate: Wed Aug 23 01:18:13 2023 -0700
SOLR-16946: Updated Cluster Singleton plugins are stopped correctly when the Overseer is closed (#1862)
---
solr/CHANGES.txt | 2 ++
.../java/org/apache/solr/core/ClusterSingletons.java | 2 +-
.../org/apache/solr/handler/TestContainerPlugin.java | 18 +++++++++++++++++-
3 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 3dc30414bb6..7ff58891334 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -76,6 +76,8 @@ Bug Fixes
* SOLR-16934: Allow Solr to read client (javax.net.ssl.*) trustStores and keyStores via SecurityManager. (Houston Putman)
+* SOLR-16946: Updated Cluster Singleton plugins are stopped correctly when the Overseer is closed. (Paul McArthur)
+
Dependency Upgrades
---------------------
diff --git a/solr/core/src/java/org/apache/solr/core/ClusterSingletons.java b/solr/core/src/java/org/apache/solr/core/ClusterSingletons.java
index 6e2c0417818..0c71c853400 100644
--- a/solr/core/src/java/org/apache/solr/core/ClusterSingletons.java
+++ b/solr/core/src/java/org/apache/solr/core/ClusterSingletons.java
@@ -99,8 +99,8 @@ public class ClusterSingletons {
@Override
public void modified(
ContainerPluginsRegistry.ApiInfo old, ContainerPluginsRegistry.ApiInfo replacement) {
- added(replacement);
deleted(old);
+ added(replacement);
}
};
}
diff --git a/solr/core/src/test/org/apache/solr/handler/TestContainerPlugin.java b/solr/core/src/test/org/apache/solr/handler/TestContainerPlugin.java
index 49c3f925bf8..169555a3ad1 100644
--- a/solr/core/src/test/org/apache/solr/handler/TestContainerPlugin.java
+++ b/solr/core/src/test/org/apache/solr/handler/TestContainerPlugin.java
@@ -221,8 +221,11 @@ public class TestContainerPlugin extends SolrCloudTestCase {
MatcherAssert.assertThat(msg, containsString("Cannot find API for the path"));
// test ClusterSingleton plugin
+ CConfig c6Cfg = new CConfig();
+ c6Cfg.strVal = "added";
plugin.name = "clusterSingleton";
plugin.klass = C6.class.getName();
+ plugin.config = c6Cfg;
addPlugin.process(cluster.getSolrClient());
version = phaser.awaitAdvanceInterruptibly(version, 10, TimeUnit.SECONDS);
@@ -234,6 +237,16 @@ public class TestContainerPlugin extends SolrCloudTestCase {
assertTrue("startCalled", C6.startCalled);
assertFalse("stopCalled", C6.stopCalled);
+ // update the clusterSingleton config
+ c6Cfg.strVal = "updated";
+ postPlugin(singletonMap("update", plugin)).process(cluster.getSolrClient());
+ version = phaser.awaitAdvanceInterruptibly(version, 10, TimeUnit.SECONDS);
+
+ assertTrue("stopCalled", C6.stopCalled);
+
+ // Clear stopCalled, it will be verified again when the Overseer Jetty is killed
+ C6.stopCalled = false;
+
assertEquals(CConfig.class, ContainerPluginsRegistry.getConfigClass(new CC()));
assertEquals(CConfig.class, ContainerPluginsRegistry.getConfigClass(new CC1()));
assertEquals(CConfig.class, ContainerPluginsRegistry.getConfigClass(new CC2()));
@@ -395,7 +408,7 @@ public class TestContainerPlugin extends SolrCloudTestCase {
@JsonProperty public Boolean boolVal;
}
- public static class C6 implements ClusterSingleton {
+ public static class C6 implements ClusterSingleton, ConfigurablePlugin<CConfig> {
static boolean startCalled = false;
static boolean stopCalled = false;
static boolean ccProvided = false;
@@ -431,6 +444,9 @@ public class TestContainerPlugin extends SolrCloudTestCase {
stopCalled = true;
state = State.STOPPED;
}
+
+ @Override
+ public void configure(CConfig cfg) {}
}
public static class C5 implements ResourceLoaderAware {