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

Log a warning when documents of unknown types are detected during migration #105213

Merged
merged 4 commits into from
Jul 13, 2021

Conversation

joshdover
Copy link
Contributor

@joshdover joshdover commented Jul 12, 2021

Summary

Fixes #104690

This updates our handling of unknown types during Saved Object migrations for the 7.x series. See the rationale and decision in #104690 (comment). The following changes were required to support this:

  • CHECK_UNKNOWN_DOCUMENTS step will now only log a warning when unknown documents are detected with instructions about how to remove them
  • All documents of unknown types are excluded from the client-side transformations. This mitigates the issue where documents of unknown types that contain the migrationVersion field would fail the migration. Note that this will need to be changed in order to support the core migrations for ID rewriting in 8.0.

Checklist

Delete any items that are not applicable to this PR.

Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.

When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:

Risk Probability Severity Mitigation/Notes
Multiple nodes—undefined behavior when Kibana nodes are configured with different plugins enabled or installed Low Medium This has never been a supported use case and this assumption is relied upon in this change. Upgrade with different configurations can lead to data loss or corruption. Can be corrected by rolling back to the previous .kibana index and retrying the upgrade.

For maintainers

...stateP,
controlState: 'FATAL',
reason: extractUnknownDocFailureReason(res.left.unknownDocs, stateP.sourceIndex.value),
...nextState,
Copy link
Contributor Author

@joshdover joshdover Jul 12, 2021

Choose a reason for hiding this comment

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

It's debatable whether or not this should be a left or a right result. I opted to keep it left since we just going to change this again to a failure case in the master branch for 8.0. We also don't have an analog for isRightTypeof and it didn't seem worth adding for just this.

Copy link
Contributor

@pgayvallet pgayvallet Jul 12, 2021

Choose a reason for hiding this comment

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

I would say right. we don't need a isRightTypeof, as in right case, we would just returns the unknownDocs array in the right return of checkForUnknownDocs (and just append the log if unknownDocs.length>0). But that's not that important.

Copy link
Contributor

Choose a reason for hiding this comment

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

FWIW, when I was working with Rudolf I understood that left results were those that ultimately led to an error state (i.e. migrations would fail). right results are all those that carry on with the 'happy path' through the migration algorithm. That being said, I also got the feeling were were trying to avoid error handling in the control flow which is kinda what we end up doing in a few cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the feedback, pushed a commit to switch to Either.right 👍

@joshdover joshdover added release_note:skip Skip the PR/issue when compiling release notes v7.14.0 v7.15.0 v8.0.0 labels Jul 12, 2021
@joshdover joshdover changed the title Log a warning on documents of unknown types are detected during migration Log a warning when documents of unknown types are detected during migration Jul 12, 2021
@joshdover joshdover marked this pull request as ready for review July 12, 2021 13:54
@joshdover joshdover requested a review from a team as a code owner July 12, 2021 13:54
@joshdover joshdover added the Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc label Jul 12, 2021
@elasticmachine
Copy link
Contributor

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

...stateP,
controlState: 'FATAL',
reason: extractUnknownDocFailureReason(res.left.unknownDocs, stateP.sourceIndex.value),
...nextState,
Copy link
Contributor

@pgayvallet pgayvallet Jul 12, 2021

Choose a reason for hiding this comment

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

I would say right. we don't need a isRightTypeof, as in right case, we would just returns the unknownDocs array in the right return of checkForUnknownDocs (and just append the log if unknownDocs.length>0). But that's not that important.

Copy link
Contributor

@TinaHeiligers TinaHeiligers left a comment

Choose a reason for hiding this comment

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

LGTM

...stateP,
controlState: 'FATAL',
reason: extractUnknownDocFailureReason(res.left.unknownDocs, stateP.sourceIndex.value),
...nextState,
Copy link
Contributor

Choose a reason for hiding this comment

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

FWIW, when I was working with Rudolf I understood that left results were those that ultimately led to an error state (i.e. migrations would fail). right results are all those that carry on with the 'happy path' through the migration algorithm. That being said, I also got the feeling were were trying to avoid error handling in the control flow which is kinda what we end up doing in a few cases.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

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

@joshdover joshdover merged commit 6b26949 into elastic:master Jul 13, 2021
joshdover added a commit to joshdover/kibana that referenced this pull request Jul 13, 2021
jloleysens added a commit to jloleysens/kibana that referenced this pull request Jul 13, 2021
…-png-pdf-report-type

* 'master' of github.com:elastic/kibana: (292 commits)
  bring back KQL autocomplete in timeline + fix last updated (elastic#105380)
  [Maps] Change TOC pop-up wording to reflect filter change, not search bar change (elastic#105163)
  Updating urls to upstream elastic repo (elastic#105250)
  [Maps] Move new vector layer wizard card down (elastic#104797)
  Exclude registering the cases feature if not enabled (elastic#105292)
  [Uptime] Alerts - Monitor status alert - check monitor status by monitor.timespan (elastic#104541)
  updated UI copy (elastic#105184)
  Log a warning when documents of unknown types are detected during migration (elastic#105213)
  [Logs UI] Register log threshold rule as lifecycle rule (elastic#104341)
  [Ingest pipelines] add network direction processor (elastic#103436)
  [Console] Autocomplete definitions (manual backport) (elastic#105086)
  [Security Solution] User can make Exceptions for Memory protection alerts (elastic#102196)
  [Lens] Formula: add validation for multiple field/metrics (elastic#104092)
  Removing async from file upload and data visualizer plugins start lifecycle (elastic#105197)
  Fix error when validating the form with non blocking validations (elastic#103629)
  [ML] Fix "View by" swim lane with applied filter and sorting by score  (elastic#105217)
  Update dependency @elastic/charts to v32 (elastic#104625)
  [CTI] shortens large numbers on Dashboard Link Panel (elastic#105269)
  [Security Solution][Endpoint][Host Isolation] Fixes bug to remove excess host metadata status toasts on non user initiated errors (elastic#105331)
  [Cases] Fix pushing alerts count on every push to external service (elastic#105030)
  ...

# Conflicts:
#	x-pack/plugins/reporting/common/types.ts
joshdover added a commit that referenced this pull request Jul 13, 2021
…ing migration (#105213) (#105415)

* Log a warning when documents of unknown types are detected during migration (#105213)

* Parameterize test for kibana version
joshdover added a commit that referenced this pull request Jul 13, 2021
…ng migration (#105213) (#105414)

* Log a warning when documents of unknown types are detected during migration (#105213)

* Parameterize test for kibana version
pgayvallet added a commit to pgayvallet/kibana that referenced this pull request Nov 11, 2021
pgayvallet added a commit that referenced this pull request Nov 16, 2021
…118300)

* manually revert #105213

* enabled xpack to register types for some IT tests

* fiz doc size

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Nov 16, 2021
…lastic#118300)

* manually revert elastic#105213

* enabled xpack to register types for some IT tests

* fiz doc size

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
kibanamachine added a commit that referenced this pull request Nov 16, 2021
…118300) (#118690)

* manually revert #105213

* enabled xpack to register types for some IT tests

* fiz doc size

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

Co-authored-by: Pierre Gayvallet <pierre.gayvallet@elastic.co>
fkanout pushed a commit to fkanout/kibana that referenced this pull request Nov 17, 2021
…lastic#118300)

* manually revert elastic#105213

* enabled xpack to register types for some IT tests

* fiz doc size

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
dmlemeshko pushed a commit that referenced this pull request Nov 29, 2021
…118300)

* manually revert #105213

* enabled xpack to register types for some IT tests

* fiz doc size

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
roeehub pushed a commit to build-security/kibana that referenced this pull request Dec 16, 2021
…lastic#118300)

* manually revert elastic#105213

* enabled xpack to register types for some IT tests

* fiz doc size

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
gbamparop pushed a commit to gbamparop/kibana that referenced this pull request Jan 12, 2022
…lastic#118300)

* manually revert elastic#105213

* enabled xpack to register types for some IT tests

* fiz doc size

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.14.0 v7.15.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Filter out documents of unknown types during migrations
5 participants