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

(6.0) Fix db server test data race #5829

Merged
merged 1 commit into from
Mar 3, 2021
Merged

(6.0) Fix db server test data race #5829

merged 1 commit into from
Mar 3, 2021

Conversation

r0mant
Copy link
Collaborator

@r0mant r0mant commented Mar 3, 2021

Simplify the heartbeat test to avoid the data race issue, and also use better clone method for db server.

@r0mant r0mant requested review from a-palchikov and russjones March 3, 2021 19:56
@r0mant r0mant self-assigned this Mar 3, 2021
@r0mant r0mant requested a review from klizhentas as a code owner March 3, 2021 19:56
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.

Do you mean compare as equal by reference comparison or the actual contents?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah by reference, because heartbeat basically saves the reference to this server so any updates we make on it here would also reflect on the heartbeat's object (cause it's the same one) and so it will always compare as equal.

@r0mant r0mant merged commit 231736c into branch/v6 Mar 3, 2021
@r0mant r0mant deleted the roman/v6/test branch March 3, 2021 20:09
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