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(offloading): Correctly deleted offloaded data. Fixes #2206 #2207

Merged
merged 4 commits into from
Feb 11, 2020

Conversation

alexec
Copy link
Contributor

@alexec alexec commented Feb 11, 2020

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this is a chore.
  • The title of the PR is (a) conventional, (b) states what changed, and (c) suffixes the related issues number. E.g. "fix(controller): Updates such and such. Fixes #1234".
  • I have written unit and/or e2e tests for my change. PRs without these are unlike to be merged.
  • Optional. I've added My organization is added to the README.
  • I've signed the CLA and required builds are green.

Fixes #2206

@alexec alexec added this to the v2.5 milestone Feb 11, 2020
@@ -182,6 +186,12 @@ func (wdc *nodeOffloadRepo) ListOldOffloads(namespace string) ([]UUIDVersion, er
}

func (wdc *nodeOffloadRepo) Delete(uid, version string) error {
if uid == "" {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

checks to make sure that can't happen again

@@ -145,7 +147,8 @@ func (wdc *nodeOffloadRepo) List(namespace string) (map[UUIDVersion]wfv1.Nodes,
log.WithFields(log.Fields{"namespace": namespace}).Debug("Listing offloaded nodes")
var records []nodesRecord
err := wdc.session.
SelectFrom(wdc.tableName).
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we should never use SelectFrom it always does SELECT *

@@ -268,6 +268,7 @@ func (wfc *WorkflowController) periodicWorkflowGarbageCollector(stopCh <-chan st
oldRecords, err := wfc.offloadNodeStatusRepo.ListOldOffloads(wfc.GetManagedNamespace())
if err != nil {
log.WithField("err", err).Error("Failed to list old offloaded nodes")
return
Copy link
Contributor Author

Choose a reason for hiding this comment

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

bonus fix

@@ -14,7 +14,8 @@ import (
)

type UUIDVersion struct {
UID, Version string
UID string `db:"uid"`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

these were all empty strings

@alexec alexec requested a review from sarabala1979 February 11, 2020 01:21
@codecov
Copy link

codecov bot commented Feb 11, 2020

Codecov Report

Merging #2207 into master will decrease coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2207      +/-   ##
==========================================
- Coverage   11.70%   11.70%   -0.01%     
==========================================
  Files          52       52              
  Lines       26313    26322       +9     
==========================================
  Hits         3081     3081              
- Misses      22837    22846       +9     
  Partials      395      395              

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e30b77f...81ba173. Read the comment docs.

@alexec alexec marked this pull request as ready for review February 11, 2020 02:24
@@ -268,6 +268,7 @@ func (wfc *WorkflowController) periodicWorkflowGarbageCollector(stopCh <-chan st
oldRecords, err := wfc.offloadNodeStatusRepo.ListOldOffloads(wfc.GetManagedNamespace())
if err != nil {
log.WithField("err", err).Error("Failed to list old offloaded nodes")
return
Copy link
Member

Choose a reason for hiding this comment

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

This will exit the loop. if there is any intermediate network issue or DB issue, return will exit the loop with an error message and stop the node status GC.
Do you think the following behavior will fit for this scenario?

  1. Implement ExponentialBackoff for the Query inside the loop instead of return
  2. Restart the controller so it will check the DB connectivity while start.

Copy link
Contributor Author

@alexec alexec Feb 11, 2020

Choose a reason for hiding this comment

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

I'm not sure about back off etc. Adds a massive level of testing complexity for little benefit.

Copy link
Member

Choose a reason for hiding this comment

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

how will the application behave if wfc.offloadNodeStatusRepo.ListOldOffloads return the err?

Copy link
Contributor Author

@alexec alexec Feb 11, 2020

Choose a reason for hiding this comment

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

it will exit, I think this is incorrect, should continue (same applies for other lines) - I will fix

Copy link
Member

@sarabala1979 sarabala1979 left a comment

Choose a reason for hiding this comment

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

LGTM

@alexec alexec merged commit 62f4668 into argoproj:master Feb 11, 2020
@alexec alexec deleted the fix-gc-again branch February 11, 2020 21:40
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.

Offload GC is not deleted old data
2 participants