don't call the refresh mapping listener callback twice

though not harmful, results in an annoying transport service log
This commit is contained in:
Shay Banon 2013-07-30 23:41:22 +02:00
parent 95855c515b
commit 813e3557ab
1 changed files with 5 additions and 7 deletions

View File

@ -23,7 +23,10 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import org.elasticsearch.action.support.master.MasterNodeOperationRequest; import org.elasticsearch.action.support.master.MasterNodeOperationRequest;
import org.elasticsearch.cluster.*; import org.elasticsearch.cluster.ClusterService;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.ClusterStateUpdateTask;
import org.elasticsearch.cluster.TimeoutClusterStateUpdateTask;
import org.elasticsearch.cluster.action.index.NodeMappingCreatedAction; import org.elasticsearch.cluster.action.index.NodeMappingCreatedAction;
import org.elasticsearch.cluster.routing.IndexRoutingTable; import org.elasticsearch.cluster.routing.IndexRoutingTable;
import org.elasticsearch.common.Priority; import org.elasticsearch.common.Priority;
@ -276,7 +279,7 @@ public class MetaDataMappingService extends AbstractComponent {
public void updateMapping(final String index, final String type, final CompressedString mappingSource, final Listener listener) { public void updateMapping(final String index, final String type, final CompressedString mappingSource, final Listener listener) {
refreshOrUpdateQueue.add(new UpdateTask(index, type, mappingSource, listener)); refreshOrUpdateQueue.add(new UpdateTask(index, type, mappingSource, listener));
clusterService.submitStateUpdateTask("update-mapping [" + index + "][" + type + "]", Priority.HIGH, new ProcessedClusterStateUpdateTask() { clusterService.submitStateUpdateTask("update-mapping [" + index + "][" + type + "]", Priority.HIGH, new ClusterStateUpdateTask() {
@Override @Override
public void onFailure(String source, Throwable t) { public void onFailure(String source, Throwable t) {
listener.onFailure(t); listener.onFailure(t);
@ -286,11 +289,6 @@ public class MetaDataMappingService extends AbstractComponent {
public ClusterState execute(final ClusterState currentState) throws Exception { public ClusterState execute(final ClusterState currentState) throws Exception {
return executeRefreshOrUpdate(currentState); return executeRefreshOrUpdate(currentState);
} }
@Override
public void clusterStateProcessed(String source, ClusterState oldState, ClusterState newState) {
listener.onResponse(new Response(true));
}
}); });
} }