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

Refactor state to extrac from prospector #1650

Merged
merged 1 commit into from
May 20, 2016
Merged

Conversation

ruflin
Copy link
Contributor

@ruflin ruflin commented May 17, 2016

This allows the States struct to be reused also in the registrar which reduces complexity of registrar and prospector.

@ruflin
Copy link
Contributor Author

ruflin commented May 17, 2016

jenkins, retest it


index, oldState := s.FindPrevious(newState)

// Only block after FindPrevious as FindPrevious has its own lock
Copy link

Choose a reason for hiding this comment

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

is there a chance for a race between FindPrevious and actual body updating the state?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean if it could happen that after FindPrevious an other method gets the lock and updates the state? Potentially yes I would say, but not 100% sure about the affect. I think what would happen is that a newer state could be overwritten by an older one. This would have an affect until a new state comes in which then brings it up-to-date again. So in between it could happen, that an older state exists.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I pushed a new version with a public and private FindPrevious method. Only the public applies the lock ...

This allows the States struct to be reused also in the registrar which reduces complexity of registrar and prospector.
@tsg tsg merged commit 2420fd5 into elastic:master May 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants