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; return validationException;
} }
/** public void beforeStart() {
* Internal. // 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
public void beforeLocalFork() {
if (source != null && sourceUnsafe) { if (source != null && sourceUnsafe) {
source = Arrays.copyOfRange(source, sourceOffset, sourceOffset + sourceLength); source = Arrays.copyOfRange(source, sourceOffset, sourceOffset + sourceLength);
sourceOffset = 0; 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. * 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() { public void start() {
request.beforeStart();
// count the local operations, and perform the non local ones // count the local operations, and perform the non local ones
int localOperations = 0; int localOperations = 0;
for (final ShardIterator shardIt : shardsIts) { for (final ShardIterator shardIt : shardsIts) {