ES hangs connection when parent is not specified in bulk index, closes #641.

This commit is contained in:
kimchy 2011-01-20 12:28:55 +02:00
parent e953845058
commit 04f8b55686
1 changed files with 14 additions and 0 deletions

View File

@ -208,6 +208,20 @@ public class TransportBulkAction extends BaseAction<BulkRequest, BulkResponse> {
} }
} }
if (requestsByShard.isEmpty()) {
// all failures, no shards to process, send a response
if (bulkRequest.listenerThreaded()) {
threadPool.execute(new Runnable() {
@Override public void run() {
listener.onResponse(new BulkResponse(responses, System.currentTimeMillis() - startTime));
}
});
} else {
listener.onResponse(new BulkResponse(responses, System.currentTimeMillis() - startTime));
}
return;
}
final AtomicInteger counter = new AtomicInteger(requestsByShard.size()); final AtomicInteger counter = new AtomicInteger(requestsByShard.size());
for (Map.Entry<ShardId, List<BulkItemRequest>> entry : requestsByShard.entrySet()) { for (Map.Entry<ShardId, List<BulkItemRequest>> entry : requestsByShard.entrySet()) {
final ShardId shardId = entry.getKey(); final ShardId shardId = entry.getKey();