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

[saved objects] Add migrations v2 integration test for scenario with multiple Kibana instances. #100171

Closed
wants to merge 5 commits into from

Conversation

lukeelmers
Copy link
Member

Closes #99211

This adds integration tests for two scenarios:

  1. Three Kibana instances running migrations at once.
    (Confirms v2 algorithm operations are idempotent)
  2. Three Kibana instances with different plugins running migrations at once.
    (Confirms there are no possible race conditions between instances that have & don't have certain plugins)

Multiple Kibana instances are simulated by creating multiple Roots. To allow ample time for the possibility of races, the data set is 5k objects, and I'm using a batch size of 100.

This was my first time really diving into the v2 migrations code, maybe others who have worked with it more will have ideas of other ways to try to simulate race conditions 🙂

@lukeelmers lukeelmers added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Feature:Saved Objects v8.0.0 release_note:skip Skip the PR/issue when compiling release notes v7.14.0 auto-backport Deprecated - use backport:version if exact versions are needed v7.12.2 v7.13.1 labels May 14, 2021
@lukeelmers lukeelmers requested a review from a team as a code owner May 14, 2021 21:12
@elasticmachine
Copy link
Contributor

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

@lukeelmers
Copy link
Member Author

@elasticmachine merge upstream

@lukeelmers
Copy link
Member Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

kibanamachine commented Jun 1, 2021

💔 Build Failed

Failed CI Steps


Test Failures

Kibana Pipeline / general / Jest Integration Tests.src/core/server/saved_objects/migrationsv2/integration_tests.migration v2 migrates saved objects normally when multiple Kibana instances are running

Link to Jenkins

Standard Out

Failed Tests Reporter:
  - Test has not failed recently on tracked branches


Stack Trace

Error: Unable to complete saved object migrations for the [.kibana] index. Error: [{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}}][Error: [{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}},{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}}]
    at /dev/shm/workspace/parallel/3/kibana/src/core/server/saved_objects/migrationsv2/actions/index.ts:1232:15
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at stateActionMachine (/dev/shm/workspace/parallel/3/kibana/src/core/server/saved_objects/migrationsv2/state_action_machine.ts:70:28)
    at migrationStateActionMachine (/dev/shm/workspace/parallel/3/kibana/src/core/server/saved_objects/migrationsv2/migrations_state_action_machine.ts:126:24)
    at async Promise.all (index 0)
    at SavedObjectsService.start (/dev/shm/workspace/parallel/3/kibana/src/core/server/saved_objects/saved_objects_service.ts:412:7)
    at Server.start (/dev/shm/workspace/parallel/3/kibana/src/core/server/server.ts:235:31)
    at Root.start (/dev/shm/workspace/parallel/3/kibana/src/core/server/root/index.ts:52:14)
    at async Promise.all (index 0)
    at Object.<anonymous> (/dev/shm/workspace/parallel/3/kibana/src/core/server/saved_objects/migrationsv2/integration_tests/multiple_kibana_nodes.test.ts:179:5)]

Metrics [docs]

Unknown metric groups

References to deprecated APIs

id before after diff
canvas 29 25 -4
crossClusterReplication 8 6 -2
fleet 22 20 -2
globalSearch 4 2 -2
indexManagement 12 7 -5
infra 256 146 -110
lens 67 45 -22
licensing 18 15 -3
lists 239 236 -3
maps 286 208 -78
ml 121 115 -6
monitoring 109 56 -53
securitySolution 390 346 -44
stackAlerts 101 95 -6
total -340

History

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

cc @lukeelmers

@lukeelmers
Copy link
Member Author

Error: Unable to complete saved object migrations for the [.kibana] index. Error: [{"index":{"error":{"type":"cluster_block_exception","reason":"index [.kibana_8.0.0_reindex_temp] blocked by: [FORBIDDEN/8/moving to block index write (api)];"}}}

I hadn't seen these failures until this week (perhaps just a coincidence), so I ran it through the flaky test runner overnight, and it failed 30 out of 100 times 🙁

As a comparison, I ran this same branch through the flaky test runner with the v1 migrations enabled, and all 100 runs passed (makes sense I guess, as we weren't using write blocks in the old algorithm).

So I did some digging. AFAICT v2 migrations aren't handling this particular type of cluster_block_exception -- the only specific error handling around index write failures is in the regex here, which doesn't seem to handle moving to block index write.

const failureIsAWriteBlock = ({ cause: { type, reason } }: WaitForReindexTaskFailure) =>
type === 'cluster_block_exception' &&
reason.match(/index \[.+] blocked by: \[FORBIDDEN\/8\/index write \(api\)\]/);

The error in the stack trace comes from bulkOverwriteTransformedDocuments (which seems to be called later in REINDEX_SOURCE_TO_TEMP_INDEX_BULK):

if (errors.length === 0) {
return Either.right('bulk_index_succeeded' as const);
} else {
throw new Error(JSON.stringify(errors));
}

I'm not super familiar with this API, but seems it's coming from here in ES:
https://github.com/elastic/elasticsearch/blob/5baabff6670a8ed49297488ca8cac8ec12a2078d/server/src/main/java/org/elasticsearch/cluster/metadata/MetadataIndexStateService.java#L929-L935

Perhaps it's a scenario we didn't consider (or run into), where multiple Kibanas migrating in parallel could also hit this error, if one starts creating the write block before the others? When I stuck in some code here to ignore any moving to block index write errors and continue with the next step, tests started passing again.

Would appreciate any thoughts @elastic/kibana-core -- should we be handling this error in v2 migrations, or am I doing something unusual in the test that would trigger this error in a way would not realistically happen for users?

@pgayvallet
Copy link
Contributor

FORBIDDEN/8/moving to block index write (api)

This is happening because we're setting write block to true for the temp index during the SET_TEMP_WRITE_BLOCK stage, right between REINDEX_SOURCE_TO_TEMP_CLOSE_PIT and CLONE_TEMP_TO_TARGET

So, yea, in a situation where instance1 is already at CLONE_TEMP_TO_TARGET or further, and instance2 enters the REINDEX_SOURCE_TO_TEMP_INDEX_BULK stage, it will encounter this error and fail.

This is surprising you didn't encounter this issue sooner while implementing these tests btw, as it seems a relatively 'easy' race condition to reproduce if both instances are not started at the exact same time.

Now, for the resolution, it kinda depends on what we will choose to do regarding #101052

If we decide to keep the existing behavior and have the migration fails if the instance encounters unknown SO types, I think it would be acceptable to have instance2 just jump from REINDEX_SOURCE_TO_TEMP_INDEX_BULK to somewhere near CLONE_TEMP_TO_TARGET if this error is encountered, as I think we can assume that one other instance already successfully completed the source->temp reindex (else the write block would not be present). Note that we still need to also decide of the behavior when multiple instances have different plugins set, as this would lead to inconsistencies.

Now, if we decide to copy the unknown documents instead (and allow instances to have different set of plugins enabled), this can be way trickier, as I thinkwe can't safely perform the same step jump? (also see #101052 (comment))

@lukeelmers lukeelmers removed auto-backport Deprecated - use backport:version if exact versions are needed v7.12.2 v7.13.1 labels Jun 4, 2021
@lukeelmers
Copy link
Member Author

Putting this PR on hold pending the outcome of #101351

Once that's resolved we should update/merge this, or incorporate it into that PR.

For the time being, I'll move this back into draft.

@lukeelmers lukeelmers marked this pull request as draft June 4, 2021 18:42
@mshustov mshustov marked this pull request as ready for review June 5, 2021 08:04
@mshustov mshustov marked this pull request as draft June 5, 2021 08:04
@spalger spalger added v7.15.0 and removed v7.14.0 labels Jun 30, 2021
@pgayvallet
Copy link
Contributor

Closing in favor of #104516

@pgayvallet pgayvallet closed this Jul 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Saved Objects release_note:skip Skip the PR/issue when compiling release notes Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v7.15.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix race conditions in SO Migrations v2 and add integration test
8 participants