Permalink
Browse files

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

… shard, closes #1403.
  • Loading branch information...
1 parent 673655c commit 184a38439f66edc4aca513d62c81741b6bcc6c0a @kimchy kimchy committed Oct 18, 2011
@@ -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() {
@@ -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) {

0 comments on commit 184a384

Please sign in to comment.