-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
SOR: downward-compatible bulkUpdate
#165434
Comments
Pinging @elastic/kibana-core (Team:Core) |
Roger! |
## Summary We've fixed the update limitation (#152807), so now it only applies to bulkUpdates #165434 ### Checklist Delete any items that are not applicable to this PR. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) - [ ] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [ ] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) ### 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 Spaces—unexpected behavior in non-default Kibana Space. | Low | High | Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces. | | Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. | High | Low | Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure. | | Code should gracefully handle cases when feature X or plugin Y are disabled. | Medium | High | Unit tests will verify that any feature flag or plugin combination still results in our service operational. | | [See more potential risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) | ### For maintainers - [ ] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
Part of #165434 Moves the unit tests to their own file Co-authored-by: Kibana Machine <[email protected]>
Part of elastic#165434 Moves the unit tests to their own file Co-authored-by: Kibana Machine <[email protected]>
@pgayvallet |
We're using the Lines 226 to 244 in 3b6b7ad
(The bulk API is kinda particular, each operation is based on 2 parts in the payload, the first one being the metadata (operation, _id, _index...) and the second one being the actual doc the operation has to be performed on)
Great! Please ping me if I can be of any help 🙂 |
Yea, I realized later I was looking at the |
@pgayvallet I've worked on a few approaches and thought I'd double check with you before attempting yet another.
I'm sure more questions are gonna come to me but for now, this is what comes to mind. |
Code factorization, mostly. I assumed the overall logic of single update and bulk update were close enough so that factorizing by having the two APIs executing the same underlying logic may be the best approach in term of maintainability. Now, if there are things I overlooked that make this factorization somehow harder than I thought, I'm totally fine keeping the two implementations dissociated as it is the case today. If so, I'd just like to understand the reasons. If it's "only" about the additional level of effort of refactoring
This is a very good point, and we absolutely need to put a safeguard in place somewhere. However, given our current usages of the
As long as we're performing a single Unless you're thinking of something I missed?
Not sure to follow you. We don't have a "queue" of operations to perform from the repository. If multiple update calls are performed concurrently, they will be executed concurrently too. We just need to make sure we're properly using the version properties in the update payload to protect in case of conflicts, as it is done today in bulkUpdate: Lines 227 to 233 in 3b6b7ad
and as we did in kibana/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/apis/update.ts Lines 283 to 284 in ddaed42
Note that you made me doubt, so I checked if the |
These were the initial questions I had. I'll follow up again shortly to your other responses |
I absolutely overlooked that, and that seems like a very good reason to not want to factorize the implementation of the two APIs |
It's decided then: factorize |
Progress update:Based on the discussions in this issue, #171245 only required a few minor changes to ensure BWC for the SO bulkUpdate API. The main changes are:
Other minor changes include type updates and adapting unit test helpers to take the additional changes into account. Test status for these changes to
|
In #152807 / #161822 we implemented the BWC update algorithm on the single-object
update
API.We now need to do the same for
bulkUpdate
.Ideally, the logic should be as factorized and reused between the two APIs as possible (similar to what we do with
internalBulkResolve
).It may imply to refactor how we implementedWe cannot implement anupdate
in #161822internalBulkUpdate
for a single object update because the bulk API doesn't supportupsert
. However, we should share code as far as possible between the two API's where they perform similar/identical operations (calls toget
docs etc).Tasks
The text was updated successfully, but these errors were encountered: