Ignore missing references on saved object exports#47685
Ignore missing references on saved object exports#47685rudolf merged 15 commits intoelastic:masterfrom
Conversation
|
Pinging @elastic/kibana-platform (Team:Platform) |
💔 Build Failed
|
e537b42 to
cdb38be
Compare
💔 Build Failed
|
💔 Build Failed
|
c2b2e24 to
916b5d2
Compare
916b5d2 to
0ac506e
Compare
💔 Build Failed
|
💔 Build Failed
|
0ac506e to
d64ebc9
Compare
💔 Build Failed
|
💚 Build Succeeded
|
💔 Build Failed
|
💚 Build Succeeded
|
|
@mikecote Would be good to get your opinion on the design but I think what Pierre did is more elegant than my previous suggestion of failing the export and then retrying with At the end of the NDJSON stream we include a status entry with all the references which couldn't be found. I think if we move to a truly streaming API this will be really useful so that as someone only consuming the API you can be sure that the stream "completed" and that there weren't any errors (like if an exception occurred after exporting 1GB's of objects). |
Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co>
Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co>
Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co>
💔 Build Failed |
|
@rudolf the approach makes sense to me 👍. The one drawback I can see is the entire file may have to be read (in memory) in order to gather the status entry. This is more a problem in the future with 1GB files and I'm sure there's a stream way to do this on the browser without reading the whole file. Though I think that problem can be deferred to the future as only 10,000 objects are supported at this time (and I think < 10MB imports). |
💚 Build Succeeded |
|
@mikecote The blob is more or less a reader interface, we need to read the whole blob to get the last entry, but we can only keep the last / current reading line in memory. This will definitely makes sense once we properly stream the content from server to browser. For now, I think reading (max) 10MB in memory is fine. |
rudolf
left a comment
There was a problem hiding this comment.
Left a couple of copy and docs comments but overall this looks very good
src/core/server/saved_objects/export/get_sorted_objects_for_export.ts
Outdated
Show resolved
Hide resolved
src/core/server/saved_objects/export/get_sorted_objects_for_export.ts
Outdated
Show resolved
Hide resolved
..._plugins/kibana/public/management/sections/objects/components/objects_table/objects_table.js
Outdated
Show resolved
Hide resolved
Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co>
Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co>
Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co>
💔 Build Failed |
Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co>
💚 Build Succeeded |
|
@rudolf all changes has been made, PTAL 4 last commits |
|
@legrego Could you review the changes impacting spaces ? |
|
@pgayvallet will do! I have one PR to review ahead of this one, but I'll get to it as soon as possible |
question: Is there a reason why we have to make this a breaking change for consumers?
If we change this to Also, sorry for the merge conflict - we started moving the spaces plugin to the new platform. I don't expect the changes to be all that difficult though. Let me know if you need help resolving! |
|
Well, the first point would be that this API is flagged as experimental, meaning that breaking changes may occurs. But the actual reason is that the ndjson format being that containing, we really wanted a way to add Metadata to the format. As an extra line is the only approach, we want to change the format as soon as possible to avoid doing it later. The Metadata should now be a part of the default export. The 'exclude' option is here for rétro-compatibility. Not the other way around. I hope that make sense |
legrego
left a comment
There was a problem hiding this comment.
Pending merge conflicts, the changes to spaces LGTM! Tested locally.
|
In retrospect it might have been better to go with @legrego's proposal since not introducing a breaking change would have made it easy to include this in 7.4.1 but I think it's too late to squeeze it into the release. I think including the metadata in the response is a better default for this API. If you're an API consumer you shouldn't be relying on the HTTP status code, as when the internals have eventually been converted to be completely stream based we'll send a 200 before we've completed the whole export. So I think we should introduce the breaking change at some point. Since this is an experimental API and we have an easy flag to opt-out of the breaking behaviour I agree with @pgayvallet that doing this sooner is probably preferable. |
💚 Build Succeeded |
* add saved object export details in ndjson response Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * update core doc Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * exclude export details for space copy Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * fixing tests Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * display warning instead of success if export contains missing refs Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * nits/typo Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * properly updates api integration tests Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * fix typings Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * add test on objects_table component Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * remove added translations from jp/cn bundles Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * restoring line feeds Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * improve doc and user alert message Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * restoring line feeds on server.api.md Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * warning test label Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co>
* add saved object export details in ndjson response Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * update core doc Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * exclude export details for space copy Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * fixing tests Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * display warning instead of success if export contains missing refs Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * nits/typo Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * properly updates api integration tests Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * fix typings Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * add test on objects_table component Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * remove added translations from jp/cn bundles Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * restoring line feeds Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * improve doc and user alert message Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * restoring line feeds on server.api.md Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * warning test label Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co>
|
Removing the breaking label as this is not a stable API. |
Release notes
When exporting saved objects with "include related objects" enabled, the saved objects management UI will now display a warning and continue instead of failing if some related objects could not be found.
Fixes #43876
Breaking changes
This PR changes the behaviour of the
/api/saved_objects/_exportexperimental endpointincludeReferencesDeepoption istrueand some references are non-existing (ignore them instead)excludeExportDetailsoption to disable the previous behaviourChecklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.- [ ] This was checked for cross-browser compatibility, including a check against IE11- [ ] This was checked for keyboard-only and screenreader accessibilityFor maintainers