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

Correctly resolve type for delete operations #72809

Merged
merged 1 commit into from
May 6, 2021

Conversation

romseygeek
Copy link
Contributor

#62616 refactored how we deal with building mapping updates for
delete operations against an empty index. In 7x, delete operations
include a type as part of the operation UID, and this type needs to
be resolved against mappings. In particular, the type _doc can
mean either a type called _doc (the general case), or it can mean
whatever type this index actually has. There are two code paths
in IndexShard.applyDeleteOperation, one for empty mappings
and one for the standard case; #62616 was resolving the type for
the first code path, but not the second, which meant that some
delete operations could be written to the translog with an incorrect
type.

This commit adds type resolution to the second code path as well.

Fixes #72735

@romseygeek romseygeek added >non-issue :Search Foundations/Mapping Index mappings, including merging and defining field types :Distributed Indexing/Engine Anything around managing Lucene and the Translog in an open shard. v7.14.0 labels May 6, 2021
@romseygeek romseygeek requested review from DaveCTurner and dnhatn May 6, 2021 12:44
@romseygeek romseygeek self-assigned this May 6, 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 May 6, 2021
@elasticmachine
Copy link
Collaborator

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

@elasticmachine
Copy link
Collaborator

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

@romseygeek
Copy link
Contributor Author

Marked as >non-issue because this is an unreleased bug.

I'm not very satisfied with just adding an assert as a test here, but the buggy method doesn't actually contain the relevant information as part of its return type and I am unsure of how to add checks on the method's side effects - if anyone has any clever ideas then let me know.

Copy link
Member

@dnhatn dnhatn left a comment

Choose a reason for hiding this comment

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

LGTM.

@dnhatn
Copy link
Member

dnhatn commented May 6, 2021

I'm not very satisfied with just adding an assert as a test here, but the buggy method doesn't actually contain the relevant information as part of its return type and I am unsure of how to add checks on the method's side effects - if anyone has any clever ideas then let me know.

I will try to add a test for this. I think it's ok to merge this now to stabilize CI.

@romseygeek romseygeek merged commit 4e0d6d3 into elastic:7.x May 6, 2021
@romseygeek romseygeek deleted the tombstone/type-7x branch May 6, 2021 14:36
@romseygeek
Copy link
Contributor Author

I will try to add a test for this. I think it's ok to merge this now to stabilize CI.

Thanks @dnhatn!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed Indexing/Engine Anything around managing Lucene and the Translog in an open shard. >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.14.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants