From d69baa3e04407380972620c62286c2cd9bab06be Mon Sep 17 00:00:00 2001 From: Shay Banon Date: Wed, 5 Oct 2011 19:12:21 +0200 Subject: [PATCH] when writing _river status, use consistency of one --- .../main/java/org/elasticsearch/river/RiversService.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/river/RiversService.java b/modules/elasticsearch/src/main/java/org/elasticsearch/river/RiversService.java index 88d92474946..2c1bcb270f6 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/river/RiversService.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/river/RiversService.java @@ -23,6 +23,7 @@ import org.elasticsearch.ElasticSearchException; import org.elasticsearch.ExceptionsHelper; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.NoShardAvailableActionException; +import org.elasticsearch.action.WriteConsistencyLevel; import org.elasticsearch.action.get.GetResponse; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.ClusterService; @@ -150,7 +151,9 @@ public class RiversService extends AbstractLifecycleComponent { builder.endObject(); - client.prepareIndex(riverIndexName, riverName.name(), "_status").setSource(builder).execute().actionGet(); + client.prepareIndex(riverIndexName, riverName.name(), "_status") + .setConsistencyLevel(WriteConsistencyLevel.ONE) + .setSource(builder).execute().actionGet(); } catch (Exception e) { logger.warn("failed to create river [{}][{}]", e, riverName.type(), riverName.name()); @@ -164,7 +167,9 @@ public class RiversService extends AbstractLifecycleComponent { builder.field("transport_address", clusterService.localNode().address().toString()); builder.endObject(); - client.prepareIndex(riverIndexName, riverName.name(), "_status").setSource(builder).execute().actionGet(); + client.prepareIndex(riverIndexName, riverName.name(), "_status") + .setConsistencyLevel(WriteConsistencyLevel.ONE) + .setSource(builder).execute().actionGet(); } catch (Exception e1) { logger.warn("failed to write failed status for river creation", e); }