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
move all variables in sampleAndWaterMarkHistograms::innerSet #97860
move all variables in sampleAndWaterMarkHistograms::innerSet #97860
Conversation
@kubernetes/sig-api-machinery-bugs |
/lgtm |
/hold for verification on ARM |
var acc sampleAndWaterMarkAccumulator | ||
var wellOrdered bool | ||
func() { | ||
when, whenInt, acc, wellOrdered := func() (time.Time, int64, sampleAndWaterMarkAccumulator, bool) { |
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.
At this point it seems like there's not much point in keeping it as an anonymous function, might as well just move that whole block out to func (saw *sampleAndWaterMarkHistograms) validateQuantization() (time.Time, int64, sampleAndWaterMarkAccumulator, bool)
(name it something better) unless the intent is to revert all of this once the golang bug is fixed.
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.
the point of the inner func is to unlock via a defer
as soon as our calculations are done before we log or call out to record metrics. Since the function has side effects, I'd prefer not to distribute it among several split up functions that are only expected to be called in a specific order
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.
The side effects argument makes sense I suppose. I get that it just exists to handle the unlock cleanly, but to me the code picks up a bit of an odor when anonymous functions grow return values and such. I'm just here as peanut gallery though, feel free to ignore my feedback.
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.
I agree with @liggitt , the inner function should never be invoked in any other context and so I would prefer to not expose it.
This fixes the problem for 386 on linux.
|
can |
I can verify on arm this afternoon, if nobody else beats me to it. |
@MikeSpreitzer if you want to go ahead and open the cherry-pick to release-1.20 so CI is happy, that would help meet the 1.20.2 deadline of EOD |
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.
/lgtm
@MikeSpreitzer is this ready to go?
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hasheddan, liggitt, MikeSpreitzer The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Working for me on arm:
|
thanks /hold cancel |
…-#97860-upstream-release-1.20 Automated cherry pick of #97860: move all variables in sampleAndWaterMarkHistograms::innerSet
/triage accepted |
…0-upstream-release-1.19 Automated cherry pick of #97860: move all variables in sampleAndWaterMarkHistograms::innerSet
What type of PR is this?
/kind bug
/kind regression
What this PR does / why we need it:
This is a refactoring to tiptoe around golang/go#43570 for #97685
Which issue(s) this PR fixes:
Fixes #97685
Special notes for your reviewer:
This is an alternative to #97791 and #97854
Does this PR introduce a user-facing change?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: