Briefly delete manifested mapping type on a node without reason

When a dynamic type is introduced during indexing, the node that introduces it sends the fact that its added to the master, to be added to the master node. The master node then adds it to the index metadata and republishes that fact.

In order not to delete the mapping while the new type is introduced on the node that introduced it, we keep a map of seen mappings, and remove a mapping type when we already processed it.

The map is not properly cleared though in all places where an actual index service is being removed on a node.

closes #3697
This commit is contained in:
Shay Banon 2013-09-14 22:42:41 +02:00
parent e58900145b
commit 89e0b325c2
1 changed files with 17 additions and 17 deletions

View File

@ -168,7 +168,7 @@ public class IndicesClusterStateService extends AbstractLifecycleComponent<Indic
logger.warn("[{}] failed to remove shard (disabled block persistence)", e, index);
}
}
indicesService.removeIndex(index, "cleaning index (disabled block persistence)");
removeIndex(index, "cleaning index (disabled block persistence)");
}
return;
}
@ -240,11 +240,7 @@ public class IndicesClusterStateService extends AbstractLifecycleComponent<Indic
logger.debug("[{}] cleaning index (no shards allocated)", index);
}
// clean the index
try {
indicesService.removeIndex(index, "removing index (no shards allocated)");
} catch (Throwable e) {
logger.warn("[{}] failed to clean index (no shards of that index are allocated on this node)", e, index);
}
removeIndex(index, "removing index (no shards allocated)");
}
}
}
@ -255,17 +251,7 @@ public class IndicesClusterStateService extends AbstractLifecycleComponent<Indic
if (logger.isDebugEnabled()) {
logger.debug("[{}] cleaning index, no longer part of the metadata", index);
}
try {
indicesService.removeIndex(index, "index no longer part of the metadata");
} catch (Throwable e) {
logger.warn("failed to clean index", e);
}
// clear seen mappings as well
for (Tuple<String, String> tuple : seenMappings.keySet()) {
if (tuple.v1().equals(index)) {
seenMappings.remove(tuple);
}
}
removeIndex(index, "index no longer part of the metadata");
}
}
}
@ -791,6 +777,20 @@ public class IndicesClusterStateService extends AbstractLifecycleComponent<Indic
}
}
private void removeIndex(String index, String reason) {
try {
indicesService.removeIndex(index, reason);
} catch (Throwable e) {
logger.warn("failed to clean index ({})", e, reason);
}
// clear seen mappings as well
for (Tuple<String, String> tuple : seenMappings.keySet()) {
if (tuple.v1().equals(index)) {
seenMappings.remove(tuple);
}
}
}
private class FailedEngineHandler implements Engine.FailedEngineListener {
@Override
public void onFailedEngine(final ShardId shardId, final Throwable failure) {