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

periodically check for stale restic repo locks #1708

Merged
merged 4 commits into from Jul 31, 2019

Conversation

skriss
Copy link
Member

@skriss skriss commented Jul 30, 2019

Signed-off-by: Steve Kriss krisss@vmware.com

Fixes #1511

I think this is all we need to do, but I'm still working on testing it.

Signed-off-by: Steve Kriss <krisss@vmware.com>
Signed-off-by: Steve Kriss <krisss@vmware.com>
Copy link
Contributor

@carlisia carlisia left a comment

Choose a reason for hiding this comment

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

This seems fine.

pkg/controller/restic_repository_controller.go Outdated Show resolved Hide resolved
Signed-off-by: Steve Kriss <krisss@vmware.com>
Signed-off-by: Steve Kriss <krisss@vmware.com>
@skriss
Copy link
Member Author

skriss commented Jul 31, 2019

I've confirmed that when there are no stale locks, this is a no-op, and when there is a stale lock, this successfully clears it out.

I also tweaked the ensureRepo function in the restic repo controller to only try to initialize a repo if the error gotten from attempting to connect to the repo indicates that the repo doesn't exist. We were seeing issues where, if the repo had a stale lock, Velero would try to re-initialize it rather than reporting that it was locked, which just led to confusing error output for the user.

@skriss skriss marked this pull request as ready for review July 31, 2019 16:14
@skriss
Copy link
Member Author

skriss commented Jul 31, 2019

One other note - restic considers locks "stale" if they've been around for >30min, even though in the normal case, they get refreshed every 5min. We might want to consider a PR to restic to make this "stale threshold" a CLI flag, so that we could say restic unlock --older-than 10m, for example.

@skriss
Copy link
Member Author

skriss commented Jul 31, 2019

Hold on merging this, checking one thing.

@skriss
Copy link
Member Author

skriss commented Jul 31, 2019

OK, looks fine, I just had some versioning issues.

Copy link
Contributor

@prydonius prydonius left a comment

Choose a reason for hiding this comment

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

lgtm

@prydonius prydonius merged commit b24a603 into vmware-tanzu:master Jul 31, 2019
@skriss skriss deleted the stale-lock-check branch July 31, 2019 17:53
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.

add restic stale lock checking
4 participants