Skip to content

Commit

Permalink
Aliased analyzers cause index deletion / cleanup failure, closes #555.
Browse files Browse the repository at this point in the history
  • Loading branch information
kimchy committed Dec 8, 2010
1 parent f5a8c38 commit 34f3f3f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
Expand Up @@ -160,7 +160,14 @@ public AnalysisService(Index index) {
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);
}
}
}
}
Expand Down
Expand Up @@ -134,7 +134,11 @@ private void applyCleanedIndices(final ClusterChangedEvent event) {
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);
}
}
}
}
Expand All @@ -145,12 +149,16 @@ private void applyDeletedIndices(final ClusterChangedEvent event) {
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);
}
}
}
}
Expand Down

0 comments on commit 34f3f3f

Please sign in to comment.