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

kvcoord: Use locked map in mux rangefeed #99289

Merged
merged 1 commit into from
Mar 24, 2023
Merged

Conversation

miretskiy
Copy link
Contributor

@miretskiy miretskiy commented Mar 22, 2023

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

@miretskiy miretskiy requested review from tbg and a team March 22, 2023 21:12
@miretskiy miretskiy requested a review from a team as a code owner March 22, 2023 21:12
@blathers-crl
Copy link

blathers-crl bot commented Mar 22, 2023

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.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Member

@tbg tbg left a 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
Copy link
Member

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 across Send), this will hold true. See: #97817.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@miretskiy
Copy link
Contributor Author

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.

Yup -- it was merged elsewhere.

@miretskiy miretskiy added the backport-23.1.x Flags PRs that need to be backported to 23.1 label Mar 23, 2023
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
@miretskiy
Copy link
Contributor Author

bors r+

1 similar comment
@miretskiy
Copy link
Contributor Author

bors r+

@craig
Copy link
Contributor

craig bot commented Mar 24, 2023

Build succeeded:

@craig craig bot merged commit b7c1874 into cockroachdb:master Mar 24, 2023
craig bot pushed a commit that referenced this pull request Mar 24, 2023
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-23.1.x Flags PRs that need to be backported to 23.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

kv/kvclient/rangefeed: TestUnrecoverableErrors failed
3 participants