mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 10:25:15 +00:00
Aliased analyzers cause index deletion / cleanup failure, closes #555.
This commit is contained in:
parent
f5a8c3881f
commit
34f3f3f79e
@ -160,7 +160,14 @@ public class AnalysisService extends AbstractIndexComponent implements Closeable
|
||||
public void close() {
|
||||
for (NamedAnalyzer analyzer : analyzers.values()) {
|
||||
if (analyzer.scope() == AnalyzerScope.INDEX) {
|
||||
analyzer.close();
|
||||
try {
|
||||
analyzer.close();
|
||||
} catch (NullPointerException e) {
|
||||
// because analyzers are aliased, they might be closed several times
|
||||
// an NPE is thrown in this case, so ignore....
|
||||
} catch (Exception e) {
|
||||
logger.debug("failed to close analyzer " + analyzer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -134,7 +134,11 @@ public class IndicesClusterStateService extends AbstractLifecycleComponent<Indic
|
||||
logger.debug("[{}] cleaning index (no shards allocated)", index);
|
||||
}
|
||||
// clean the index
|
||||
indicesService.cleanIndex(index);
|
||||
try {
|
||||
indicesService.cleanIndex(index);
|
||||
} catch (Exception e) {
|
||||
logger.warn("failed to clean index (no shards of that index are allocated on this node)", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -145,12 +149,16 @@ public class IndicesClusterStateService extends AbstractLifecycleComponent<Indic
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("[{}] deleting index", index);
|
||||
}
|
||||
indicesService.deleteIndex(index);
|
||||
threadPool.execute(new Runnable() {
|
||||
@Override public void run() {
|
||||
nodeIndexDeletedAction.nodeIndexDeleted(index, event.state().nodes().localNodeId());
|
||||
}
|
||||
});
|
||||
try {
|
||||
indicesService.deleteIndex(index);
|
||||
threadPool.execute(new Runnable() {
|
||||
@Override public void run() {
|
||||
nodeIndexDeletedAction.nodeIndexDeleted(index, event.state().nodes().localNodeId());
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
logger.warn("failed to delete index", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user