mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-20 03:45:02 +00:00
catch failures and notify the listener in aliases action handling
This commit is contained in:
parent
7a9350c9a1
commit
4da7086df8
@ -72,8 +72,10 @@ public class MetaDataIndexAliasesService extends AbstractComponent {
|
||||
public void indicesAliases(final Request request, final Listener listener) {
|
||||
clusterService.submitStateUpdateTask("index-aliases", Priority.URGENT, new ProcessedClusterStateUpdateTask() {
|
||||
@Override
|
||||
public ClusterState execute(ClusterState currentState) {
|
||||
|
||||
public ClusterState execute(final ClusterState currentState) {
|
||||
List<String> indicesToClose = Lists.newArrayList();
|
||||
Map<String, IndexService> indices = Maps.newHashMap();
|
||||
try {
|
||||
for (AliasAction aliasAction : request.actions) {
|
||||
if (!currentState.metaData().hasIndex(aliasAction.index())) {
|
||||
listener.onFailure(new IndexMissingException(new Index(aliasAction.index())));
|
||||
@ -89,9 +91,6 @@ public class MetaDataIndexAliasesService extends AbstractComponent {
|
||||
}
|
||||
}
|
||||
|
||||
List<String> indicesToClose = Lists.newArrayList();
|
||||
Map<String, IndexService> indices = Maps.newHashMap();
|
||||
try {
|
||||
boolean changed = false;
|
||||
MetaData.Builder builder = newMetaDataBuilder().metaData(currentState.metaData());
|
||||
for (AliasAction aliasAction : request.actions) {
|
||||
@ -178,6 +177,9 @@ public class MetaDataIndexAliasesService extends AbstractComponent {
|
||||
listener.onResponse(new Response(true));
|
||||
return currentState;
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
listener.onResponse(new Response(true));
|
||||
return currentState;
|
||||
} finally {
|
||||
for (String index : indicesToClose) {
|
||||
indicesService.removeIndex(index, "created for alias processing");
|
||||
|
Loading…
x
Reference in New Issue
Block a user