[ML] No need to add state doc mapping on job open in 7.x (#37759)
When upgrading from 5.4 to 5.5 to 6.7 (inclusive) it was necessary to ensure there was a mapping for type "doc" on the ML state index before opening a job. This was because 5.4 created a multi-type ML state index. In version 7.x we can be sure that any such 5.4 index is no longer in use. It would have had to be reindexed into the 6.x index format prior to the upgrade to version 7.x.
This commit is contained in:
parent
cb451edb01
commit
deafce1acd
|
@ -49,7 +49,6 @@ import org.elasticsearch.xpack.core.ml.job.config.JobState;
|
||||||
import org.elasticsearch.xpack.core.ml.job.config.JobTaskState;
|
import org.elasticsearch.xpack.core.ml.job.config.JobTaskState;
|
||||||
import org.elasticsearch.xpack.core.ml.job.config.JobUpdate;
|
import org.elasticsearch.xpack.core.ml.job.config.JobUpdate;
|
||||||
import org.elasticsearch.xpack.core.ml.job.persistence.AnomalyDetectorsIndex;
|
import org.elasticsearch.xpack.core.ml.job.persistence.AnomalyDetectorsIndex;
|
||||||
import org.elasticsearch.xpack.core.ml.job.persistence.ElasticsearchMappings;
|
|
||||||
import org.elasticsearch.xpack.core.ml.utils.ExceptionsHelper;
|
import org.elasticsearch.xpack.core.ml.utils.ExceptionsHelper;
|
||||||
import org.elasticsearch.xpack.ml.MachineLearning;
|
import org.elasticsearch.xpack.ml.MachineLearning;
|
||||||
import org.elasticsearch.xpack.ml.MlConfigMigrationEligibilityCheck;
|
import org.elasticsearch.xpack.ml.MlConfigMigrationEligibilityCheck;
|
||||||
|
@ -459,19 +458,11 @@ public class TransportOpenJobAction extends TransportMasterNodeAction<OpenJobAct
|
||||||
);
|
);
|
||||||
|
|
||||||
// Tell the job tracker to refresh the memory requirement for this job and all other jobs that have persistent tasks
|
// Tell the job tracker to refresh the memory requirement for this job and all other jobs that have persistent tasks
|
||||||
ActionListener<Boolean> jobUpdateListener = ActionListener.wrap(
|
ActionListener<Boolean> getJobHandler = ActionListener.wrap(
|
||||||
response -> memoryTracker.refreshJobMemoryAndAllOthers(jobParams.getJobId(), memoryRequirementRefreshListener),
|
response -> memoryTracker.refreshJobMemoryAndAllOthers(jobParams.getJobId(), memoryRequirementRefreshListener),
|
||||||
listener::onFailure
|
listener::onFailure
|
||||||
);
|
);
|
||||||
|
|
||||||
// Try adding state doc mapping
|
|
||||||
ActionListener<Void> getJobHandler = ActionListener.wrap(
|
|
||||||
response -> {
|
|
||||||
ElasticsearchMappings.addDocMappingIfMissing(AnomalyDetectorsIndex.jobStateIndexWriteAlias(),
|
|
||||||
ElasticsearchMappings::stateMapping, client, state, jobUpdateListener);
|
|
||||||
}, listener::onFailure
|
|
||||||
);
|
|
||||||
|
|
||||||
// Get the job config
|
// Get the job config
|
||||||
jobConfigProvider.getJob(jobParams.getJobId(), ActionListener.wrap(
|
jobConfigProvider.getJob(jobParams.getJobId(), ActionListener.wrap(
|
||||||
builder -> {
|
builder -> {
|
||||||
|
|
Loading…
Reference in New Issue