|
28 | 28 | import org.elasticsearch.cluster.service.ClusterService; |
29 | 29 | import org.elasticsearch.common.settings.Setting; |
30 | 30 | import org.elasticsearch.core.Nullable; |
| 31 | +import org.elasticsearch.core.Strings; |
31 | 32 | import org.elasticsearch.core.TimeValue; |
32 | 33 | import org.elasticsearch.index.Index; |
33 | 34 | import org.elasticsearch.persistent.AllocatedPersistentTask; |
|
44 | 45 | import java.util.List; |
45 | 46 | import java.util.Map; |
46 | 47 | import java.util.NoSuchElementException; |
47 | | -import java.util.function.BiConsumer; |
48 | 48 |
|
49 | 49 | import static org.elasticsearch.xpack.core.deprecation.DeprecatedIndexPredicate.getReindexRequiredPredicate; |
50 | 50 |
|
@@ -221,31 +221,31 @@ private void maybeProcessNextIndex( |
221 | 221 | l -> client.execute( |
222 | 222 | ReindexDataStreamIndexAction.INSTANCE, |
223 | 223 | reindexDataStreamIndexRequest, |
224 | | - l.delegateResponse(new BiConsumer<ActionListener<ReindexDataStreamIndexAction.Response>, Exception>() { |
225 | | - @Override |
226 | | - public void accept(ActionListener<ReindexDataStreamIndexAction.Response> responseActionListener, Exception e) { |
227 | | - IndexMetadata sourceIndex = clusterService.state().getMetadata().index(index.getName()); |
228 | | - if (sourceIndex == null) { |
229 | | - /* |
230 | | - * One possible cause of exception here is that the source index no longer exists. This can happen if ILM |
231 | | - * performs certain actions while reindex is happening, or if a user manually deletes it. In this case we don't |
232 | | - * want to fail the task. We treat it as a success and move on. The updateDataStreamOrCleanup method will make |
233 | | - * an attempt at deleting the destination index if it has been created. |
234 | | - */ |
235 | | - logger.debug( |
| 224 | + l.delegateResponse((responseActionListener, e) -> { |
| 225 | + IndexMetadata sourceIndex = clusterService.state().getMetadata().index(index.getName()); |
| 226 | + if (sourceIndex == null) { |
| 227 | + /* |
| 228 | + * One possible cause of exception here is that the source index no longer exists. This can happen if ILM |
| 229 | + * performs certain actions while reindex is happening, or if a user manually deletes it. In this case we don't |
| 230 | + * want to fail the task. We treat it as a success and move on. The updateDataStreamOrCleanup method will make |
| 231 | + * an attempt at deleting the destination index if it has been created. |
| 232 | + */ |
| 233 | + logger.debug( |
| 234 | + () -> Strings.format( |
236 | 235 | "The source index {} in the data stream {} was removed during processing", |
237 | 236 | index.getName(), |
238 | 237 | sourceDataStream |
239 | | - ); |
240 | | - // We need the destination index name in the response so that updateDataStreamOrCleanup can delete it |
241 | | - l.onResponse( |
242 | | - new ReindexDataStreamIndexAction.Response( |
243 | | - ReindexDataStreamIndexTransportAction.generateDestIndexName(index.getName()) |
244 | | - ) |
245 | | - ); |
246 | | - } else { |
247 | | - l.onFailure(e); |
248 | | - } |
| 238 | + ), |
| 239 | + e |
| 240 | + ); |
| 241 | + // We need the destination index name in the response so that updateDataStreamOrCleanup can delete it |
| 242 | + responseActionListener.onResponse( |
| 243 | + new ReindexDataStreamIndexAction.Response( |
| 244 | + ReindexDataStreamIndexTransportAction.generateDestIndexName(index.getName()) |
| 245 | + ) |
| 246 | + ); |
| 247 | + } else { |
| 248 | + responseActionListener.onFailure(e); |
249 | 249 | } |
250 | 250 | }) |
251 | 251 | ) |
|
0 commit comments