Skip to content

System data streams incorrectly show up in the list of template validation problems #128161

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

Merged

Conversation

masseyke
Copy link
Member

@masseyke masseyke commented May 19, 2025

If a user attempts to change an index template in a way that would make a data stream no longer valid, the response incorrectly includes the names of any system data streams (such as .fleet-actions-results) that happen to exist. For example, say I have a non-system data stream that matches a data stream template template1 with priority 300. It also matches a non-data-stream template template2 with priority 200, but that one is not in effect since it is lower priority. Now say I attempt to change template1 so that it has a priority of 100. This request will correctly fail since if we made this change my data stream would now match template2, which is an invalid state. But the response will also list all existing system data streams as part of the problem. The reason is that system data streams do not have named templates, and the API is incorrectly reporting on all data streams that do not have named templates. This fix filters out system data streams from this check.
Here is an example of the incorrect error message that we currently get (.fleet-actions-results ought to not be listed because it is a system data stream):

composable template [ecs-logs@8.10] with index patterns [logs-*-ecs.*.*.*.*, logs-ecs.*], priority [100] would cause data streams [.fleet-actions-results, logs-kubernetes.apiserver_logs-ecs.iss.pub] to no longer match a data stream template

@elasticsearchmachine elasticsearchmachine added the Team:Data Management Meta label for data/management team label May 19, 2025
@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine
Copy link
Collaborator

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

@masseyke masseyke requested a review from dakrone May 19, 2025 20:48
@masseyke masseyke added the auto-backport Automatically create backport pull requests when merged label May 19, 2025
Copy link
Member

@dakrone dakrone left a comment

Choose a reason for hiding this comment

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

LGTM, I left one really minor suggestion for the changelog entry wording. Thanks for fixing this Keith!

@dakrone
Copy link
Member

dakrone commented May 19, 2025

Oh also, since this is going to 9.0.x, can you backport to 8.18.x also?

Co-authored-by: Lee Hinman <dakrone@users.noreply.github.com>
@masseyke masseyke enabled auto-merge (squash) May 20, 2025 13:05
@masseyke masseyke merged commit 928fe1e into elastic:main May 20, 2025
17 checks passed
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
8.19 Commit could not be cherrypicked due to conflicts
8.18 Commit could not be cherrypicked due to conflicts
9.0 Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 128161

masseyke added a commit to masseyke/elasticsearch that referenced this pull request May 20, 2025
…ation problems (elastic#128161)

(cherry picked from commit 928fe1e)

# Conflicts:
#	server/src/main/java/org/elasticsearch/cluster/metadata/MetadataIndexTemplateService.java
#	server/src/test/java/org/elasticsearch/cluster/metadata/MetadataIndexTemplateServiceTests.java
#	test/framework/src/main/java/org/elasticsearch/cluster/metadata/DataStreamTestHelper.java
masseyke added a commit to masseyke/elasticsearch that referenced this pull request May 20, 2025
…ation problems (elastic#128161)

(cherry picked from commit 928fe1e)

# Conflicts:
#	server/src/main/java/org/elasticsearch/cluster/metadata/MetadataIndexTemplateService.java
#	server/src/test/java/org/elasticsearch/cluster/metadata/MetadataIndexTemplateServiceTests.java
#	test/framework/src/main/java/org/elasticsearch/cluster/metadata/DataStreamTestHelper.java
@masseyke
Copy link
Member Author

💚 All backports created successfully

Status Branch Result
9.0
8.19
8.18

Questions ?

Please refer to the Backport tool documentation

masseyke added a commit to masseyke/elasticsearch that referenced this pull request May 20, 2025
…ation problems (elastic#128161)

(cherry picked from commit 928fe1e)

# Conflicts:
#	server/src/main/java/org/elasticsearch/cluster/metadata/MetadataIndexTemplateService.java
#	server/src/test/java/org/elasticsearch/cluster/metadata/MetadataIndexTemplateServiceTests.java
#	test/framework/src/main/java/org/elasticsearch/cluster/metadata/DataStreamTestHelper.java
@masseyke masseyke deleted the system-data-stream-template-validation-bug branch May 20, 2025 17:15
masseyke added a commit that referenced this pull request May 20, 2025
masseyke added a commit that referenced this pull request May 20, 2025
masseyke added a commit that referenced this pull request May 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Automatically create backport pull requests when merged backport pending >bug :Data Management/Data streams Data streams and their lifecycles Team:Data Management Meta label for data/management team v8.18.2 v8.19.0 v9.0.2 v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants