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

Short-Circuit NOOP Mapping Updates Earlier #77574

Conversation

original-brownbear
Copy link
Member

No need to actually run noop mapping updates or create a new document mapper
if nothing has changed. Also, we can do the compressing of the updates off of the master update
thread and make the updates slightly less heavy that way.

No need to actually run noop mapping updates or create a new document mapper
if nothing has changed.
@original-brownbear original-brownbear added >non-issue :Search Foundations/Mapping Index mappings, including merging and defining field types :Distributed Indexing/CRUD A catch all label for issues around indexing, updating and getting a doc by id. Not search. v8.0.0 v7.16.0 labels Sep 10, 2021
@elasticmachine elasticmachine added Team:Search Meta label for search team Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. labels Sep 10, 2021
@elasticmachine
Copy link
Collaborator

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

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (Team:Search)

Copy link
Contributor

@romseygeek romseygeek left a comment

Choose a reason for hiding this comment

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

LGTM, nice improvement @original-brownbear

return currentMapper;
}
synchronized (this) {
Mapping incomingMapping = parseMapping(mappingType, mappingSource);
Copy link
Contributor

Choose a reason for hiding this comment

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

This can probably be outside the synchronized block as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

Technically I think so yes. But the parsing code does reference this.mapper in some spots so I decided to keep it this way for easy to understand correctness. Will try to look into a follow-up to this that cleans up the synchronization here a little :)

Copy link
Contributor

@henningandersen henningandersen left a comment

Choose a reason for hiding this comment

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

LGTM.

public PutMappingClusterStateUpdateRequest(String source) {
this.source = source;
public PutMappingClusterStateUpdateRequest(String source) throws IOException {
this.source = new CompressedXContent(source);
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should take the action off the transport thread, seems like an action that do not need to run on transport and now that we compress, we do a bit (though tiny) of real work here.

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought about this, but it seemed like the wrong approach. Either, and this is true IMO, the compression cost is so tiny here that it doesn't matter really. Or if it does indeed matter, the better fix seems to be to just serialize the PutMappingRequest with the mapping in compressed form right away (thus making it smaller and easier to read from the wire as well).

@original-brownbear
Copy link
Member Author

Thanks Alan & Henning!

@original-brownbear original-brownbear merged commit 8efbe22 into elastic:master Sep 13, 2021
@original-brownbear original-brownbear deleted the skip-noop-mapping-updates-early branch September 13, 2021 08:29
original-brownbear added a commit to original-brownbear/elasticsearch that referenced this pull request Oct 3, 2021
No need to actually run noop mapping updates or create a new document mapper
if nothing has changed.
original-brownbear added a commit that referenced this pull request Oct 4, 2021
No need to actually run noop mapping updates or create a new document mapper
if nothing has changed.
@original-brownbear original-brownbear restored the skip-noop-mapping-updates-early branch April 18, 2023 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed Indexing/CRUD A catch all label for issues around indexing, updating and getting a doc by id. Not search. >non-issue :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. Team:Search Meta label for search team v7.16.0 v8.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants