-
Notifications
You must be signed in to change notification settings - Fork 4k
mmaprototype: release rangeAnalyzedConstraints properly #158048
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
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. |
tbg
left a comment
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.
@tbg reviewed 1 of 1 files at r1, all commit messages.
Reviewable status:complete! 1 of 0 LGTMs obtained (waiting on @sumeerbhola)
-- commits line 5 at r1:
Could it leak? Releasing them puts them back into the pool, but they should otherwise have gotten garbage collected.
sumeerbhola
left a comment
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.
@sumeerbhola reviewed 1 of 1 files at r1, all commit messages.
Reviewable status:complete! 1 of 0 LGTMs obtained (waiting on @wenyihu6)
pkg/kv/kvserver/allocator/mmaprototype/cluster_state.go line 1665 at r1 (raw file):
// change, or we noticed a divergence in membership above and fell through // here. releaseRangeAnalyzedConstraints(rs.constraints)
nit: can we make a method on rangeState called clearAnalyzedConstraints that both sets rs.constraints to nil and calls releaseRangeAnalyzedConstraints. I am nervous about multiple places remembering to do both.
pkg/kv/kvserver/allocator/mmaprototype/cluster_state.go line 1665 at r1 (raw file):
// change, or we noticed a divergence in membership above and fell through // here. releaseRangeAnalyzedConstraints(rs.constraints)
releaseRangeAnalyzedConstraints assumes the parameter is non-nil. It isn't clear all these callers satisfy that constraint.
pkg/kv/kvserver/allocator/mmaprototype/cluster_state.go line 1707 at r1 (raw file):
delete(cs.stores[replica.StoreID].adjusted.replicas, r) } releaseRangeAnalyzedConstraints(rs.constraints)
this case would also call the aforementioned method.
wenyihu6
left a comment
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.
Reviewable status:
complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @sumeerbhola and @tbg)
Previously, tbg (Tobias Grieger) wrote…
Could it leak? Releasing them puts them back into the pool, but they should otherwise have gotten garbage collected.
I was thinking of not returning something to the pool as a resource leak, but I’m not sure if that’s the right terminology. I rephrased it as not putting things back into the pool.
pkg/kv/kvserver/allocator/mmaprototype/cluster_state.go line 1665 at r1 (raw file):
Previously, sumeerbhola wrote…
nit: can we make a method on
rangeStatecalledclearAnalyzedConstraintsthat both setsrs.constraintsto nil and callsreleaseRangeAnalyzedConstraints. I am nervous about multiple places remembering to do both.
Good call, done.
pkg/kv/kvserver/allocator/mmaprototype/cluster_state.go line 1665 at r1 (raw file):
Previously, sumeerbhola wrote…
releaseRangeAnalyzedConstraintsassumes the parameter is non-nil. It isn't clear all these callers satisfy that constraint.
Good call, there were panics. Fixed.
pkg/kv/kvserver/allocator/mmaprototype/cluster_state.go line 1707 at r1 (raw file):
Previously, sumeerbhola wrote…
this case would also call the aforementioned method.
Done.
sumeerbhola
left a comment
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.
@sumeerbhola reviewed 1 of 1 files at r2, all commit messages.
Reviewable status:complete! 1 of 0 LGTMs obtained (and 1 stale) (waiting on @tbg)
Previously, releaseRangeAnalyzedConstraints was not called on rangeAnalyzedConstraints, which could hold onto them and not returning to the pool. This commit ensures they are released whenever unused.
ecb6e5e to
0b101fd
Compare
|
TFTRs! bors r+ |
|
🕐 Waiting for PR status (GitHub check) to be set, probably by CI. Bors will automatically try to run when all required PR statuses are set. |
Epic: CRDB-55052
Release note: none
mmaprototype: release rangeAnalyzedConstraints properly
Previously, we weren’t calling releaseRangeAnalyzedConstraints on
rangeAnalyzedConstraints, which could lead to resource leak. This
commit calls releaseRangeAnalyzedConstraints when they are unused.