Skip to content
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

fix(diff): avoid cache miss in server-side diff (#20423) #20424

Merged

Conversation

crenshaw-dev
Copy link
Member

Fixes #20423

@crenshaw-dev crenshaw-dev requested a review from a team as a code owner October 17, 2024 14:47
Copy link

bunnyshell bot commented Oct 17, 2024

❌ Preview Environment deleted from Bunnyshell

Available commands (reply to this comment):

  • 🚀 /bns:deploy to deploy the environment

@@ -1056,15 +1056,15 @@ func (a *ApplicationStatus) GetRevisions() []string {

// BuildComparedToStatus will build a ComparedTo object based on the current
// Application state.
func (app *Application) BuildComparedToStatus() ComparedTo {
func (spec *ApplicationSpec) BuildComparedToStatus() ComparedTo {
Copy link
Member Author

Choose a reason for hiding this comment

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

Scoped this down since we don't need access to the whole app. Makes it easier to avoid doing a DeepCopy on the whole app in specEqualsCompareTo

Signed-off-by: Michael Crenshaw <[email protected]>
Copy link

codecov bot commented Oct 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.07%. Comparing base (4faf8dd) to head (44e23e9).
Report is 9 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #20424      +/-   ##
==========================================
- Coverage   56.05%   55.07%   -0.99%     
==========================================
  Files         322      322              
  Lines       44802    54927   +10125     
==========================================
+ Hits        25115    30252    +5137     
- Misses      17084    22077    +4993     
+ Partials     2603     2598       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@agaudreault agaudreault left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -947,6 +945,25 @@ func useDiffCache(noCache bool, manifestInfos []*apiclient.ManifestResponse, sou
return true
}

// specEqualsCompareTo compares the application spec to the comparedTo status. It normalizes the destination to match
// the comparedTo destination before comparing. It does not mutate the original spec or comparedTo.
func specEqualsCompareTo(spec v1alpha1.ApplicationSpec, comparedTo v1alpha1.ComparedTo) bool {
Copy link
Member

Choose a reason for hiding this comment

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

Could be ptr arguments, but I dont think performance will increase that much.

Suggested change
func specEqualsCompareTo(spec v1alpha1.ApplicationSpec, comparedTo v1alpha1.ComparedTo) bool {
func specEqualsCompareTo(spec *v1alpha1.ApplicationSpec, comparedTo *v1alpha1.ComparedTo) bool {

@crenshaw-dev crenshaw-dev merged commit ec499bb into argoproj:master Oct 18, 2024
27 checks passed
@crenshaw-dev crenshaw-dev deleted the fix-server-side-diff-cache-miss branch October 18, 2024 13:36
@crenshaw-dev
Copy link
Member Author

/cherry-pick release-2.13

@crenshaw-dev
Copy link
Member Author

/cherry-pick release-2.12

@crenshaw-dev
Copy link
Member Author

/cherry-pick release-2.10

@crenshaw-dev
Copy link
Member Author

/cherry-pick release-2.11

Copy link

Cherry-pick failed with Merge error ec499bb0706241efc0b64a75c1409cff7e85e5b6 into temp-cherry-pick-3198ab-release-2.10

gcp-cherry-pick-bot bot pushed a commit that referenced this pull request Oct 18, 2024
* fix(diff): avoid cache miss in server-side diff (#20423)

Signed-off-by: Michael Crenshaw <[email protected]>

* fix silly mistakes

Signed-off-by: Michael Crenshaw <[email protected]>

---------

Signed-off-by: Michael Crenshaw <[email protected]>
gcp-cherry-pick-bot bot pushed a commit that referenced this pull request Oct 18, 2024
* fix(diff): avoid cache miss in server-side diff (#20423)

Signed-off-by: Michael Crenshaw <[email protected]>

* fix silly mistakes

Signed-off-by: Michael Crenshaw <[email protected]>

---------

Signed-off-by: Michael Crenshaw <[email protected]>
gcp-cherry-pick-bot bot pushed a commit that referenced this pull request Oct 18, 2024
* fix(diff): avoid cache miss in server-side diff (#20423)

Signed-off-by: Michael Crenshaw <[email protected]>

* fix silly mistakes

Signed-off-by: Michael Crenshaw <[email protected]>

---------

Signed-off-by: Michael Crenshaw <[email protected]>
crenshaw-dev added a commit that referenced this pull request Oct 18, 2024
…0449)

* fix(diff): avoid cache miss in server-side diff (#20423)



* fix silly mistakes



---------

Signed-off-by: Michael Crenshaw <[email protected]>
Co-authored-by: Michael Crenshaw <[email protected]>
crenshaw-dev added a commit that referenced this pull request Oct 18, 2024
…0450)

* fix(diff): avoid cache miss in server-side diff (#20423)



* fix silly mistakes



---------

Signed-off-by: Michael Crenshaw <[email protected]>
Co-authored-by: Michael Crenshaw <[email protected]>
crenshaw-dev added a commit that referenced this pull request Oct 18, 2024
…0451)

* fix(diff): avoid cache miss in server-side diff (#20423)



* fix silly mistakes



---------

Signed-off-by: Michael Crenshaw <[email protected]>
Co-authored-by: Michael Crenshaw <[email protected]>
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.

Server-side diff always misses diff cache
2 participants