Skip to content

Add fast copy-constructor for adding index to Metadata#87863

Merged
original-brownbear merged 9 commits intoelastic:mainfrom
original-brownbear:faster-add-index
Sep 20, 2022
Merged

Add fast copy-constructor for adding index to Metadata#87863
original-brownbear merged 9 commits intoelastic:mainfrom
original-brownbear:faster-add-index

Conversation

@original-brownbear
Copy link
Copy Markdown
Contributor

@original-brownbear original-brownbear commented Jun 20, 2022

Add a fast copy constructor for creating an index. The building of new metadata is taking more than 15% of CPU time on the master node during many shards benchmark bootstrapping and completely disappears from profiling with this change.

It's unfortunate that we don't really have a nice way of testing this logic directly since we don't have a clean equality check on metadata but it has massive coverage through its use for almost all index creates (except for those using a builder filter function) in all ITs so this seems safe enough to me.

@original-brownbear original-brownbear added WIP :Distributed/Cluster Coordination Cluster formation and cluster state publication, including cluster membership and fault detection. labels Jun 20, 2022
@elasticsearchmachine elasticsearchmachine changed the base branch from master to main July 22, 2022 23:06
@mark-vieira mark-vieira added v8.5.0 and removed v8.4.0 labels Jul 27, 2022
@DaveCTurner
Copy link
Copy Markdown
Member

Is this still something we're pursuing @original-brownbear?

@original-brownbear
Copy link
Copy Markdown
Contributor Author

Yea let me clean this up real quick, with all the recent fixes this one is a 10%+ speedup in benchmark bootstrap time actually ... would be nice to have this

@original-brownbear original-brownbear marked this pull request as ready for review August 16, 2022 12:01
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

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

@elasticsearchmachine elasticsearchmachine added the Team:Distributed Meta label for distributed team. label Aug 16, 2022
Copy link
Copy Markdown
Member

@DaveCTurner DaveCTurner left a comment

Choose a reason for hiding this comment

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

LGTM, a couple of nits

It'd be nice to have a way to assert that a Metadata satisfies all the invariants we expect of it just to make sure we don't mess anything up when adding copy-constructors like this (now or in future)

@original-brownbear
Copy link
Copy Markdown
Contributor Author

Thanks David, I applied your NITs and I agree on the assertions. I'll follow up for this, I'd like to do a bigger PR here where we just move all the asserts from the current builder to the constructor, that should give us a neat safety net.

@original-brownbear original-brownbear merged commit ce82323 into elastic:main Sep 20, 2022
@original-brownbear original-brownbear deleted the faster-add-index branch September 20, 2022 12:16
original-brownbear added a commit that referenced this pull request Nov 9, 2022
)

This fixes a bug introduced in #87863
which added a Metadata copy constructor with separate name collision checks that
assumed index name and alias names were already validated in `IndexMetada`.
=> fixed corrupted states by actually adding the validation to `IndexMetadata`
to make it impossible to instantiate a broken `IndexMetadata` in the first place.
elasticsearchmachine pushed a commit that referenced this pull request Nov 9, 2022
) (#91469)

This fixes a bug introduced in #87863
which added a Metadata copy constructor with separate name collision checks that
assumed index name and alias names were already validated in `IndexMetada`.
=> fixed corrupted states by actually adding the validation to `IndexMetadata`
to make it impossible to instantiate a broken `IndexMetadata` in the first place.
original-brownbear added a commit that referenced this pull request Nov 29, 2022
…es bug (#91993)

* Fix corrupted Metadata from index and alias having the same name (#91456)

This fixes a bug introduced in #87863
which added a Metadata copy constructor with separate name collision checks that
assumed index name and alias names were already validated in `IndexMetada`.
=> fixed corrupted states by actually adding the validation to `IndexMetadata`
to make it impossible to instantiate a broken `IndexMetadata` in the first place.

* Implement repair functionality for aliases colliding with indices bug (#91887)

Follow up to #91456 implementing an automated fix for indices corrupted in 8.5.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Distributed/Cluster Coordination Cluster formation and cluster state publication, including cluster membership and fault detection. >non-issue Team:Distributed Meta label for distributed team. v8.5.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants