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 support for version on create & bulkCreate when overwriting a document #75172

Merged
merged 12 commits into from
Aug 19, 2020

Conversation

gmmorris
Copy link
Contributor

@gmmorris gmmorris commented Aug 17, 2020

Summary

Adds support for version one the SavedObjectsClient's create api.
This sallows us to retain Optimistic concurrency control when using create to overwrite an existing document.

For example:

savedObjectsClient.create(
      'known-type',
      {
        attrOne: 'one',
        attrTwo: 'two',
      },
      { id: 'uuid-to-overwrite', overwrite: true, version: '=snjr5dorY' }
    );

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@gmmorris
Copy link
Contributor Author

@elasticmachine merge upstream

@jportner
Copy link
Contributor

WRT d4820e1 and CI failures:

It looks like all the CI failures can boiled down to three types of tests:

  • Import
  • Copy to space
  • Loading sample data

I'm not 100% sure about loading sample data, but copy to space does use import under the hood.

You could try filtering out the version inside importSavedObjectsFromStream and see if that fixes the issue:

// Create objects in bulk
const bulkCreateResult = await savedObjectsClient.bulkCreate(filteredObjects, {
overwrite,
namespace,
});

* master:
  Skip failing test in CI (elastic#75266)
  [Task Manager] time out work when it overruns in poller (elastic#74980)
  [Drilldowns] misc improvements & fixes (elastic#75276)
  Small README note on bumping memory for builds (elastic#75247)
  [Security Solution][Detections] Adds exception modal tests (elastic#74596)
  [Dashboard] Sample data link does not work (elastic#75262)
  [Dashboard First] Unlink from Library Action With ReferenceOrValueEmbeddable (elastic#74905)
  [Form lib] Fix issue where serializer on fields are called on every change (elastic#75166)
  convert processor labels to sentence case (elastic#75278)
  [Monaco] Refactor the way XJSON grammar checker gets registered (elastic#75160)
  Clarify no documents error message when filtering by is_training (elastic#75227)
  [Lens] Fix crash when two layers xychart  switches to pie (elastic#75267)
  [Observability Homepage] Fix console error because of side effect (elastic#75258)
  [Usage Collection] Add `legacy=true` option to the /api/stats request in the docs (elastic#75146)
  [ML] Functional tests - re-activate DFA test suites (elastic#75257)
  GS providers improvements (elastic#75174)
  [Visualize] First version of by-value visualize editor (elastic#72256)
@gmmorris gmmorris added Feature:Saved Objects Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v7.10.0 v7.9.1 v8.0.0 labels Aug 18, 2020
@gmmorris gmmorris marked this pull request as ready for review August 18, 2020 21:18
@gmmorris gmmorris requested a review from a team August 18, 2020 21:18
@gmmorris gmmorris requested a review from a team as a code owner August 18, 2020 21:18
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-platform (Team:Platform)

@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Aug 18, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/ingest-management (Team:Ingest Management)

Copy link
Contributor

@pgayvallet pgayvallet left a comment

Choose a reason for hiding this comment

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

LGTM for platform changes.

Added @jportner as a reviewer as this may directly impact the changes on the SO sharing feature.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Build metrics

✅ unchanged

History

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

Copy link
Contributor

@jportner jportner left a comment

Choose a reason for hiding this comment

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

LGTM!

@gmmorris gmmorris merged commit 9698a07 into elastic:master Aug 19, 2020
gmmorris added a commit to gmmorris/kibana that referenced this pull request Aug 19, 2020
…verwriting a document (elastic#75172)

Adds support for `version` one the SavedObjectsClient's create api.
This sallows us to retain Optimistic concurrency control when using create to overwrite an existing document.
jportner added a commit that referenced this pull request Aug 19, 2020
gmmorris added a commit to gmmorris/kibana that referenced this pull request Aug 19, 2020
* master: (30 commits)
  [code coverage] always download node before team assignment (elastic#75424)
  [Form lib] Allow new "defaultValue" to be provided when resetting the… (elastic#75302)
  [Logs UI] Add "View in machine learning" links in the anomaly explorer (elastic#74555)
  skip flaky suite (elastic#75440)
  skip flaky suite (elastic#75386)
  [Saved objects] Add support for version on create & bulkCreate when overwriting a document (elastic#75172)
  [Functional]Table Vis increase sleep time in order filter to be applied (elastic#75138)
  MOAR RAM (elastic#75423)
  [Visualize] Horizontal Bar Percentiles Overlapping (elastic#75315)
  [ML] DF Analytics / Transforms: Fix job row actions menu invalid DOM nesting warning (elastic#74499)
  [ML] Inference models management (elastic#74978)
  [Monitoring] Migrate karma tests (elastic#75301)
  [Index template] Add filters to simulate preview (elastic#74497)
  Bump and consolidate dependencies (elastic#75360)
  [Ingest Manager] Fix agent config rollout rate limit to use constants (elastic#75364)
  Update Node.js to version 10.22.0 (elastic#75254)
  [ML] Anomaly Explorer / Single Metric Viewer: Fix error reporting for annotations. (elastic#74953)
  [Discover] Fix histogram cloud tests (elastic#75268)
  Uiactions to navigate to visualize or maps (elastic#74121)
  Use prefix search invis editor field/agg combo box (elastic#75290)
  ...
gmmorris added a commit to gmmorris/kibana that referenced this pull request Aug 19, 2020
…verwriting a document (elastic#75172)

Adds support for `version` one the SavedObjectsClient's create api.
This sallows us to retain Optimistic concurrency control when using create to overwrite an existing document.
# Conflicts:
#	src/core/server/saved_objects/service/lib/repository.ts
gmmorris added a commit that referenced this pull request Aug 19, 2020
…verwriting a document (#75172) (#75447)

Adds support for `version` one the SavedObjectsClient's create api.
This sallows us to retain Optimistic concurrency control when using create to overwrite an existing document.
gmmorris added a commit that referenced this pull request Aug 20, 2020
…when overwriting a document (#75172) (#75498)

* [Saved objects] Add support for version on create & bulkCreate when overwriting a document (#75172)

Adds support for `version` one the SavedObjectsClient's create api.
This sallows us to retain Optimistic concurrency control when using create to overwrite an existing document.
neptunian added a commit to neptunian/kibana that referenced this pull request Aug 21, 2020
mikecote added a commit that referenced this pull request Aug 31, 2020
…kCreate when overwriting a document (#75172) (#75498)"

This reverts commit 00836e5.
mikecote added a commit to mikecote/kibana that referenced this pull request Aug 31, 2020
mikecote added a commit that referenced this pull request Aug 31, 2020
…writing a document (#76280)

* Revert "Fix more broken usages of `bulkCreate` (#76005) (#76131)"

This reverts commit 44a017b.

* Revert "Filter saved object `version` during legacy import (#75597) (#75793)"

This reverts commit 6e82885.

* Revert "[7.9] [Saved objects] Add support for version on create & bulkCreate when overwriting a document (#75172) (#75498)"

This reverts commit 00836e5.
@mikecote mikecote removed the v7.9.1 label Aug 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Saved Objects release_note:enhancement 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.10.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants