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

Migration v2 waits for yellow cluster #96788

Merged
merged 10 commits into from
Apr 12, 2021

Conversation

mshustov
Copy link
Contributor

Summary

Closes #91107
This PR tries to stabilize the SO integration tests that fail since Kibana sent reindex requests to the red cluster.
Also, I added logs on how long every state transition lasts.

Checklist

Delete any items that are not applicable to this PR.

@mshustov mshustov added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v8.0.0 project:ResilientSavedObjectMigrations Reduce Kibana upgrade failures by making saved object migrations more resilient v7.13.0 labels Apr 12, 2021
@mshustov mshustov requested a review from a team as a code owner April 12, 2021 14:30
@elasticmachine
Copy link
Contributor

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

@@ -85,11 +87,12 @@ export async function migrationStateActionMachine({
model: Model<State>;
}) {
const executionLog: ExecutionLog = [];
const starteTime = performance.now();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rudolf I'm not sure we need such high precision. I rolled back to the standard Date instead. Let me know if I should revert the change.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah Date.now() is good enough.

});
test('INIT -> SET_SOURCE_WRITE_BLOCK when migrating from a v2 migrations index (>= 7.11.0)', () => {
test('INIT -> WAIT_FOR_YELLOW_SOURCE when migrating from a v2 migrations index (>= 7.11.0)', () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rudolf
the master version of 0013_saved_object_migrations.md doesn't contain description for every implementation step. I could add WAIT_FOR_YELLOW_SOURCE to #93002

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, it would be great to document it there.

@mshustov mshustov added the release_note:skip Skip the PR/issue when compiling release notes label Apr 12, 2021
@mshustov mshustov enabled auto-merge (squash) April 12, 2021 14:36
Copy link
Contributor

@rudolf rudolf left a comment

Choose a reason for hiding this comment

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

Wondered about adding an integration test, otherwise looks good.

const asyncUnlink = Util.promisify(Fs.unlink);
async function removeLogFile() {
// ignore errors if it doesn't exist
await asyncUnlink(logFilePath).catch(() => void 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

nice :)

@@ -85,11 +87,12 @@ export async function migrationStateActionMachine({
model: Model<State>;
}) {
const executionLog: ExecutionLog = [];
const starteTime = performance.now();
Copy link
Contributor

Choose a reason for hiding this comment

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

yeah Date.now() is good enough.

});
test('INIT -> SET_SOURCE_WRITE_BLOCK when migrating from a v2 migrations index (>= 7.11.0)', () => {
test('INIT -> WAIT_FOR_YELLOW_SOURCE when migrating from a v2 migrations index (>= 7.11.0)', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

yes, it would be great to document it there.

@mshustov mshustov marked this pull request as draft April 12, 2021 15:12
auto-merge was automatically disabled April 12, 2021 15:12

Pull request was converted to draft

@mshustov mshustov marked this pull request as ready for review April 12, 2021 15:47
@mshustov mshustov requested a review from rudolf April 12, 2021 15:47
@mshustov mshustov enabled auto-merge (squash) April 12, 2021 15:59
@mshustov mshustov added v7.12.1 auto-backport Deprecated - use backport:version if exact versions are needed labels Apr 12, 2021
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

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

@mshustov mshustov merged commit c2b1769 into elastic:master Apr 12, 2021
@kibanamachine
Copy link
Contributor

💔 Backport failed

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

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

mistic added a commit that referenced this pull request Apr 12, 2021
@mistic
Copy link
Member

mistic commented Apr 12, 2021

@mshustov looks like that PR has made some jest tests to fail. I've skipped those at fb24006

@mshustov mshustov deleted the migration-wait-for-yellow-cluster branch April 12, 2021 20:12
mshustov added a commit to mshustov/kibana that referenced this pull request Apr 12, 2021
* migrator waits for source index to be yellow

otherwise the next  request to Elasticsearch can fail

* unskip integration tests that failed due to a red cluster

* log how much the every step lasts

* use Date.now instead of performance.now migration cannot finish in ms

* update tests

* clean log file before running tests

* fix wrong type

* add an integration test for waitForIndexStatusYellow
# Conflicts:
#	src/core/server/saved_objects/migrationsv2/integration_tests/migration.test.ts
mshustov added a commit to mshustov/kibana that referenced this pull request Apr 12, 2021
* migrator waits for source index to be yellow

otherwise the next  request to Elasticsearch can fail

* unskip integration tests that failed due to a red cluster

* log how much the every step lasts

* use Date.now instead of performance.now migration cannot finish in ms

* update tests

* clean log file before running tests

* fix wrong type

* add an integration test for waitForIndexStatusYellow
# Conflicts:
#	src/core/server/saved_objects/migrationsv2/integration_tests/migration.test.ts
mshustov added a commit that referenced this pull request Apr 13, 2021
* Migration v2 waits for yellow cluster (#96788)

* migrator waits for source index to be yellow

otherwise the next  request to Elasticsearch can fail

* unskip integration tests that failed due to a red cluster

* log how much the every step lasts

* use Date.now instead of performance.now migration cannot finish in ms

* update tests

* clean log file before running tests

* fix wrong type

* add an integration test for waitForIndexStatusYellow
# Conflicts:
#	src/core/server/saved_objects/migrationsv2/integration_tests/migration.test.ts

* remove tests using so from v8

* skip as on master :(
mshustov added a commit that referenced this pull request Apr 13, 2021
* Migration v2 waits for yellow cluster (#96788)

* migrator waits for source index to be yellow

otherwise the next  request to Elasticsearch can fail

* unskip integration tests that failed due to a red cluster

* log how much the every step lasts

* use Date.now instead of performance.now migration cannot finish in ms

* update tests

* clean log file before running tests

* fix wrong type

* add an integration test for waitForIndexStatusYellow
# Conflicts:
#	src/core/server/saved_objects/migrationsv2/integration_tests/migration.test.ts

* remove test using so from v8

* skip as on master

Co-authored-by: Kibana Machine <[email protected]>
@mshustov mshustov mentioned this pull request Apr 25, 2021
2 tasks
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: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.12.1 v7.13.0 v8.0.0
Projects
None yet
5 participants