Bulk Delete item when broadcast to all shard (lack of routing) might not be applied correctly

closes #2285.
This commit is contained in:
Shay Banon 2012-09-24 14:03:57 +02:00
parent 81a6940ad3
commit 15fbbd43ce
3 changed files with 24 additions and 1 deletions

View File

@ -188,7 +188,7 @@ public class TransportBulkAction extends TransportAction<BulkRequest, BulkRespon
list = Lists.newArrayList(); list = Lists.newArrayList();
requestsByShard.put(shardIt.shardId(), list); requestsByShard.put(shardIt.shardId(), list);
} }
list.add(new BulkItemRequest(i, request)); list.add(new BulkItemRequest(i, new DeleteRequest(deleteRequest)));
} }
} else { } else {
ShardId shardId = clusterService.operationRouting().deleteShards(clusterState, deleteRequest.index(), deleteRequest.type(), deleteRequest.id(), deleteRequest.routing()).shardId(); ShardId shardId = clusterService.operationRouting().deleteShards(clusterState, deleteRequest.index(), deleteRequest.type(), deleteRequest.id(), deleteRequest.routing()).shardId();

View File

@ -76,6 +76,16 @@ public class DeleteRequest extends ShardReplicationOperationRequest {
this.id = id; this.id = id;
} }
public DeleteRequest(DeleteRequest request) {
super(request);
this.type = request.type();
this.id = request.id();
this.routing = request.routing();
this.refresh = request.refresh();
this.version = request.version();
this.versionType = request.versionType();
}
public DeleteRequest() { public DeleteRequest() {
} }

View File

@ -61,6 +61,19 @@ public abstract class ShardReplicationOperationRequest implements ActionRequest
return this; return this;
} }
protected ShardReplicationOperationRequest() {
}
public ShardReplicationOperationRequest(ShardReplicationOperationRequest request) {
this.timeout = request.timeout();
this.index = request.index();
this.threadedListener = request.threadedListener;
this.threadedOperation = request.threadedOperation;
this.replicationType = request.replicationType();
this.consistencyLevel = request.consistencyLevel();
}
/** /**
* Should the listener be called on a separate thread if needed. * Should the listener be called on a separate thread if needed.
*/ */