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

Use HashMap for IndexMetadata.inSyncAllocationIds #86403

Merged
merged 4 commits into from
May 4, 2022

Conversation

rjernst
Copy link
Member

@rjernst rjernst commented May 3, 2022

The in sync allocation ids is a mapping from shard to the set of ids
currently being processed. When being built, the metadata uses a sparse
map, only filling a value for a shard as they are put into the builder.
When the final metadata is built, the map is made dense.

This commit converts to using a HashMap instead of ImmutableOpenIntMap.
The boxed keys should not cause allocations, as long as number of shards
is lower than 128. Long term the map itself should become an array, as
we know the number of shards (much like the dense primaryTerms array
here). However, that change will be a little trickier to make, since we
will need to be backward compatible with how diffs are built, currently
using Map differences.

relates #86239

The in sync allocation ids is a mapping from shard to the set of ids
currently being processed. When being built, the metadata uses a sparse
map, only filling a value for a shard as they are put into the builder.
When the final metadata is built, the map is made dense.

This commit converts to using a HashMap instead of ImmutableOpenIntMap.
The boxed keys should not cause allocations, as long as number of shards
is lower than 128. Long term the map itself should become an array, as
we know the number of shards (much like the dense primaryTerms array
here). However, that change will be a little trickier to make, since we
will need to be backward compatible with how diffs are built, currently
using Map differences.

relates elastic#86239
@rjernst rjernst added :Distributed Indexing/Distributed A catch all label for anything in the Distributed Area. Please avoid if you can. >refactoring v8.3.0 labels May 3, 2022
@rjernst rjernst requested a review from original-brownbear May 3, 2022 17:51
@elasticmachine elasticmachine added the Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. label May 3, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed (Team:Distributed)

@rjernst rjernst mentioned this pull request May 3, 2022
35 tasks
Copy link
Member

@original-brownbear original-brownbear left a comment

Choose a reason for hiding this comment

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

LGTM. I'll try not to forget the follow up to move this to an array :)

@rjernst rjernst merged commit 2e74205 into elastic:master May 4, 2022
@rjernst rjernst deleted the hppc/index_metadata_allocation_ids branch May 4, 2022 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed Indexing/Distributed A catch all label for anything in the Distributed Area. Please avoid if you can. >refactoring Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. v8.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants