Skip to content

Delete watcher legacy templates#80915

Closed
andreidan wants to merge 4 commits intoelastic:masterfrom
andreidan:clean-watcher-legacy-templates
Closed

Delete watcher legacy templates#80915
andreidan wants to merge 4 commits intoelastic:masterfrom
andreidan:clean-watcher-legacy-templates

Conversation

@andreidan
Copy link
Copy Markdown
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
Copy Markdown
Collaborator

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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