-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
API for adding and removing indices from a data stream #79279
Conversation
Pinging @elastic/kibana-stack-management since this is a new API |
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.
Generally looks good to me! I left a couple of comments but nothing major (I know it's still a draft PR also)
private String dataStream; | ||
private String index; |
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.
Since this is not really big enough to be a builder class, I think we should make these final (it's not too hard for a user to pass them in the constructor)
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.
I originally had all the members as final
but I believe they have to be mutable so the parser is able to construct them here.
server/src/main/java/org/elasticsearch/cluster/metadata/DataStreamAction.java
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/cluster/metadata/MetadataDataStreamsService.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/cluster/metadata/MetadataDataStreamsService.java
Outdated
Show resolved
Hide resolved
Pinging @elastic/clients-team (Team:Clients) |
Pinging @elastic/es-data-management (Team:Data Management) |
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.
Okay I took another look at this, I left a few comments, hopefully nothing too major.
I was also wondering about documentation, are we planning on doing that in a follow-up PR?
server/src/main/java/org/elasticsearch/cluster/metadata/MetadataDataStreamsService.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/cluster/metadata/DataStreamAction.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/cluster/metadata/MetadataDataStreamsService.java
Outdated
Show resolved
Hide resolved
...rc/main/java/org/elasticsearch/xpack/datastreams/action/ModifyDataStreamTransportAction.java
Outdated
Show resolved
Hide resolved
...reams/src/main/java/org/elasticsearch/xpack/datastreams/rest/RestModifyDataStreamAction.java
Outdated
Show resolved
Hide resolved
.../plugin/src/yamlRestTest/resources/rest-api-spec/test/data_stream/170_modify_data_stream.yml
Outdated
Show resolved
Hide resolved
Yes, I'll write up the docs in a follow-up PR. |
@elasticmachine update branch |
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.
LGTM, I left one really minor comment that doesn't need another review after addressing.
Out of curiosity, do you think we should (in future work, not time-constrained) support changing which index is the write index of a data stream the same way that we support it for aliases? Does that even make sense for a data stream?
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class ModifyDataStreamsRequestTests extends AbstractWireSerializingTestCase<Request> { |
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.
Can you add an override to mutateInstance
for this class also so that it runs the full mutation tests?
@elasticmachine update branch |
Thanks, @dakrone!
There may be some edge cases in which changing the write index could be useful. Generally speaking, I think it's something that's better avoided since data stream backing indices, under normal usage, will accumulate sequential data in mostly non-overlapping time intervals which facilitates fast retrieval. Allowing arbitrary replacement of the write index could weaken that. It's probably worth a discussion about if we could allow it for the cases where it might be useful without weakening some of the core benefits of data streams. |
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.
Some comments on the API specification:
rest-api-spec/src/main/resources/rest-api-spec/api/indices.modify_data_stream.json
Outdated
Show resolved
Hide resolved
rest-api-spec/src/main/resources/rest-api-spec/api/indices.modify_data_stream.json
Outdated
Show resolved
Hide resolved
rest-api-spec/src/main/resources/rest-api-spec/api/indices.modify_data_stream.json
Show resolved
Hide resolved
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.
LGTM
@sethmlarson, thanks for catching the errors in the API spec! |
* upstream/master: Validate tsdb's routing_path (elastic#79384) Adjust the BWC version for the return200ForClusterHealthTimeout field (elastic#79436) API for adding and removing indices from a data stream (elastic#79279) Exposing the ability to log deprecated settings at non-critical level (elastic#79107) Convert operator privilege license object to LicensedFeature (elastic#79407) Mute SnapshotBasedIndexRecoveryIT testSeqNoBasedRecoveryIsUsedAfterPrimaryFailOver (elastic#79456) Create cache files with CREATE_NEW & SPARSE options (elastic#79371) Revert "[ML] Use a new annotations index for future annotations (elastic#79151)" [ML] Use a new annotations index for future annotations (elastic#79151) [ML] Removing legacy code from ML/transform auditor (elastic#79434) Fix rate agg with custom `_doc_count` (elastic#79346) Optimize SLM Policy Queries (elastic#79341) Fix execution of exists query within nested queries on field with doc_values disabled (elastic#78841) Stricter UpdateSettingsRequest parsing on the REST layer (elastic#79227) Do not release snapshot file download permit during recovery retries (elastic#79409) Preserve request headers in a mixed version cluster (elastic#79412) Adjust versions after elastic#79044 backport to 7.x (elastic#79424) Mute BulkByScrollUsesAllScrollDocumentsAfterConflictsIntegTests (elastic#79429) Fail on SSPL licensed x-pack sources (elastic#79348) # Conflicts: # server/src/test/java/org/elasticsearch/index/TimeSeriesModeTests.java
This PR includes just the REST endpoint. The service itself was added in previous PRs linked to #75852.
Closes #75852