Skip to content

Commit

Permalink
Failed search on a shard tries a local replica on a network thread
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kimchy committed Dec 19, 2013
1 parent a230a7f commit e349774
Showing 1 changed file with 19 additions and 20 deletions.
Expand Up @@ -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;
Expand Down Expand Up @@ -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();

Expand All @@ -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")
Expand Down

0 comments on commit e349774

Please sign in to comment.