ClusterUpdateSettingsAction will hang if no changes were made

Closes #3560
This commit is contained in:
Boaz Leskes 2013-08-22 20:59:31 +02:00
parent fc3133d087
commit 109e2944f2
2 changed files with 20 additions and 0 deletions

View File

@ -159,6 +159,7 @@ public class TransportClusterUpdateSettingsAction extends TransportMasterNodeOpe
public void clusterStateProcessed(String source, ClusterState oldState, ClusterState newState) {
if (oldState == newState) {
// nothing changed...
listener.onResponse(new ClusterUpdateSettingsResponse(transientUpdates.build(), persistentUpdates.build()));
return;
}
// now, reroute

View File

@ -26,6 +26,7 @@ import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.node.Node;
import org.elasticsearch.node.NodeBuilder;
import org.hamcrest.Matchers;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
@ -34,6 +35,24 @@ import static org.hamcrest.Matchers.nullValue;
public class ClusterSettingsTests {
@Test
public void clusterNonExistingSettingsUpdate() {
Node node1 = NodeBuilder.nodeBuilder().node();
node1.start();
Client client = node1.client();
String key1 = "no_idea_what_you_are_talking_about";
int value1 = 10;
ClusterUpdateSettingsResponse response = client.admin().cluster()
.prepareUpdateSettings()
.setTransientSettings(ImmutableSettings.builder().put(key1, value1).build())
.get();
assertThat(response.getTransientSettings().getAsMap().entrySet(), Matchers.emptyIterable());
}
@Test
public void clusterSettingsUpdateResponse() {
Node node1 = NodeBuilder.nodeBuilder().node();