Put Mapping: When using a single node and updating a mapping, it is not marked as `acknowledged`, closes #280.
This commit is contained in:
parent
e955e41a91
commit
4f407e18aa
|
@ -205,28 +205,31 @@ public class MetaDataMappingService extends AbstractComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (expectedReplies == 0) {
|
||||||
final AtomicInteger counter = new AtomicInteger(expectedReplies);
|
listener.onResponse(new Response(true));
|
||||||
final Set<String> indicesSet = newHashSet(request.indices);
|
} else {
|
||||||
final NodeMappingCreatedAction.Listener nodeMappingListener = new NodeMappingCreatedAction.Listener() {
|
final AtomicInteger counter = new AtomicInteger(expectedReplies);
|
||||||
@Override public void onNodeMappingCreated(NodeMappingCreatedAction.NodeMappingCreatedResponse response) {
|
final Set<String> indicesSet = newHashSet(request.indices);
|
||||||
if (indicesSet.contains(response.index()) && response.type().equals(request.mappingType)) {
|
final NodeMappingCreatedAction.Listener nodeMappingListener = new NodeMappingCreatedAction.Listener() {
|
||||||
if (counter.decrementAndGet() == 0) {
|
@Override public void onNodeMappingCreated(NodeMappingCreatedAction.NodeMappingCreatedResponse response) {
|
||||||
listener.onResponse(new Response(true));
|
if (indicesSet.contains(response.index()) && response.type().equals(request.mappingType)) {
|
||||||
nodeMappingCreatedAction.remove(this);
|
if (counter.decrementAndGet() == 0) {
|
||||||
|
listener.onResponse(new Response(true));
|
||||||
|
nodeMappingCreatedAction.remove(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
nodeMappingCreatedAction.add(nodeMappingListener);
|
||||||
nodeMappingCreatedAction.add(nodeMappingListener);
|
|
||||||
|
|
||||||
Timeout timeoutTask = timerService.newTimeout(new TimerTask() {
|
Timeout timeoutTask = timerService.newTimeout(new TimerTask() {
|
||||||
@Override public void run(Timeout timeout) throws Exception {
|
@Override public void run(Timeout timeout) throws Exception {
|
||||||
listener.onResponse(new Response(false));
|
listener.onResponse(new Response(false));
|
||||||
nodeMappingCreatedAction.remove(nodeMappingListener);
|
nodeMappingCreatedAction.remove(nodeMappingListener);
|
||||||
}
|
}
|
||||||
}, request.timeout, TimerService.ExecutionType.THREADED);
|
}, request.timeout, TimerService.ExecutionType.THREADED);
|
||||||
listener.timeout = timeoutTask;
|
listener.timeout = timeoutTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return newClusterStateBuilder().state(currentState).metaData(builder).build();
|
return newClusterStateBuilder().state(currentState).metaData(builder).build();
|
||||||
|
|
Loading…
Reference in New Issue