-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[WIP] Store should not update template on every restart. #28611
[WIP] Store should not update template on every restart. #28611
Conversation
Pinging @elastic/kibana-platform |
💔 Build Failed |
💔 Build Failed |
|
||
if (existingTemplate) { | ||
shouldUpdate = | ||
hash(existingTemplate[this.index].mappings._doc.properties) !== hash(templateProperties); |
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.
This does prevent overwriting it upon every restart, but it also means that if an older version happens to be restarted, then it will trample a newer version's template.
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 don't see this as an issue. Because index templates don't change existing indices. If you delete the index, it will then get created with the new mappings from the older templated version but before task manager would run and index a task it would update the template.
We could double check the mappings once per run before indexing or handle indexing error appropriately to determine the index was changed and doesn't match.
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 think @pickypg is right in that updates need to be controlled in that they must either install the template from scratch, upgrade it, or do nothing. If they can't upgrade it, they'll potentially break things in ways that will be hard to troubleshoot for the user: the outcome of the problem will be some kind of TypeError when an old instance of Kibana claims a new task and fields it depends on have moved.
Consider:
- Kibana 0.1.0 starts up, installs the template from scratch
- Kibana 1.0.0 starts up, overwrites the template
- Kibana 1.0.0 schedules a task
- Kibana 0.1.0 claims the task
- Boom.
Edit: to add more thoughts, the original PR we're working on handles this in two ways:
- Numeric versioning ensures old templates do not overwrite new templates, provides helpful log messaging to get users to upgrade
- API versioning ensures older instances are only able to claim tasks they understand
Summary
This may be an alternative to trying to track version numbers for templates. Instead of trying to store, read, compare and track a version number. We can get the template properties, compare them to the codes properties with order agnostic hashes.
If anyone changes the
templateProperties
the template would be updated. As well as when it does not exist.This would close #28540
Relevant details from that PR
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.This was checked for cross-browser compatibility, including a check against IE11Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n supportDocumentation was added for features that require explanation or tutorialsThis was checked for keyboard-only and screenreader accessibilityFor maintainers
This was checked for breaking API changes and was labeled appropriatelyThis includes a feature addition or change that requires a release note and was labeled appropriately