Aliases API times out when actions end up with no actual change to aliases

closes #2345
This commit is contained in:
Shay Banon 2012-10-21 02:45:56 +02:00
parent a3e7daf415
commit faa7501715
1 changed files with 8 additions and 2 deletions

View File

@ -159,10 +159,16 @@ public class MetaDataIndexAliasesService extends AbstractComponent {
if (changed) { if (changed) {
ClusterState updatedState = newClusterStateBuilder().state(currentState).metaData(builder).build(); ClusterState updatedState = newClusterStateBuilder().state(currentState).metaData(builder).build();
// even though changes happened, they resulted in 0 actual changes to metadata
// i.e. remove and add the same alias to the same index
if (updatedState.metaData().aliases().equals(currentState.metaData().aliases())) {
listener.onResponse(new Response(true));
return currentState;
}
// wait for responses from other nodes if needed // wait for responses from other nodes if needed
int responseCount = updatedState.getNodes().size(); int responseCount = updatedState.nodes().size();
long version = updatedState.version() + 1; long version = updatedState.version() + 1;
logger.trace("Waiting for [{}] notifications with version [{}]", responseCount, version); logger.trace("waiting for [{}] notifications with version [{}]", responseCount, version);
aliasOperationPerformedAction.add(new CountDownListener(responseCount, listener, version), request.timeout); aliasOperationPerformedAction.add(new CountDownListener(responseCount, listener, version), request.timeout);
return updatedState; return updatedState;