Skip to content

Commit 3e623e5

Browse files
Prevent reset during upgrade mode
1 parent db06fa1 commit 3e623e5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportResetJobAction.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import org.elasticsearch.tasks.TaskResult;
3737
import org.elasticsearch.threadpool.ThreadPool;
3838
import org.elasticsearch.transport.TransportService;
39+
import org.elasticsearch.xpack.core.ml.MlMetadata;
3940
import org.elasticsearch.xpack.core.ml.MlTasks;
4041
import org.elasticsearch.xpack.core.ml.action.ResetJobAction;
4142
import org.elasticsearch.xpack.core.ml.job.config.BlockReason;
@@ -79,6 +80,11 @@ public TransportResetJobAction(TransportService transportService, ClusterService
7980
@Override
8081
protected void masterOperation(Task task, ResetJobAction.Request request, ClusterState state,
8182
ActionListener<AcknowledgedResponse> listener) throws Exception {
83+
if (MlMetadata.getMlMetadata(state).isUpgradeMode()) {
84+
listener.onFailure(ExceptionsHelper.conflictStatusException("cannot reset job while indices are being upgraded"));
85+
return;
86+
}
87+
8288
final TaskId taskId = new TaskId(clusterService.localNode().getId(), task.getId());
8389

8490
ActionListener<Job.Builder> jobListener = ActionListener.wrap(

0 commit comments

Comments
 (0)