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

[Ingest Manager] rollover data stream when index template mappings are not compatible #69180

Merged

Conversation

neptunian
Copy link
Contributor

@neptunian neptunian commented Jun 15, 2020

#68381

During an update, updating the current write index's mappings could be incompatible if a mapping type has changed, at which point a rollover of the index should take place.

It's not possible to easily test without having packages to update to in the registry that have incompatible mappings. Otherwise code changes would be necessary, so this should perhaps wait to be merged until those test packages are ready and I can include an integration test (#67372)

@neptunian neptunian added v8.0.0 v7.9.0 Team:Fleet Team label for Observability Data Collection Fleet team Feature:Ingest Management labels Jun 15, 2020
@neptunian neptunian self-assigned this Jun 15, 2020
@neptunian neptunian marked this pull request as ready for review June 16, 2020 16:51
@neptunian neptunian requested a review from a team June 16, 2020 16:51
@elasticmachine
Copy link
Contributor

Pinging @elastic/ingest-management (Team:Ingest Management)

@neptunian neptunian added the release_note:skip Skip the PR/issue when compiling release notes label Jun 16, 2020
@ruflin
Copy link
Member

ruflin commented Jun 17, 2020

If the code is decoupled from specific packages (which I think it mostly is) you could also test without a package at the moment. What I had in mind:

Flow with compatible mapping

  • Create template with foo: keyword in data stream
  • Create data stream matching template
  • Update data stream with mappings foo: keyword, bar: keyword
  • Make sure no errors happen
  • Make sure data stream mapping contains now both parts
  • Make sure no rollover happened

Flow with incompatible mapping

  • Create template with foo: keyword in data stream
  • Create data stream matching template
  • Update data stream with mappings foo.bar: keyword
  • Make sure errors happen and rollver is triggered
  • Make sure data stream mapping contains now foo.bar: keyword

The above does not mean we should not test with packages too in the future, but I think we can decouple this at the moment to have more local tests.

@neptunian
Copy link
Contributor Author

neptunian commented Jun 24, 2020

What I was thinking is this is only called within the installPackage handler from the install endpoint eg: /packages/system-0.1.0. The test cases would fall under the api integration test of this install endpoint. It seems like it would be redundant to test some functions within the endpoint as integration tests. As of now, we don't have integration tests for anything other than APIs.

@ruflin
Copy link
Member

ruflin commented Jun 25, 2020

@neptunian Not sure I follow what this means for the proposed tests. Does it mean we can't do it at the moment or that we should add it directly to the integrations tests?

@neptunian
Copy link
Contributor Author

neptunian commented Jun 25, 2020

Looking closer after our conversation, I don't think I can test these functions outside of the API endpoint. They all require an argument for the ES callCluster for the current user which is passed to the request handlers when making the request to the endpoint through the API. I think this is why you had mentioned needing to create an endpoint for integration tests with ES.

@ruflin
Copy link
Member

ruflin commented Jun 29, 2020

@elasticmachine merge upstream

@ruflin
Copy link
Member

ruflin commented Jun 29, 2020

@neptunian I suggest we get this PR merged rather soonish and can still follow up with tests. This will also allow us to test it manually.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Build metrics

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

path,
});
} catch (error) {
throw new Error(`cannot rollover data stream ${dataStreamName}`);
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about adding the error message that comes from elasticsearch to the new error message? This can be helpful for troubleshooting.

@skh
Copy link
Contributor

skh commented Jun 29, 2020

At some point, when we touch code, I think it would be a good idea to implement error handling as outlined in #66688 (as in: use IngestManagerError and adjust route handlers to react to it accordingly) but this can be added later too.

@skh skh self-requested a review June 29, 2020 13:40
Copy link
Contributor

@skh skh left a comment

Choose a reason for hiding this comment

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

I haven't tested whether the actual rollover happens, as you already agreed to add tests in a follow-up PR. Code looks good, and nothing breaks in local testing, so 👍!

@neptunian neptunian merged commit 81022a3 into elastic:master Jun 29, 2020
neptunian added a commit to neptunian/kibana that referenced this pull request Jun 30, 2020
…e not compatible (elastic#69180)

* rollover data stream when index template mappings are not compatible

* update error messages

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
neptunian added a commit that referenced this pull request Jun 30, 2020
…e not compatible (#69180) (#70318)

* rollover data stream when index template mappings are not compatible

* update error messages

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Bamieh pushed a commit to Bamieh/kibana that referenced this pull request Jul 1, 2020
…e not compatible (elastic#69180)

* rollover data stream when index template mappings are not compatible

* update error messages

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v7.9.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants