From 965620c3ffc6e10b1e5598609f511d0716c0ea0e Mon Sep 17 00:00:00 2001 From: Shay Banon Date: Wed, 12 Mar 2014 10:29:11 +0100 Subject: [PATCH] Blocking writes on a tribe node creates a "blocks" tribe fixes #5389 --- src/main/java/org/elasticsearch/tribe/TribeService.java | 6 ++++-- src/test/java/org/elasticsearch/tribe/TribeTests.java | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/elasticsearch/tribe/TribeService.java b/src/main/java/org/elasticsearch/tribe/TribeService.java index 842155b9505..c3dc23efa04 100644 --- a/src/main/java/org/elasticsearch/tribe/TribeService.java +++ b/src/main/java/org/elasticsearch/tribe/TribeService.java @@ -21,6 +21,7 @@ package org.elasticsearch.tribe; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; +import com.google.common.collect.Maps; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ElasticsearchIllegalStateException; import org.elasticsearch.action.support.master.TransportMasterNodeReadOperationAction; @@ -110,7 +111,8 @@ public class TribeService extends AbstractLifecycleComponent { public TribeService(Settings settings, ClusterService clusterService) { super(settings); this.clusterService = clusterService; - Map nodesSettings = settings.getGroups("tribe", true); + Map nodesSettings = Maps.newHashMap(settings.getGroups("tribe", true)); + nodesSettings.remove("blocks"); // remove prefix settings that don't indicate a client for (Map.Entry entry : nodesSettings.entrySet()) { ImmutableSettings.Builder sb = ImmutableSettings.builder().put(entry.getValue()); sb.put("node.name", settings.get("name") + "/" + entry.getKey()); @@ -168,7 +170,7 @@ public class TribeService extends AbstractLifecycleComponent { latch.await(); } catch (InterruptedException e) { 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) { try { diff --git a/src/test/java/org/elasticsearch/tribe/TribeTests.java b/src/test/java/org/elasticsearch/tribe/TribeTests.java index c47d62f523c..a1c3c44fa12 100644 --- a/src/test/java/org/elasticsearch/tribe/TribeTests.java +++ b/src/test/java/org/elasticsearch/tribe/TribeTests.java @@ -59,6 +59,8 @@ public class TribeTests extends ElasticsearchIntegrationTest { Settings settings = ImmutableSettings.builder() .put("tribe.t1.cluster.name", cluster().getClusterName()) .put("tribe.t2.cluster.name", cluster2.getClusterName()) + .put("tribe.blocks.write", false) + .put("tribe.blocks.read", false) .build(); tribeNode = NodeBuilder.nodeBuilder()