-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
kvcoord: Use locked map in mux rangefeed #99289
Conversation
It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR? 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks! I didn't review the first commit - it doesn't seem like it should be in this PR. Please remove it before merge (you can send it separately) or indicate that it was included on purpose, in which case we should update the PR description and I'll review the commit.
// gets properly recorded even if mux go routine terminates right after the | ||
// above sender.Send() succeeded. | ||
c.streams.Store(streamID, unsafe.Pointer(stream)) | ||
c.mu.streams[streamID] = stream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add something about the race here, like:
// Note that since we already called
Send(req)
, events from this stream might be showing up in the processing goroutines, and they need to be able to look up the stream. Since we still hold the mutex (and held it acrossSend
), this will hold true. See: #97817.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Yup -- it was merged elsewhere. |
Use locked map instead of IntMap to ensure correct synchronization between stream start up and termination. Fixes cockroachdb#99096 Release note: None Release justficiation: bug fix
bors r+ |
1 similar comment
bors r+ |
Build succeeded: |
99469: release-23.1: kvcoord: Use locked map in mux rangefeed r=miretskiy a=blathers-crl[bot] Backport 1/1 commits from #99289 on behalf of `@miretskiy.` /cc `@cockroachdb/release` ---- Use locked map instead of IntMap to ensure correct synchronization between stream start up and termination. Fixes #99096 Release note: None Release justification: bug fix ---- Release justification: Co-authored-by: Yevgeniy Miretskiy <[email protected]>
Use locked map instead of IntMap to ensure correct
synchronization between stream start up and termination.
Fixes #99096
Release note: None
Release justification: bug fix