Skip to content

Delete watcher legacy templates #80915

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

Closed

Conversation

andreidan
Copy link
Contributor

This adds a bit of infrastructure to be able to remove multiple legacy templates
with one cluster state update and removes the legacy watcher index templates.

Relates to #80853

This adds a way to be able to remove multiple legacy index templates
in one cluster state update.
We moved watcher to run on the system indices infrastructure in elastic#67588.
This commit makes sure Watcher cleans up the legacy templates it used
before it was migrated to system indices.
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-data-management (Team:Data Management)

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.

Looks good, I left a few comments.

private volatile WatcherService watcherService;
private final EnumSet<WatcherState> stopStates = EnumSet.of(WatcherState.STOPPED, WatcherState.STOPPING);
private final AtomicBoolean legacyTemplatesDeleteInProgress = new AtomicBoolean(false);
private final AtomicBoolean checkForLegacyTemplates = new AtomicBoolean(true);
Copy link
Member

Choose a reason for hiding this comment

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

Should checking whether a removal of templates is in progress be part of the functionality that MetadataIndexTemplateService.removeTemplates(...) method offers?

e
);
}));
}
Copy link
Member

Choose a reason for hiding this comment

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

Should checkForLegacyTemplates be set to false when existingTemplatesToDelete list is empty?

*
* The provided templates must exist in the cluster, otherwise an {@link IndexTemplateMissingException} is reported.
*/
public static void removeTemplates(
Copy link
Member

Choose a reason for hiding this comment

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

maybe rename to removeLegacyTemplates? To emphasise this batch removal method is for legacy templates only.

@andreidan
Copy link
Contributor Author

Superseded by #80937

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants