|
19 | 19 |
|
20 | 20 | package org.elasticsearch.rest.action.cat; |
21 | 21 |
|
22 | | -import com.carrotsearch.hppc.cursors.ObjectObjectCursor; |
23 | 22 | import org.elasticsearch.action.ActionListener; |
24 | 23 | import org.elasticsearch.action.ActionResponse; |
25 | 24 | import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest; |
@@ -106,18 +105,20 @@ public RestResponse buildResponse(final Table table) throws Exception { |
106 | 105 | sendGetSettingsRequest(indices, indicesOptions, local, masterNodeTimeout, client, new ActionListener<>() { |
107 | 106 | @Override |
108 | 107 | public void onResponse(final GetSettingsResponse getSettingsResponse) { |
109 | | - final String[] concreteIndices = new String[getSettingsResponse.getIndexToSettings().size()]; |
110 | | - int i = 0; |
111 | | - for(ObjectObjectCursor<String, Settings> cursor : getSettingsResponse.getIndexToSettings()) { |
112 | | - concreteIndices[i++] = cursor.key; |
113 | | - } |
114 | | - |
115 | 108 | final GroupedActionListener<ActionResponse> groupedListener = createGroupedListener(request, 4, listener); |
116 | 109 | groupedListener.onResponse(getSettingsResponse); |
117 | 110 |
|
118 | | - sendIndicesStatsRequest(concreteIndices, indicesOptions, includeUnloadedSegments, client, groupedListener); |
119 | | - sendClusterStateRequest(concreteIndices, indicesOptions, local, masterNodeTimeout, client, groupedListener); |
120 | | - sendClusterHealthRequest(concreteIndices, indicesOptions, local, masterNodeTimeout, client, groupedListener); |
| 111 | + // Indices that were successfully resolved during the get settings request might be deleted when the subsequent cluster |
| 112 | + // state, cluster health and indices stats requests execute. We have to distinguish two cases: |
| 113 | + // 1) the deleted index was explicitly passed as parameter to the /_cat/indices request. In this case we want the |
| 114 | + // subsequent requests to fail. |
| 115 | + // 2) the deleted index was resolved as part of a wildcard or _all. In this case, we want the subsequent requests not to |
| 116 | + // fail on the deleted index (as we want to ignore wildcards that cannot be resolved). |
| 117 | + // This behavior can be ensured by letting the cluster state, cluster health and indices stats requests re-resolve the |
| 118 | + // index names with the same indices options that we used for the initial cluster state request (strictExpand). |
| 119 | + sendIndicesStatsRequest(indices, indicesOptions, includeUnloadedSegments, client, groupedListener); |
| 120 | + sendClusterStateRequest(indices, indicesOptions, local, masterNodeTimeout, client, groupedListener); |
| 121 | + sendClusterHealthRequest(indices, indicesOptions, local, masterNodeTimeout, client, groupedListener); |
121 | 122 | } |
122 | 123 |
|
123 | 124 | @Override |
|
0 commit comments