Skip to content

Commit

Permalink
Deleting and recreating a new index with dynamic mapping can cause ty…
Browse files Browse the repository at this point in the history
…pe failures, closes elastic#931.
  • Loading branch information
kimchy committed May 15, 2011
1 parent 3f0c5c8 commit bad34b9
Showing 1 changed file with 8 additions and 1 deletion.
Expand Up @@ -94,7 +94,8 @@ public class IndicesClusterStateService extends AbstractLifecycleComponent<Indic

private final NodeMappingRefreshAction nodeMappingRefreshAction;

// a map of mappings type we have seen per index
// a map of mappings type we have seen per index due to cluster state
// we need this so we won't remove types automatically created as part of the indexing process
private final ConcurrentMap<Tuple<String, String>, Boolean> seenMappings = ConcurrentCollections.newConcurrentMap();

private final Object mutex = new Object();
Expand Down Expand Up @@ -198,6 +199,12 @@ private void applyDeletedIndices(final ClusterChangedEvent event) {
} catch (Exception e) {
logger.warn("failed to delete index", e);
}
// clear seen mappings as well
for (Tuple<String, String> tuple : seenMappings.keySet()) {
if (tuple.v1().equals(index)) {
seenMappings.remove(tuple);
}
}
}
}
}
Expand Down

0 comments on commit bad34b9

Please sign in to comment.