Revert "remove duplicate logic for request resolution and routing verification"

This reverts commit 2a651fc296.
This commit is contained in:
Areek Zillur 2016-10-07 17:48:44 -04:00
parent 2a651fc296
commit 5bbdcd6416
1 changed files with 8 additions and 0 deletions

View File

@ -100,6 +100,14 @@ public class TransportUpdateAction extends TransportWriteAction<UpdateRequest, U
request.setShardId(shardId);
}
public static void resolveAndValidateRouting(MetaData metaData, String concreteIndex, UpdateRequest request) {
request.routing((metaData.resolveIndexRouting(request.parent(), request.routing(), request.index())));
// Fail fast on the node that received the request, rather than failing when translating on the index or delete request.
if (request.routing() == null && metaData.routingRequired(concreteIndex, request.type())) {
throw new RoutingMissingException(concreteIndex, request.type(), request.id());
}
}
@Override
protected void doExecute(Task task, UpdateRequest request, ActionListener<UpdateResponse> listener) {
// if we don't have a master, we don't have metadata, that's fine, let it find a master using create index API