SOLR-11270: Automatically added SystemLogListener should not prevent deleting a trigger.

This commit is contained in:
Andrzej Bialecki 2017-08-21 18:45:19 +02:00
parent ac98e89d41
commit d459073f61
3 changed files with 12 additions and 10 deletions

View File

@ -180,6 +180,8 @@ Other Changes
* SOLR-11249: Upgrade Jetty from 9.3.14.v20161028 to 9.3.20.v20170531 (Michael Braun via David Smiley)
* SOLR-11270: Automatically added SystemLogListener should not prevent deleting a trigger. (ab)
================== 7.0.0 ==================
Versions of Major Components

View File

@ -601,7 +601,15 @@ public class AutoScalingHandler extends RequestHandlerBase implements Permission
}
}
if (!activeListeners.isEmpty()) {
if (removeListeners) {
boolean onlySystemLog = false;
if (activeListeners.size() == 1) {
AutoScalingConfig.TriggerListenerConfig cfg = listeners.get(activeListeners.iterator().next());
if (SystemLogListener.class.getName().equals(cfg.listenerClass) ||
("solr." + SystemLogListener.class.getSimpleName()).equals(cfg.listenerClass)) {
onlySystemLog = true;
}
}
if (removeListeners || onlySystemLog) {
listeners = new HashMap<>(listeners);
listeners.keySet().removeAll(activeListeners);
} else {

View File

@ -355,22 +355,14 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
"\t\t\"name\" : \"xyz\"\n" +
"\t}\n" +
"}";
String removeListenerCommand1 = "{\n" +
"\t\"remove-listener\" : {\n" +
"\t\t\"name\" : \"node_lost_trigger.system\"\n" +
"\t}\n" +
"}";
req = createAutoScalingRequest(SolrRequest.METHOD.POST, removeListenerCommand);
response = solrClient.request(req);
assertEquals(response.get("result").toString(), "success");
req = createAutoScalingRequest(SolrRequest.METHOD.POST, removeListenerCommand1);
response = solrClient.request(req);
assertEquals(response.get("result").toString(), "success");
data = zkClient().getData(SOLR_AUTOSCALING_CONF_PATH, null, null, true);
loaded = ZkNodeProps.load(data);
listeners = (Map<String, Object>) loaded.get("listeners");
assertNotNull(listeners);
assertEquals(0, listeners.size());
assertEquals(1, listeners.size());
removeTriggerCommand = "{" +
"'remove-trigger' : {" +