-
Notifications
You must be signed in to change notification settings - Fork 25k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ML: creating ML State write alias and pointing writes there #37483
Changes from 3 commits
9ccd34e
a98b2d3
e194d8e
a8bbd2e
5754435
694bc86
77749e6
3974ec9
eb50b03
bf23c35
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -347,7 +347,7 @@ public void snapshotMlMeta(MlMetadata mlMetadata, ActionListener<Boolean> listen | |
|
||
logger.debug("taking a snapshot of ml_metadata"); | ||
String documentId = "ml-config"; | ||
IndexRequestBuilder indexRequest = client.prepareIndex(AnomalyDetectorsIndex.jobStateIndexName(), | ||
IndexRequestBuilder indexRequest = client.prepareIndex(AnomalyDetectorsIndex.jobStateIndexWriteAlias(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's no guarantee that an autodetect process will have been started on the newer version of the product at the point when this call is made - if all ML jobs are closed prior to upgrading from 6.5 to 6.7 then that will definitely trigger this situation. So this method needs to call |
||
ElasticsearchMappings.DOC_TYPE, documentId) | ||
.setOpType(DocWriteRequest.OpType.CREATE); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -228,7 +228,7 @@ public void persistCategoryDefinition(CategoryDefinition category) { | |
*/ | ||
public void persistQuantiles(Quantiles quantiles) { | ||
Persistable persistable = new Persistable(quantiles.getJobId(), quantiles, Quantiles.documentId(quantiles.getJobId())); | ||
persistable.persist(AnomalyDetectorsIndex.jobStateIndexName()).actionGet(); | ||
persistable.persist(AnomalyDetectorsIndex.jobStateIndexWriteAlias()).actionGet(); | ||
} | ||
|
||
/** | ||
|
@@ -237,7 +237,7 @@ public void persistQuantiles(Quantiles quantiles) { | |
public void persistQuantiles(Quantiles quantiles, WriteRequest.RefreshPolicy refreshPolicy, ActionListener<IndexResponse> listener) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This method can be called when reverting a model snapshot, and there's no guarantee that an autodetect process will have been started on the newer version of the product at the point when a model snapshot is reverted. The call chain is |
||
Persistable persistable = new Persistable(quantiles.getJobId(), quantiles, Quantiles.documentId(quantiles.getJobId())); | ||
persistable.setRefreshPolicy(refreshPolicy); | ||
persistable.persist(AnomalyDetectorsIndex.jobStateIndexName(), listener); | ||
persistable.persist(AnomalyDetectorsIndex.jobStateIndexWriteAlias(), listener); | ||
} | ||
|
||
/** | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably shouldn't do the clutter avoidance in this case. If this method is called we know we're intending to write to an ML index shortly even if we never have up to this time. The effect of not creating the alias is pretty bad - it results in creation of a concrete index called
.ml-state-write
, and that is hard to switch over to an alias of the same name.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely, I agree. Additionally, This method should look for the concrete indices that match the prefix
.ml-state*
. Should be easy enough to adjust.