From e3497744eae96a688921f05ac978e9d317ad5291 Mon Sep 17 00:00:00 2001 From: Shay Banon Date: Thu, 19 Dec 2013 22:21:05 +0100 Subject: [PATCH] Failed search on a shard tries a local replica on a network thread When a search on a shard to a remove node fails, and then replica exists on the local node, then the execution of the search is done on the network thread. This is problematic since we need to execute it on the actual search thread pool, but can also explain #4519, where the get happens on the network thread and it waits to send the get request till the network thread we use is freed (deadlock...) fixes #4526 note, re-enable the geo shape fetch test, this fix should solve it as well --- .../search/geo/GeoShapeIntegrationTests.java | 39 +++++++++---------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/src/test/java/org/elasticsearch/search/geo/GeoShapeIntegrationTests.java b/src/test/java/org/elasticsearch/search/geo/GeoShapeIntegrationTests.java index c3a3cd5b5f4eb..3c36ea134acad 100644 --- a/src/test/java/org/elasticsearch/search/geo/GeoShapeIntegrationTests.java +++ b/src/test/java/org/elasticsearch/search/geo/GeoShapeIntegrationTests.java @@ -20,7 +20,6 @@ package org.elasticsearch.search.geo; import com.spatial4j.core.shape.Shape; -import org.apache.lucene.util.LuceneTestCase.AwaitsFix; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.common.geo.GeoJSONShapeSerializer; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -185,19 +184,19 @@ public void testIndexedShapeReference() throws Exception { public void testParsingMultipleShapes() throws IOException { String mapping = XContentFactory.jsonBuilder() .startObject() - .startObject("type1") - .startObject("properties") - .startObject("location1") - .field("type", "geo_shape") - .endObject() - .startObject("location2") - .field("type", "geo_shape") - .endObject() - .endObject() - .endObject() + .startObject("type1") + .startObject("properties") + .startObject("location1") + .field("type", "geo_shape") + .endObject() + .startObject("location2") + .field("type", "geo_shape") + .endObject() + .endObject() .endObject() - .string(); - + .endObject() + .string(); + prepareCreate("test").addMapping("type1", mapping).execute().actionGet(); ensureYellow(); @@ -208,17 +207,17 @@ public void testParsingMultipleShapes() throws IOException { client().prepareIndex("test", "type1", "1").setSource(o1).execute().actionGet(); client().admin().indices().prepareRefresh("test").execute().actionGet(); - String filter = "{\"geo_shape\": {\"location2\": {\"indexed_shape\": {" - + "\"id\": \"1\"," - + "\"type\": \"type1\"," - + "\"index\": \"test\"," - + "\"shape_field_name\": \"location2\"" - + "}}}}"; + String filter = "{\"geo_shape\": {\"location2\": {\"indexed_shape\": {" + + "\"id\": \"1\"," + + "\"type\": \"type1\"," + + "\"index\": \"test\"," + + "\"shape_field_name\": \"location2\"" + + "}}}}"; SearchResponse result = client().prepareSearch("test").setQuery(QueryBuilders.matchAllQuery()).setPostFilter(filter).execute().actionGet(); assertHitCount(result, 1); } - + @Test // Issue 2944 public void testThatShapeIsReturnedEvenWhenExclusionsAreSet() throws Exception { String mapping = XContentFactory.jsonBuilder().startObject().startObject("type1")