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

ISPN-1826 Make sure address cache is updated before comparing view ids #923

Merged
merged 2 commits into from Feb 3, 2012

Conversation

galderz
Copy link
Member

@galderz galderz commented Feb 2, 2012

https://issues.jboss.org/browse/ISPN-1826

This avoids a race condition where a view id might be updated before the address cache, so clients could end up receiving views that do not contain the address updates.

@galderz
Copy link
Member Author

galderz commented Feb 2, 2012

Oh, forgot to say, 5.1.x too: t_1826_5

@ghost ghost assigned danberindei Feb 2, 2012
// Could this be a lazySet? We want the value to eventually be set,
// clients could wait a little bit for the view id to be updated
// on the server side...
viewId.set(localViewId)
Copy link
Member

Choose a reason for hiding this comment

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

What happens if you have more than one node joining or leaving at the same time?
I think it would be safer if CrashedMemberDetectorListener would update the view id after updating the cache.

Copy link
Member

Choose a reason for hiding this comment

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

Also, if it's ok for clients to see the new view id a little later, couldn't the viewId parameter of writeHeader and getTopologyResponse be an int instead of AtomicInteger? Seeing AtomicInteger makes me think that those methods want to update its value, but they only need to read it.

Copy link
Member Author

Choose a reason for hiding this comment

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

+1 to both

Copy link
Member Author

Choose a reason for hiding this comment

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

The view is already updated after updating the cache, that's why isPre must be false :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmmm, I see what you mean. However, what you suggest requires updating the view id in two places. In CrashedMemberDetectorListener and the startup. This way is limited to only beeing updated once we know the cache has been updated.

This avoids a race condition where a view id might be updated before
the address cache, so clients could end up receiving views that do not
contain the address updates.
@galderz
Copy link
Member Author

galderz commented Feb 3, 2012

@danberindei I've updated the pull request, can you check?

@danberindei danberindei merged commit 5932dc2 into infinispan:master Feb 3, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants