Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Search: A failed search request might get overrun when trying another…

… shard, closes #1403.
  • Loading branch information...
commit 184a38439f66edc4aca513d62c81741b6bcc6c0a 1 parent 673655c
@kimchy kimchy authored
View
13 modules/elasticsearch/src/main/java/org/elasticsearch/action/search/SearchRequest.java
@@ -119,10 +119,9 @@ public SearchRequest(String[] indices, byte[] source) {
return validationException;
}
- /**
- * Internal.
- */
- public void beforeLocalFork() {
+ public void beforeStart() {
+ // we always copy over if needed, the reason is that a request might fail while being search remotely
+ // and then we need to keep the buffer around
if (source != null && sourceUnsafe) {
source = Arrays.copyOfRange(source, sourceOffset, sourceOffset + sourceLength);
sourceOffset = 0;
@@ -136,6 +135,12 @@ public void beforeLocalFork() {
}
/**
+ * Internal.
+ */
+ public void beforeLocalFork() {
+ }
+
+ /**
* Should the listener be called on a separate thread if needed.
*/
@Override public boolean listenerThreaded() {
View
1  modules/elasticsearch/src/main/java/org/elasticsearch/action/search/type/TransportSearchTypeAction.java
@@ -130,6 +130,7 @@ protected BaseAsyncAction(SearchRequest request, ActionListener<SearchResponse>
}
public void start() {
+ request.beforeStart();
// count the local operations, and perform the non local ones
int localOperations = 0;
for (final ShardIterator shardIt : shardsIts) {
Please sign in to comment.
Something went wrong with that request. Please try again.