Skip to content

admission: ensure GetPebbleMetrics is not called after StoreGrantCoor… #146301

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

Merged
merged 1 commit into from
May 9, 2025

Conversation

sumeerbhola
Copy link
Collaborator

…dinators.close

Fixes #140454, #144172

Epic: none

Release note: None

@sumeerbhola sumeerbhola requested a review from RaduBerinde May 7, 2025 18:31
@sumeerbhola sumeerbhola requested a review from a team as a code owner May 7, 2025 18:31
Copy link

blathers-crl bot commented May 7, 2025

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

@RaduBerinde RaduBerinde left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained


pkg/util/admission/grant_coordinator.go line 284 at r1 (raw file):

		// permitted.
		sgc.closeCh <- struct{}{}
		close(sgc.closeCh)

[nit] do we still need to close? Feels strange to do both

Copy link
Collaborator Author

@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.

TFTR!

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


pkg/util/admission/grant_coordinator.go line 284 at r1 (raw file):

Previously, RaduBerinde wrote…

[nit] do we still need to close? Feels strange to do both

Figured it is the clean thing to do. If somehow StoreGrantCoordinators.close gets called twice due to a bug, sending on a closed channel will panic. Of course, there are other ways to accomplish this. I don't have a strong opinion.

Copy link
Member

@RaduBerinde RaduBerinde 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! 1 of 0 LGTMs obtained (waiting on @sumeerbhola)


pkg/util/admission/grant_coordinator.go line 284 at r1 (raw file):

Previously, sumeerbhola wrote…

Figured it is the clean thing to do. If somehow StoreGrantCoordinators.close gets called twice due to a bug, sending on a closed channel will panic. Of course, there are other ways to accomplish this. I don't have a strong opinion.

Good point. Maybe add a comment above close.

Copy link
Collaborator Author

@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.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @RaduBerinde)


pkg/util/admission/grant_coordinator.go line 284 at r1 (raw file):

Previously, RaduBerinde wrote…

Good point. Maybe add a comment above close.

Done

@sumeerbhola
Copy link
Collaborator Author

bors r=RaduBerinde

@craig craig bot merged commit 007b1ac into cockroachdb:master May 9, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

server: grant coordinators call GetMetrics on closed Pebble instances
3 participants