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

Allow removing unreferenced composable data stream templates #84376

Conversation

dakrone
Copy link
Member

@dakrone dakrone commented Feb 24, 2022

Previously there was a bug where when we retrieved the list of data streams using a template, we
only checked index patterns, rather than actually comparing priorities and only treating the highest
priority template as "referenced". This commit fixes this problem by only treating the matching
composable template as referenced, allowing unreferenced templates to be safely deleted.

Resolves #84188
Resolves #84171

Previously there was a bug where when we retrieved the list of data streams using a template, we
only checked index patterns, rather than actually comparing priorities and only treating the highest
priority template as "referenced". This commit fixes this problem by only treating the matching
composable template as referenced, allowing unreferenced templates to be safely deleted.

Resolves elastic#84188
Resolves elastic#84171
@elasticmachine elasticmachine added the Team:Data Management Meta label for data/management team label Feb 24, 2022
@elasticmachine
Copy link
Collaborator

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

@elasticsearchmachine
Copy link
Collaborator

Hi @dakrone, I've created a changelog YAML for you.

Copy link
Contributor

@andreidan andreidan left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for fixing this Lee

client().execute(PutComposableIndexTemplateAction.INSTANCE, request).actionGet();

DeleteComposableIndexTemplateAction.Request deleteRequest = new DeleteComposableIndexTemplateAction.Request("id");
client().execute(DeleteComposableIndexTemplateAction.INSTANCE, deleteRequest).get();
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be worth adding an assertion the template is actually deleted/missing from the system? (to fend against bugs that'd swallow the exception or such)

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea, I've added this.

@dakrone dakrone force-pushed the allow-deleting-unreferenced-templates branch from 0738c28 to e9e9d0b Compare February 28, 2022 16:13
@dakrone dakrone added auto-backport-and-merge Automatically create backport pull requests and merge when ready auto-merge Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) labels Feb 28, 2022
@dakrone
Copy link
Member Author

dakrone commented Feb 28, 2022

@elasticmachine update branch

@dakrone
Copy link
Member Author

dakrone commented Feb 28, 2022

@elasticmachine update branch

@elasticsearchmachine elasticsearchmachine merged commit 76a2489 into elastic:master Feb 28, 2022
@dakrone dakrone deleted the allow-deleting-unreferenced-templates branch February 28, 2022 19:07
dakrone added a commit to dakrone/elasticsearch that referenced this pull request Feb 28, 2022
…#84376)

Previously there was a bug where when we retrieved the list of data
streams using a template, we only checked index patterns, rather than
actually comparing priorities and only treating the highest priority
template as "referenced". This commit fixes this problem by only
treating the matching composable template as referenced, allowing
unreferenced templates to be safely deleted.

Resolves elastic#84188 Resolves elastic#84171
dakrone added a commit to dakrone/elasticsearch that referenced this pull request Feb 28, 2022
…#84376)

Previously there was a bug where when we retrieved the list of data
streams using a template, we only checked index patterns, rather than
actually comparing priorities and only treating the highest priority
template as "referenced". This commit fixes this problem by only
treating the matching composable template as referenced, allowing
unreferenced templates to be safely deleted.

Resolves elastic#84188 Resolves elastic#84171
dakrone added a commit to dakrone/elasticsearch that referenced this pull request Feb 28, 2022
…#84376)

Previously there was a bug where when we retrieved the list of data
streams using a template, we only checked index patterns, rather than
actually comparing priorities and only treating the highest priority
template as "referenced". This commit fixes this problem by only
treating the matching composable template as referenced, allowing
unreferenced templates to be safely deleted.

Resolves elastic#84188 Resolves elastic#84171
elasticsearchmachine pushed a commit that referenced this pull request Feb 28, 2022
…#84449)

Previously there was a bug where when we retrieved the list of data
streams using a template, we only checked index patterns, rather than
actually comparing priorities and only treating the highest priority
template as "referenced". This commit fixes this problem by only
treating the matching composable template as referenced, allowing
unreferenced templates to be safely deleted.

Resolves #84188 Resolves #84171
elasticsearchmachine pushed a commit that referenced this pull request Feb 28, 2022
…#84450)

Previously there was a bug where when we retrieved the list of data
streams using a template, we only checked index patterns, rather than
actually comparing priorities and only treating the highest priority
template as "referenced". This commit fixes this problem by only
treating the matching composable template as referenced, allowing
unreferenced templates to be safely deleted.

Resolves #84188 Resolves #84171
elasticsearchmachine pushed a commit that referenced this pull request Feb 28, 2022
…84376) (#84452)

* Allow removing unreferenced composable data stream templates (#84376)

Previously there was a bug where when we retrieved the list of data
streams using a template, we only checked index patterns, rather than
actually comparing priorities and only treating the highest priority
template as "referenced". This commit fixes this problem by only
treating the matching composable template as referenced, allowing
unreferenced templates to be safely deleted.

Resolves #84188 Resolves #84171

* Fix compilation for old JDK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport-and-merge Automatically create backport pull requests and merge when ready auto-merge Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) >bug :Data Management/Indices APIs APIs to create and manage indices and templates Team:Data Management Meta label for data/management team v7.17.2 v8.0.2 v8.1.1 v8.2.0
Projects
None yet
4 participants