Skip to content
Permalink
Browse files

Internal: make sure that multi_percolate request hands over its conte…

…xt and headers to its corresponding shard requests

Closes #7371
  • Loading branch information...
javanna committed Aug 21, 2014
1 parent 9dd3597 commit b6cdaff30cf00f984c4f4fd8834f25555bdcfcb7
@@ -122,7 +122,7 @@ public void onResponse(MultiGetResponse multiGetItemResponses) {
percolateRequests.set(slot, itemResponse.getFailure());
}
}
new ASyncAction(percolateRequests, listener, clusterState).run();
new ASyncAction(request, percolateRequests, listener, clusterState).run();
}

@Override
@@ -131,7 +131,7 @@ public void onFailure(Throwable e) {
}
});
} else {
new ASyncAction(percolateRequests, listener, clusterState).run();
new ASyncAction(request, percolateRequests, listener, clusterState).run();
}

}
@@ -140,6 +140,7 @@ public void onFailure(Throwable e) {

final ActionListener<MultiPercolateResponse> finalListener;
final Map<ShardId, TransportShardMultiPercolateAction.Request> requestsByShard;
final MultiPercolateRequest multiPercolateRequest;
final List<Object> percolateRequests;

final Map<ShardId, IntArrayList> shardToSlots;
@@ -148,8 +149,9 @@ public void onFailure(Throwable e) {
final AtomicReferenceArray<AtomicInteger> expectedOperationsPerItem;
final AtomicReferenceArray<AtomicReferenceArray> responsesByItemAndShard;

ASyncAction(List<Object> percolateRequests, ActionListener<MultiPercolateResponse> finalListener, ClusterState clusterState) {
ASyncAction(MultiPercolateRequest multiPercolateRequest, List<Object> percolateRequests, ActionListener<MultiPercolateResponse> finalListener, ClusterState clusterState) {
this.finalListener = finalListener;
this.multiPercolateRequest = multiPercolateRequest;
this.percolateRequests = percolateRequests;
responsesByItemAndShard = new AtomicReferenceArray<>(percolateRequests.size());
expectedOperationsPerItem = new AtomicReferenceArray<>(percolateRequests.size());
@@ -192,7 +194,7 @@ public void onFailure(Throwable e) {
ShardId shardId = shard.shardId();
TransportShardMultiPercolateAction.Request requests = requestsByShard.get(shardId);
if (requests == null) {
requestsByShard.put(shardId, requests = new TransportShardMultiPercolateAction.Request(shardId.getIndex(), shardId.getId(), percolateRequest.preference()));
requestsByShard.put(shardId, requests = new TransportShardMultiPercolateAction.Request(multiPercolateRequest, shardId.getIndex(), shardId.getId(), percolateRequest.preference()));
}
logger.trace("Adding shard[{}] percolate request for item[{}]", shardId, slot);
requests.add(new TransportShardMultiPercolateAction.Request.Item(slot, new PercolateShardRequest(shardId, percolateRequest)));
@@ -126,8 +126,8 @@ protected Response shardOperation(Request request, ShardId shardId) throws Elast
Request() {
}

Request(String concreteIndex, int shardId, String preference) {
this.index = concreteIndex;
Request(MultiPercolateRequest multiPercolateRequest, String concreteIndex, int shardId, String preference) {
super(multiPercolateRequest, concreteIndex);
this.shardId = shardId;
this.preference = preference;
this.items = new ArrayList<>();

0 comments on commit b6cdaff

Please sign in to comment.
You can’t perform that action at this time.