Blocking writes on a tribe node creates a "blocks" tribe

fixes #5389
This commit is contained in:
Shay Banon 2014-03-12 10:29:11 +01:00
parent d05b4ef769
commit 965620c3ff
2 changed files with 6 additions and 2 deletions

View File

@ -21,6 +21,7 @@ package org.elasticsearch.tribe;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.ElasticsearchIllegalStateException; import org.elasticsearch.ElasticsearchIllegalStateException;
import org.elasticsearch.action.support.master.TransportMasterNodeReadOperationAction; import org.elasticsearch.action.support.master.TransportMasterNodeReadOperationAction;
@ -110,7 +111,8 @@ public class TribeService extends AbstractLifecycleComponent<TribeService> {
public TribeService(Settings settings, ClusterService clusterService) { public TribeService(Settings settings, ClusterService clusterService) {
super(settings); super(settings);
this.clusterService = clusterService; this.clusterService = clusterService;
Map<String, Settings> nodesSettings = settings.getGroups("tribe", true); Map<String, Settings> nodesSettings = Maps.newHashMap(settings.getGroups("tribe", true));
nodesSettings.remove("blocks"); // remove prefix settings that don't indicate a client
for (Map.Entry<String, Settings> entry : nodesSettings.entrySet()) { for (Map.Entry<String, Settings> entry : nodesSettings.entrySet()) {
ImmutableSettings.Builder sb = ImmutableSettings.builder().put(entry.getValue()); ImmutableSettings.Builder sb = ImmutableSettings.builder().put(entry.getValue());
sb.put("node.name", settings.get("name") + "/" + entry.getKey()); sb.put("node.name", settings.get("name") + "/" + entry.getKey());
@ -168,7 +170,7 @@ public class TribeService extends AbstractLifecycleComponent<TribeService> {
latch.await(); latch.await();
} catch (InterruptedException e) { } catch (InterruptedException e) {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
throw new ElasticsearchIllegalStateException("Interrupted while starting [" + this.getClass().getSimpleName()+ "]", e); throw new ElasticsearchIllegalStateException("Interrupted while starting [" + this.getClass().getSimpleName() + "]", e);
} }
for (InternalNode node : nodes) { for (InternalNode node : nodes) {
try { try {

View File

@ -59,6 +59,8 @@ public class TribeTests extends ElasticsearchIntegrationTest {
Settings settings = ImmutableSettings.builder() Settings settings = ImmutableSettings.builder()
.put("tribe.t1.cluster.name", cluster().getClusterName()) .put("tribe.t1.cluster.name", cluster().getClusterName())
.put("tribe.t2.cluster.name", cluster2.getClusterName()) .put("tribe.t2.cluster.name", cluster2.getClusterName())
.put("tribe.blocks.write", false)
.put("tribe.blocks.read", false)
.build(); .build();
tribeNode = NodeBuilder.nodeBuilder() tribeNode = NodeBuilder.nodeBuilder()