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

Fix db server test data race #5832

Merged
merged 1 commit into from
Mar 3, 2021
Merged

Fix db server test data race #5832

merged 1 commit into from
Mar 3, 2021

Conversation

r0mant
Copy link
Collaborator

@r0mant r0mant commented Mar 3, 2021

#5829 forward-port.

@r0mant r0mant requested review from a-palchikov and russjones March 3, 2021 20:13
@r0mant r0mant requested a review from klizhentas as a code owner March 3, 2021 20:13
@r0mant r0mant self-assigned this Mar 3, 2021
s.mu.Lock()
defer s.mu.Unlock()
// Make sure to return a new object, because it gets cached by
// heartbeat and will always compare as equal otherwise.
Copy link
Contributor

Choose a reason for hiding this comment

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

Following up on your comment - I believe heartbeat's code uses CompareServers to compare by value and not by reference but cloning is still required to avoid races.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@a-palchikov Yes, it compares by value, but we'd be comparing the same object to itself every time if we didn't return a new one here. And yeah, data races too of course.

@r0mant r0mant merged commit 5e0178d into master Mar 3, 2021
@r0mant r0mant deleted the roman/test branch March 3, 2021 21:02
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.

3 participants