-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
kvserver: do lazy map allocations in replicaFlowControl #113150
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.
Nice simple fix, thanks.
Could also store the maps in replicaFlowControl
, and reuse them across the runs. Or, to avoid the sticky overhead, draw them from a sync.Pool
and release after use. These strategies are less simple and possibly unnecessary. Feel free to leave a TODO though.
These methods will typically return empty maps, so we can avoid the allocations. Informs cockroachdb#111561 Epic: none Release note: None
56b5c2f
to
270fad1
Compare
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.
TFTR!
Could also store the maps in
replicaFlowControl
, and reuse them across the runs. Or, to avoid the sticky overhead, draw them from async.Pool
and release after use. These strategies are less simple and possibly unnecessary. Feel free to leave a TODO though.
I've left a comment in replicaFlowControlIntegrationImpl.notActivelyReplicatingTo
for one of these possible optimizations. I didn't frame it as a TODO since I suspect we may never need to do it.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @pavelkalinnikov)
pkg/kv/kvserver/flow_control_replica.go
line 63 at r1 (raw file):
Previously, pavelkalinnikov (Pavel Kalinnikov) wrote…
Could do with a comment why initialization is lazy here. Same below.
Done
test failure is unrelated #113112 |
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.
thanks for the quick fix!
Reviewable status:
complete! 1 of 0 LGTMs obtained (waiting on @pavelkalinnikov)
bors r=pavelkalinnikov,aadityasondhi |
Build succeeded: |
These methods will typically return empty maps, so we can avoid the allocations.
Informs #111561
Epic: none
Release note: None