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

Mapping: Fix delete mapping race condition. #6531

Closed
wants to merge 1 commit into from

Conversation

GaelTadh
Copy link
Contributor

If multiple clients attempted to delete a mapping, or a single client attempted to delete a mapping as an index is being
created a NPE could be observed in the MetaDataMappingService. This fix makes sure we don't try to access a null indexMetaData object.
Also add a test to spawn multiple create and delete threads to provoke this race condition.

Closes #5997

If multiple clients attempted to delete a mapping, or a single client attempted to delete a mapping as an index is being
created a NPE could be observed in the MetaDataMappingService. This fix makes sure we don't try to access a null indexMetaData object.
Also add a test to spawn multiple create and delete threads to provoke this race condition.

Closes elastic#5997
public void run(){
for (int i=0; i<1000; ++i){
try {
CreateIndexResponse cir = client().admin().indices().prepareCreate("test_index").setSource(" {\"mappings\":{" +
Copy link
Member

Choose a reason for hiding this comment

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

you can use assertAcked(prepareCreate(...)) here

@clintongormley
Copy link

hi @GaelTadh

I don't think this fixes #5997 completely. it's only one part of the problem. the other part is the fact that delete mapping on partially allocated indices just hangs until it eventually times out.


class CreateThread extends Thread{
public void run(){
for (int i=0; i<1000; ++i){
Copy link
Member

Choose a reason for hiding this comment

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

maybe we could randomize the number of iterations and the number of threads used below?

@clintongormley
Copy link

Hi @GaelTadh

Any progress on this one?

@clintongormley
Copy link

Fixed by #7744

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Delete mapping sometimes hangs
3 participants