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:
parent
e58900145b
commit
89e0b325c2
|
@ -168,7 +168,7 @@ public class IndicesClusterStateService extends AbstractLifecycleComponent<Indic
|
||||||
logger.warn("[{}] failed to remove shard (disabled block persistence)", e, index);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -240,11 +240,7 @@ public class IndicesClusterStateService extends AbstractLifecycleComponent<Indic
|
||||||
logger.debug("[{}] cleaning index (no shards allocated)", index);
|
logger.debug("[{}] cleaning index (no shards allocated)", index);
|
||||||
}
|
}
|
||||||
// clean the index
|
// clean the index
|
||||||
try {
|
removeIndex(index, "removing index (no shards allocated)");
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -255,17 +251,7 @@ public class IndicesClusterStateService extends AbstractLifecycleComponent<Indic
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug("[{}] cleaning index, no longer part of the metadata", index);
|
logger.debug("[{}] cleaning index, no longer part of the metadata", index);
|
||||||
}
|
}
|
||||||
try {
|
removeIndex(index, "index no longer part of the metadata");
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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 {
|
private class FailedEngineHandler implements Engine.FailedEngineListener {
|
||||||
@Override
|
@Override
|
||||||
public void onFailedEngine(final ShardId shardId, final Throwable failure) {
|
public void onFailedEngine(final ShardId shardId, final Throwable failure) {
|
||||||
|
|
Loading…
Reference in New Issue