Search: A failed search request might get overrun when trying another shard, closes #1403.

This commit is contained in:
Shay Banon 2011-10-18 04:50:19 +02:00
parent 673655cc7b
commit 184a38439f
2 changed files with 10 additions and 4 deletions

View File

@ -119,10 +119,9 @@ public class SearchRequest implements ActionRequest {
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;
@ -135,6 +134,12 @@ public class SearchRequest implements ActionRequest {
}
}
/**
* Internal.
*/
public void beforeLocalFork() {
}
/**
* Should the listener be called on a separate thread if needed.
*/

View File

@ -130,6 +130,7 @@ public abstract class TransportSearchTypeAction extends BaseAction<SearchRequest
}
public void start() {
request.beforeStart();
// count the local operations, and perform the non local ones
int localOperations = 0;
for (final ShardIterator shardIt : shardsIts) {