Skip to content

kvflowcontrol: squash data race#104855

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
irfansharif:230614.handle-race
Jul 5, 2023
Merged

kvflowcontrol: squash data race#104855
craig[bot] merged 1 commit intocockroachdb:masterfrom
irfansharif:230614.handle-race

Conversation

@irfansharif
Copy link
Copy Markdown
Contributor

@irfansharif irfansharif commented Jun 14, 2023

Fixes #104837.
Fixes #105762.

Release note: None

@irfansharif irfansharif requested a review from a team as a code owner June 14, 2023 06:10
@blathers-crl
Copy link
Copy Markdown

blathers-crl bot commented Jun 14, 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
Copy Markdown
Member

This change is Reviewable

Copy link
Copy Markdown
Collaborator

@sumeerbhola sumeerbhola left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @irfansharif)


pkg/kv/kvserver/kvflowcontrol/kvflowhandle/kvflowhandle.go line 110 at r1 (raw file):

	// the mutex. To avoid the data race, copy out the pointers first.
	connections := make([]*connectedStream, len(h.mu.connections))
	copy(connections, h.mu.connections)

Admit is on a performance critical path. I think we need a copy-on-write scheme instead of copy-on-read.

@irfansharif irfansharif force-pushed the 230614.handle-race branch from 8ac33ee to edd1e1b Compare July 4, 2023 19:37
Copy link
Copy Markdown
Contributor Author

@irfansharif irfansharif left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @sumeerbhola)


pkg/kv/kvserver/kvflowcontrol/kvflowhandle/kvflowhandle.go line 110 at r1 (raw file):

Previously, sumeerbhola wrote…

Admit is on a performance critical path. I think we need a copy-on-write scheme instead of copy-on-read.

Done.

@irfansharif irfansharif requested a review from bananabrick July 4, 2023 19:37
Copy link
Copy Markdown
Contributor

@bananabrick bananabrick left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @irfansharif and @sumeerbhola)


pkg/kv/kvserver/kvflowcontrol/kvflowhandle/kvflowhandle.go line 239 at r2 (raw file):

func (h *Handle) connectStreamLocked(
	ctx context.Context, pos kvflowcontrolpb.RaftLogPosition, stream kvflowcontrol.Stream,

Does each connection have a unique Stream?

Copy link
Copy Markdown
Contributor Author

@irfansharif irfansharif left a comment

Choose a reason for hiding this comment

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

TFTR.

bors r+

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @bananabrick and @sumeerbhola)


pkg/kv/kvserver/kvflowcontrol/kvflowhandle/kvflowhandle.go line 239 at r2 (raw file):

Previously, bananabrick (Arjun Nair) wrote…

Does each connection have a unique Stream?

Yes.

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jul 4, 2023

👎 Rejected by code reviews

@irfansharif irfansharif dismissed sumeerbhola’s stale review July 4, 2023 23:43

Other reviewer LGTMed.

@irfansharif
Copy link
Copy Markdown
Contributor Author

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jul 5, 2023

Build succeeded:

@craig craig bot merged commit c77d127 into cockroachdb:master Jul 5, 2023
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.

kvflowcontrol: data race in TestRelocateNonVoters [kvflowhandle race] kvflowcontrol: race with kvflowhandle.(*Handle)

4 participants