Add fast copy-constructor for adding index to Metadata#87863
Add fast copy-constructor for adding index to Metadata#87863original-brownbear merged 9 commits intoelastic:mainfrom original-brownbear:faster-add-index
Conversation
|
Is this still something we're pursuing @original-brownbear? |
|
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 |
|
Pinging @elastic/es-distributed (Team:Distributed) |
DaveCTurner
left a comment
There was a problem hiding this comment.
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)
server/src/main/java/org/elasticsearch/cluster/metadata/Metadata.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/common/util/ArrayUtils.java
Outdated
Show resolved
Hide resolved
|
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. |
) 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.
) (#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.
…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.
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.