-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Fix quadratic complexity in SnapshotStatus serialization #90795
Fix quadratic complexity in SnapshotStatus serialization #90795
Conversation
The loop here is obviously O(N^2) and it shows as taking multiple seconds to build the by-index map in x-content serialization for a 25k shards snapshot. This makes the logic O(N) and fixes some potential issues with consistency around concurrent access by using a more appropriate access pattern to the field caching the by-index map.
Pinging @elastic/es-distributed (Team:Distributed) |
Hi @original-brownbear, I've created a changelog YAML for you. |
@henningandersen I extracted this from an incoming PR that moves the API to chunked encoding. I made this a separate PR because I wonder if we should backport this to 8.5.x and 7.x, given how this API is causing issues here and there for Cloud ops? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
If you have seen this cause issues I think it would be fine to backport to both the releases.
Thanks both! |
The loop here is obviously O(N^2) and it shows as taking multiple seconds to build the by-index map in x-content serialization for a 25k shards snapshot. This makes the logic O(N) and fixes some potential issues with consistency around concurrent access by using a more appropriate access pattern to the field caching the by-index map.
The loop here is obviously O(N^2) and it shows as taking multiple seconds to build the by-index map in x-content serialization for a 25k shards snapshot. This makes the logic O(N) and fixes some potential issues with consistency around concurrent access by using a more appropriate access pattern to the field caching the by-index map.
…0803) The loop here is obviously O(N^2) and it shows as taking multiple seconds to build the by-index map in x-content serialization for a 25k shards snapshot. This makes the logic O(N) and fixes some potential issues with consistency around concurrent access by using a more appropriate access pattern to the field caching the by-index map.
…) (#90802) * Fix quadratic complexity in SnapshotStatus serialization (#90795) The loop here is obviously O(N^2) and it shows as taking multiple seconds to build the by-index map in x-content serialization for a 25k shards snapshot. This makes the logic O(N) and fixes some potential issues with consistency around concurrent access by using a more appropriate access pattern to the field caching the by-index map. * fix compile
The loop here is obviously O(N^2) and it shows as taking multiple seconds to build the by-index map in x-content serialization for a 25k shards snapshot.
This makes the logic O(N) and fixes some potential issues with consistency around concurrent access by using a more appropriate access pattern to the field caching the by-index map.
Still not great but good enough with this change.
relates #77466