Skip to content
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

Migrate aliased indices to data stream #61525

Merged
merged 32 commits into from
Oct 29, 2020

Conversation

danhermann
Copy link
Contributor

Updates the MetadataCreateDataStreamService to permit existing indices as backing indices when creating a new data stream.

Relates to #61046

@danhermann
Copy link
Contributor Author

@elasticmachine update branch

@elasticmachine
Copy link
Collaborator

merge conflict between base and head

@andreidan andreidan added v7.11.0 and removed v7.10.0 labels Oct 7, 2020
@danhermann
Copy link
Contributor Author

@elasticmachine update branch

@danhermann
Copy link
Contributor Author

@elasticmachine update branch

@danhermann
Copy link
Contributor Author

@elasticmachine update branch

elasticmachine and others added 4 commits October 21, 2020 11:24
A side effect is moving logic that prepares indices to be backing indices to migrate service.

* By using the mapper service directly in the migrate logic,
  mapping validation error occur before updating the cluster state.
  Whereas before the validation errors occurred when all mapper
  services in other nodes where updated in the cluster,
  which is too late, because the update already happened.
* Updating the mapping using maps somehow changed the ordering, which caused assertions to trip.
@danhermann
Copy link
Contributor Author

@elasticmachine update branch

@danhermann
Copy link
Contributor Author

@elasticmachine run elasticsearch-ci/2

@danhermann
Copy link
Contributor Author

@martijnvg, I'm marking this as ready for review. I've moved the test code around to accommodate the new location of the validation logic. Let me know if I missed something you were expecting.

@danhermann danhermann marked this pull request as ready for review October 27, 2020 20:20
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-features (:Core/Features/Data streams)

@elasticmachine elasticmachine added the Team:Data Management Meta label for data/management team label Oct 27, 2020
Copy link
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left two comments, but other than that, this change is looking good!

Metadata.Builder builder = Metadata.builder(currentState.metadata()).put(newDataStream);
logger.info("adding data stream [{}]", request.name);
logger.info("adding data stream [{}]", dataStreamName);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add what the write index is and backing indices (if any) to this log message?

@@ -277,17 +277,17 @@ public void testValidateNotDisallowedAttribute() throws IOException {
assertThat(e.getMessage(), equalTo("data stream timestamp field [@timestamp] has disallowed attributes: [store]"));
}

public void testCannotUpdateTimestampField() throws IOException {
public void testCanUpdateTimestampField() throws IOException {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to adjust test and the data stream timestamp field mapper.
Updating from false to true is allowed, but updating from true to false is disallowed.
`

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This validation can be added by invoking setMergeValidator(...)method when building enabled parameter in DataStreamTimestampFieldMapper line 78.

@danhermann
Copy link
Contributor Author

Thanks, @martijnvg. I've made those changes.

Copy link
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@danhermann danhermann merged commit 7d2d737 into elastic:master Oct 29, 2020
@danhermann danhermann deleted the 61046_migrate_to_data_stream branch October 29, 2020 13:05
@danhermann
Copy link
Contributor Author

Thanks, @martijnvg!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Data Management/Data streams Data streams and their lifecycles >enhancement Team:Data Management Meta label for data/management team v7.11.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants