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

Migrations v2 ignore fleet agent events #96690

Merged
merged 5 commits into from
Apr 12, 2021

Conversation

rudolf
Copy link
Contributor

@rudolf rudolf commented Apr 9, 2021

Summary

Ignore fleet-agent-events and tsvb-validation-telemetry saved objects from both v1 and v2 migrations.

Fixes #95617
Fixes #91869

Release notes

Users who tried the fleet agent beta in 7.10 might have hundreds of thousands of fleet-agent-events in their .kibana index. Due to the large volume of documents, upgrades to 7.12 would frequently fail for these users. In 7.12.1 we drop all fleet-agent-events during the upgrade migration to address this problem. The fleet-agent-events documents are still left in the older .kibana_N index from previous versions, once the upgrade has succeeded we recommend deleting these indices to recover the disk space, see https://www.elastic.co/guide/en/kibana/current/upgrade-migrations.html#upgrade-migrations-old-indices

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@rudolf rudolf added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc project:ResilientSavedObjectMigrations Reduce Kibana upgrade failures by making saved object migrations more resilient labels Apr 9, 2021
@rudolf rudolf marked this pull request as ready for review April 9, 2021 13:21
@rudolf rudolf requested a review from a team as a code owner April 9, 2021 13:21
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

@@ -101,7 +101,7 @@ export default function (providerContext: FtrProviderContext) {
);
});

it('should create or update the fleet_enroll user if called multiple times with forceRecreate flag', async () => {
it.skip('should create or update the fleet_enroll user if called multiple times with forceRecreate flag', async () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@elastic/fleet @nchaulet somehow this test is failing when I remove fleet-agent-events. The same test also fails on master if I enable v1 migrations for this test with the following:

--- a/x-pack/test/fleet_api_integration/config.ts
+++ b/x-pack/test/fleet_api_integration/config.ts
@@ -65,6 +65,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
     kbnTestServer: {
       ...xPackAPITestsConfig.get('kbnTestServer'),
       serverArgs: [
+        '--migrations.enableV2=false',
         ...xPackAPITestsConfig.get('kbnTestServer.serverArgs'),
         ...(registryPort ? [`--xpack.fleet.registryUrl=http://localhost:${registryPort}`] : []),
       ],

We're targeting 7.12.1 for this fix, so please take a look and let me know if it's possible to fix this test or if we should skip it.

Copy link
Member

Choose a reason for hiding this comment

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

I think it's okay to skip it, we are going to remove that API in 7.13.

@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Apr 9, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

Copy link
Member

@afharo afharo left a comment

Choose a reason for hiding this comment

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

🚀 LGTM! Just added a NIT about term vs. terms. According to https://discuss.elastic.co/t/term-vs-terms-filter/15533, the only difference in performance is caching. Since, ideally, we should be running this once, I guess it makes no difference.

@rudolf
Copy link
Contributor Author

rudolf commented Apr 12, 2021

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

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

@rudolf rudolf added the auto-backport Deprecated - use backport:version if exact versions are needed label Apr 12, 2021
@rudolf rudolf merged commit f544d8d into elastic:master Apr 12, 2021
@rudolf rudolf deleted the migrations-v2-ignore-fleet-agent-events branch April 12, 2021 16:19
kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Apr 12, 2021
* migrationsv2: ignore fleet agent events and tsvb telemetry

* migrationsv1: ignore tsvb-validation-telemetry

* Skip fleet test that depends on fleet-agent-events

* Fix typescript errors

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
@kibanamachine
Copy link
Contributor

💔 Backport failed

Status Branch Result
7.12 Commit could not be cherrypicked due to conflicts
7.x

Successful backport PRs will be merged automatically after passing CI.

To backport manually run:
node scripts/backport --pr 96690

kibanamachine added a commit that referenced this pull request Apr 12, 2021
* migrationsv2: ignore fleet agent events and tsvb telemetry

* migrationsv1: ignore tsvb-validation-telemetry

* Skip fleet test that depends on fleet-agent-events

* Fix typescript errors

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Rudolf Meijering <skaapgif@gmail.com>
rudolf added a commit to rudolf/kibana that referenced this pull request Apr 12, 2021
* migrationsv2: ignore fleet agent events and tsvb telemetry

* migrationsv1: ignore tsvb-validation-telemetry

* Skip fleet test that depends on fleet-agent-events

* Fix typescript errors

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
# Conflicts:
#	src/core/server/saved_objects/migrationsv2/integration_tests/actions.test.ts
pgayvallet added a commit that referenced this pull request Apr 13, 2021
…sted sessions (#96938) (#96892)

* Migrations v2 ignore fleet agent events (#96690)

* migrationsv2: ignore fleet agent events and tsvb telemetry

* migrationsv1: ignore tsvb-validation-telemetry

* Skip fleet test that depends on fleet-agent-events

* Fix typescript errors

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
# Conflicts:
#	src/core/server/saved_objects/migrationsv2/integration_tests/actions.test.ts

* Correctly fix merge conflicts

* Skip failing fleet-agent-events tests

* Skip security solution endpoint telemetry tests depending on fleet-agent-events so's

* Exclude non-persisted sessions from SO migration (#96938)

(cherry picked from commit bfd5b7b)

* use `any` for estypes.QueryContainer

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Pierre Gayvallet <pierre.gayvallet@gmail.com>
@tonymeehan
Copy link

👍 🥇 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed project:ResilientSavedObjectMigrations Reduce Kibana upgrade failures by making saved object migrations more resilient release_note:fix Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Team:Fleet Team label for Observability Data Collection Fleet team v7.12.1 v7.13.0 v8.0.0
Projects
None yet
6 participants