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

Ignore sql.ErrNoRows on deleting repos by ID #4387

Merged
merged 1 commit into from
Sep 6, 2024

Conversation

jhrozek
Copy link
Contributor

@jhrozek jhrozek commented Sep 6, 2024

Summary

We've seen this in minder cloud staging:

587a40169630","topic":"internal.entity.delete.event","handler":"github.com/stacklok/minder/internal/reconcilers.(*Reconciler).handleEntityDeleteEvent-fm-internal.entity.delete.event","component":"eventer","Timestamp":1725611382257727611,"message":"Found
error handling message"}
{"level":"error","component":"watermill","exception.message":"error
deleting repository from DB: error retrieving repository
e0e9fdde-bb2d-4a1d-9e0f-b8f5c006b42a in project
a5d7a1e4-f6a9-4282-8cc6-1a0e1613d1ae: sql: no rows in result
set","retry_no":3,"max_retries":3,"wait_time":0,"elapsed_time":105398463,"Timestamp":1725611382257739431,"message":"Error
occurred, retrying"}

Change Type

  • Bug fix (resolves an issue without affecting existing features)
  • Feature (adds new functionality without breaking changes)
  • Breaking change (may impact existing functionalities or require documentation updates)
  • Documentation (updates or additions to documentation)
  • Refactoring or test improvements (no bug fixes or new functionality)

Testing

added a unit test

Review Checklist:

  • Reviewed my own code for quality and clarity.
  • Added comments to complex or tricky code sections.
  • Updated any affected documentation.
  • Included tests that validate the fix or feature.
  • Checked that related changes are merged.

We've seen this in minder cloud staging:
```
587a40169630","topic":"internal.entity.delete.event","handler":"github.com/stacklok/minder/internal/reconcilers.(*Reconciler).handleEntityDeleteEvent-fm-internal.entity.delete.event","component":"eventer","Timestamp":1725611382257727611,"message":"Found
error handling message"}
{"level":"error","component":"watermill","exception.message":"error
deleting repository from DB: error retrieving repository
e0e9fdde-bb2d-4a1d-9e0f-b8f5c006b42a in project
a5d7a1e4-f6a9-4282-8cc6-1a0e1613d1ae: sql: no rows in result
set","retry_no":3,"max_retries":3,"wait_time":0,"elapsed_time":105398463,"Timestamp":1725611382257739431,"message":"Error
occurred, retrying"}
```
Copy link
Contributor

@blkt blkt left a comment

Choose a reason for hiding this comment

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

Minor comment, LGTM.

return fmt.Errorf("error deleting repository from DB: %w", err)
err := r.repos.DeleteByID(ctx, event.EntityID, event.ProjectID)
if errors.Is(err, sql.ErrNoRows) {
return nil
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: This codepath only flows from webhook events, right? I would at least add a log message, I find it weird that we try to delete by ID something that does not exist anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll fix this in a follow-up where I ignore another such error

@coveralls
Copy link

Coverage Status

coverage: 53.643% (-0.003%) from 53.646%
when pulling 6c4d1f2 on jhrozek:delete_repo_err
into 3cdde9b on stacklok:main.

@JAORMX JAORMX merged commit 1f9c1ef into mindersec:main Sep 6, 2024
22 checks passed
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.

4 participants