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

Consistent update of stage and failure message in IndexShardSnapshotStatus #27557

Closed
wants to merge 2 commits into from

Conversation

tlrx
Copy link
Member

@tlrx tlrx commented Nov 28, 2017

As @ywelsch commented in #26480 (comment), IndexShardSnapshotStatus is not consistently updated.

This pull request adds a synchronized updateStage(stage, failure) to ensure that both fields are updated at the same time and also makes the fields volatile so that threads always read the latest values.

Closes #26480

@tlrx tlrx requested a review from ywelsch November 28, 2017 13:00
@tlrx tlrx changed the title Update stage and failure message Consistent update of stage and failure message in IndexShardSnapshotStatus Nov 28, 2017
Copy link
Contributor

@ywelsch ywelsch left a comment

Choose a reason for hiding this comment

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

This does not fix the issue, unfortunately. Although updateStage is synchronized, access to the volatile fields is still non-synchronized, which means that when we first call stage() and then failure() to read the values, we can still observe a stage which is FAILURE but a failure that is not set. We need not only atomic writes, but also atomic access to the <stage, failure> field pair.

@tlrx
Copy link
Member Author

tlrx commented Nov 28, 2017

@ywelsch I've been to quick on this, sorry. I change the stage / failure getter to be synchronized too.

@ywelsch
Copy link
Contributor

ywelsch commented Nov 28, 2017

This still won't allow the stage & failure pair to be consistently read. Assume the following sequence:

  • read stage
  • update(stage, failure)
  • read failure

@tlrx
Copy link
Member Author

tlrx commented Nov 28, 2017

@ywelsch Right again, I'll revisit this correctly and update the code.

@tlrx
Copy link
Member Author

tlrx commented Jan 8, 2018

Closed in favor of #28130

@tlrx tlrx closed this Jan 8, 2018
@tlrx tlrx deleted the IndexShardSnapshotStatus branch January 15, 2018 14:01
@jimczi jimczi added v7.0.0-beta1 and removed v7.0.0 labels Feb 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants