-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…#55016) This changes the priority of the cluster state update that stops ILM altogether to `IMMEDIATE`. We've chosen to change this as it can be useful to temporarily stop ILM if a cluster is overwhelmed, but a `NORMAL` priority can see the "stop ILM update" not make it up the tasks queue. On the same note, we're keeping the `start ILM` cluster update priority to `NORMAL` on purpose such that we only start `ILM` if the cluster can handle it. (cherry picked from commit d67df3a) Signed-off-by: Andrei Dan <andrei.dan@elastic.co>
- Loading branch information
Showing
5 changed files
with
146 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
...gin/ilm/src/test/java/org/elasticsearch/xpack/ilm/action/TransportStopILMActionTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.ilm.action; | ||
|
||
import org.elasticsearch.action.ActionListener; | ||
import org.elasticsearch.action.support.ActionFilters; | ||
import org.elasticsearch.action.support.master.AcknowledgedResponse; | ||
import org.elasticsearch.cluster.AckedClusterStateUpdateTask; | ||
import org.elasticsearch.cluster.ClusterState; | ||
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; | ||
import org.elasticsearch.cluster.service.ClusterService; | ||
import org.elasticsearch.common.Priority; | ||
import org.elasticsearch.test.ESTestCase; | ||
import org.elasticsearch.threadpool.ThreadPool; | ||
import org.elasticsearch.transport.TransportService; | ||
import org.elasticsearch.xpack.core.ilm.StopILMRequest; | ||
import org.hamcrest.Description; | ||
import org.mockito.ArgumentMatcher; | ||
|
||
import static org.mockito.Matchers.argThat; | ||
import static org.mockito.Matchers.eq; | ||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.verify; | ||
|
||
public class TransportStopILMActionTests extends ESTestCase { | ||
|
||
private static final ActionListener<AcknowledgedResponse> EMPTY_LISTENER = new ActionListener<AcknowledgedResponse>() { | ||
@Override | ||
public void onResponse(AcknowledgedResponse response) { | ||
|
||
} | ||
|
||
@Override | ||
public void onFailure(Exception e) { | ||
|
||
} | ||
}; | ||
|
||
@SuppressWarnings("unchecked") | ||
public void testStopILMClusterStatePriorityIsImmediate() { | ||
ClusterService clusterService = mock(ClusterService.class); | ||
|
||
TransportStopILMAction transportStopILMAction = new TransportStopILMAction(mock(TransportService.class), | ||
clusterService, mock(ThreadPool.class), mock(ActionFilters.class), mock(IndexNameExpressionResolver.class)); | ||
StopILMRequest request = new StopILMRequest(); | ||
transportStopILMAction.masterOperation(request, ClusterState.EMPTY_STATE, EMPTY_LISTENER); | ||
|
||
verify(clusterService).submitStateUpdateTask( | ||
eq("ilm_operation_mode_update"), | ||
argThat(new ArgumentMatcher<AckedClusterStateUpdateTask<AcknowledgedResponse>>() { | ||
|
||
Priority actualPriority = null; | ||
|
||
@Override | ||
public boolean matches(Object argument) { | ||
if (argument instanceof AckedClusterStateUpdateTask == false) { | ||
return false; | ||
} | ||
actualPriority = ((AckedClusterStateUpdateTask<AcknowledgedResponse>) argument).priority(); | ||
return actualPriority == Priority.IMMEDIATE; | ||
} | ||
|
||
@Override | ||
public void describeTo(Description description) { | ||
description.appendText("the cluster state update task priority must be URGENT but got: ") | ||
.appendText(actualPriority.name()); | ||
} | ||
}) | ||
); | ||
} | ||
|
||
} |