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

[Fleet] Rollover data streams when package w/ TSDB setting changed is installed #157869

Merged
merged 5 commits into from
May 16, 2023

Conversation

kpollich
Copy link
Member

@kpollich kpollich commented May 16, 2023

Summary

Fixes #157345

When a package with a changed index.mode or source.mode setting is installed, Fleet will now automatically perform a rollover to ensure the correct setting is present on the resulting backing index.

There is an issue with Elasticsearch wherein toggling these settings back and forth will incur a backing index range overlap error. See elastic/elasticsearch#96163.

To test

  1. Install the system integration at version 1.28.0
  2. Create an integration policy for the system integration (a standard default agent policy will do)
  3. Enroll an agent in this policy, and allow it to ingest some data
  4. Confirm that there are documents present in the metrics-system.cpu-default data stream, and note its backing index via Stack Management
  5. Create a new 1.28.1 version of the system integration where elasticsearch.index_mode: time_series is set and install it via elastic-package install --zip
  6. Confirm that a rollover occurs and the backing index for the metrics-system.cpu-default data stream has been updated

Checklist

Delete any items that are not applicable to this PR.

@apmmachine
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

Copy link
Contributor

@juliaElastic juliaElastic left a comment

Choose a reason for hiding this comment

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

LGTM.
Can we add an integration test on this that verifies that the rollover is happening? We could add in a separate pr.

Copy link
Contributor

@juliaElastic juliaElastic left a comment

Choose a reason for hiding this comment

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

LGTM.
Can we add an integration test on this that verifies that the rollover is happening? We could add in a separate pr.

@kpollich kpollich changed the title [Fleet] WIP rollover data streams when package w/ TSDB changed is installed [Fleet] Rollover data streams when package w/ TSDB setting changed is installed May 16, 2023
@andresrc
Copy link

Probably related to #157869

@kpollich kpollich self-assigned this May 16, 2023
@kpollich kpollich added release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) labels May 16, 2023
@kpollich
Copy link
Member Author

@elasticmachine merge upstream

@kpollich kpollich marked this pull request as ready for review May 16, 2023 15:35
@kpollich kpollich requested a review from a team as a code owner May 16, 2023 15:35
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@kpollich
Copy link
Member Author

Tests added + other feedback addressed in b0b9281

Copy link
Contributor

@hop-dev hop-dev left a comment

Choose a reason for hiding this comment

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

Great work 🚀

@kpollich kpollich enabled auto-merge (squash) May 16, 2023 16:12
@kpollich kpollich disabled auto-merge May 16, 2023 16:12
@kpollich kpollich enabled auto-merge (squash) May 16, 2023 16:12
@kpollich
Copy link
Member Author

I'm going to enable auto merge here to resolve Fleet's part of the release blocker, but elastic/elasticsearch#96163 will still be considered an ES blocker on toggling TSDB from packages. It's likely when testing TSDB migration packages we'll run into the conflicting range rollover errors.

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #24 / spaces api without security _update_objects_spaces targeting the default space "before all" hook for "should return 200 {objects: [default_only,space_1_only,space_2_only,default_and_space_1,default_and_space_2,space_1_and_space_2,each_space,all_spaces,does_not_exist], spacesToAdd: [some-space-id], spacesToRemove: [default]}"

Metrics [docs]

Unknown metric groups

ESLint disabled line counts

id before after diff
enterpriseSearch 19 21 +2
securitySolution 400 404 +4
total +6

Total ESLint disabled count

id before after diff
enterpriseSearch 20 22 +2
securitySolution 480 484 +4
total +6

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @kpollich

@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.8

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request May 16, 2023
… installed (elastic#157869)

## Summary

Fixes elastic#157345

When a package with a changed `index.mode` or `source.mode` setting is
installed, Fleet will now automatically perform a rollover to ensure the
correct setting is present on the resulting backing index.

There is an issue with Elasticsearch wherein toggling these settings
back and forth will incur a backing index range overlap error. See
elastic/elasticsearch#96163.

To test
1. Install the `system` integration at version `1.28.0`
2. Create an integration policy for the `system` integration (a standard
default agent policy will do)
3. Enroll an agent in this policy, and allow it to ingest some data
4. Confirm that there are documents present in the
`metrics-system.cpu-default` data stream, and note its backing index via
Stack Management
5. Create a new `1.28.1` version of the `system` integration where
`elasticsearch.index_mode: time_series` is set and install it via
`elastic-package install --zip`
6. Confirm that a rollover occurs and the backing index for the
`metrics-system.cpu-default` data stream has been updated

### Checklist

Delete any items that are not applicable to this PR.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: Kibana Machine <[email protected]>
(cherry picked from commit 22e3847)
kibanamachine added a commit that referenced this pull request May 16, 2023
…ged is installed (#157869) (#157916)

# Backport

This will backport the following commits from `main` to `8.8`:
- [[Fleet] Rollover data streams when package w/ TSDB setting changed is
installed (#157869)](#157869)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Kyle
Pollich","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-05-16T18:16:14Z","message":"[Fleet]
Rollover data streams when package w/ TSDB setting changed is installed
(#157869)\n\n## Summary\r\n\r\nFixes
https://github.com/elastic/kibana/issues/157345\r\n\r\nWhen a package
with a changed `index.mode` or `source.mode` setting is\r\ninstalled,
Fleet will now automatically perform a rollover to ensure the\r\ncorrect
setting is present on the resulting backing index.\r\n\r\nThere is an
issue with Elasticsearch wherein toggling these settings\r\nback and
forth will incur a backing index range overlap error.
See\r\nhttps://github.com/elastic/elasticsearch/issues/96163.\r\n\r\nTo
test\r\n1. Install the `system` integration at version `1.28.0`\r\n2.
Create an integration policy for the `system` integration (a
standard\r\ndefault agent policy will do)\r\n3. Enroll an agent in this
policy, and allow it to ingest some data\r\n4. Confirm that there are
documents present in the\r\n`metrics-system.cpu-default` data stream,
and note its backing index via\r\nStack Management\r\n5. Create a new
`1.28.1` version of the `system` integration
where\r\n`elasticsearch.index_mode: time_series` is set and install it
via\r\n`elastic-package install --zip`\r\n6. Confirm that a rollover
occurs and the backing index for the\r\n`metrics-system.cpu-default`
data stream has been updated\r\n\r\n### Checklist\r\n\r\nDelete any
items that are not applicable to this PR.\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Kibana Machine
<[email protected]>","sha":"22e38472f6f05f9e72d97e74ff8328565da4d53b","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","backport:prev-minor","v8.9.0"],"number":157869,"url":"https://github.com/elastic/kibana/pull/157869","mergeCommit":{"message":"[Fleet]
Rollover data streams when package w/ TSDB setting changed is installed
(#157869)\n\n## Summary\r\n\r\nFixes
https://github.com/elastic/kibana/issues/157345\r\n\r\nWhen a package
with a changed `index.mode` or `source.mode` setting is\r\ninstalled,
Fleet will now automatically perform a rollover to ensure the\r\ncorrect
setting is present on the resulting backing index.\r\n\r\nThere is an
issue with Elasticsearch wherein toggling these settings\r\nback and
forth will incur a backing index range overlap error.
See\r\nhttps://github.com/elastic/elasticsearch/issues/96163.\r\n\r\nTo
test\r\n1. Install the `system` integration at version `1.28.0`\r\n2.
Create an integration policy for the `system` integration (a
standard\r\ndefault agent policy will do)\r\n3. Enroll an agent in this
policy, and allow it to ingest some data\r\n4. Confirm that there are
documents present in the\r\n`metrics-system.cpu-default` data stream,
and note its backing index via\r\nStack Management\r\n5. Create a new
`1.28.1` version of the `system` integration
where\r\n`elasticsearch.index_mode: time_series` is set and install it
via\r\n`elastic-package install --zip`\r\n6. Confirm that a rollover
occurs and the backing index for the\r\n`metrics-system.cpu-default`
data stream has been updated\r\n\r\n### Checklist\r\n\r\nDelete any
items that are not applicable to this PR.\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Kibana Machine
<[email protected]>","sha":"22e38472f6f05f9e72d97e74ff8328565da4d53b"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/157869","number":157869,"mergeCommit":{"message":"[Fleet]
Rollover data streams when package w/ TSDB setting changed is installed
(#157869)\n\n## Summary\r\n\r\nFixes
https://github.com/elastic/kibana/issues/157345\r\n\r\nWhen a package
with a changed `index.mode` or `source.mode` setting is\r\ninstalled,
Fleet will now automatically perform a rollover to ensure the\r\ncorrect
setting is present on the resulting backing index.\r\n\r\nThere is an
issue with Elasticsearch wherein toggling these settings\r\nback and
forth will incur a backing index range overlap error.
See\r\nhttps://github.com/elastic/elasticsearch/issues/96163.\r\n\r\nTo
test\r\n1. Install the `system` integration at version `1.28.0`\r\n2.
Create an integration policy for the `system` integration (a
standard\r\ndefault agent policy will do)\r\n3. Enroll an agent in this
policy, and allow it to ingest some data\r\n4. Confirm that there are
documents present in the\r\n`metrics-system.cpu-default` data stream,
and note its backing index via\r\nStack Management\r\n5. Create a new
`1.28.1` version of the `system` integration
where\r\n`elasticsearch.index_mode: time_series` is set and install it
via\r\n`elastic-package install --zip`\r\n6. Confirm that a rollover
occurs and the backing index for the\r\n`metrics-system.cpu-default`
data stream has been updated\r\n\r\n### Checklist\r\n\r\nDelete any
items that are not applicable to this PR.\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Kibana Machine
<[email protected]>","sha":"22e38472f6f05f9e72d97e74ff8328565da4d53b"}}]}]
BACKPORT-->

Co-authored-by: Kyle Pollich <[email protected]>
jasonrhodes pushed a commit that referenced this pull request May 17, 2023
… installed (#157869)

## Summary

Fixes #157345

When a package with a changed `index.mode` or `source.mode` setting is
installed, Fleet will now automatically perform a rollover to ensure the
correct setting is present on the resulting backing index.

There is an issue with Elasticsearch wherein toggling these settings
back and forth will incur a backing index range overlap error. See
elastic/elasticsearch#96163.

To test
1. Install the `system` integration at version `1.28.0`
2. Create an integration policy for the `system` integration (a standard
default agent policy will do)
3. Enroll an agent in this policy, and allow it to ingest some data
4. Confirm that there are documents present in the
`metrics-system.cpu-default` data stream, and note its backing index via
Stack Management
5. Create a new `1.28.1` version of the `system` integration where
`elasticsearch.index_mode: time_series` is set and install it via
`elastic-package install --zip`
6. Confirm that a rollover occurs and the backing index for the
`metrics-system.cpu-default` data stream has been updated

### Checklist

Delete any items that are not applicable to this PR.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: Kibana Machine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v8.8.0 v8.9.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Fleet]: Does not allow package upgrade to disable TSDB
8 participants