mount: detect mountpoint does not exist before opening the repository#4590
Merged
MichaelEischer merged 1 commit intorestic:masterfrom Dec 24, 2023
Merged
Conversation
5948ccf to
f3489e8
Compare
Bug restic#1681 suggests that restic should not be nice to user and should refrain from creating a mountpoint if it does not exist. Nevertheless, it currently opens the repository before checking for the mountpoint's existence. In the case of large or remote repositories, this process can be time-consuming, delaying the inevitable outcome. /restic mount --repo=REMOTE --verbose /tmp/backup repository 33f14e42 opened (version 2, compression level max) [0:38] 100.00% 162 / 162 index files loaded Mountpoint /tmp/backup doesn't exist stat /tmp/backup: no such file or directory real 0m39.534s user 1m53.961s sys 0m3.044s In this scenario, 40 seconds could have been saved if the nonexistence of the path had been verified beforehand. This patch relocates the mountpoint check to the beginning of the runMount function, preceding the opening of the repository. /restic mount --repo=REMOTE --verbose /tmp/backup Mountpoint /tmp/backup doesn't exist stat /tmp/backup: no such file or directory real 0m0.136s user 0m0.018s sys 0m0.027s Signed-off-by: Sébastien Gross <seb•ɑƬ•chezwam•ɖɵʈ•org>
f3489e8 to
f7587be
Compare
MichaelEischer
approved these changes
Dec 24, 2023
Member
MichaelEischer
left a comment
There was a problem hiding this comment.
LGTM. I've slightly tweaked the changelog entry.
Author
Thanks. Let me know if there are better best practices / phrasings for the changelog. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR change? What problem does it solve?
Bug #1681 suggests that restic should not be nice to user and should refrain from creating a mountpoint if it does not exist. Nevertheless, it currently opens the repository before checking for the mountpoint's existence. In the case of large or remote repositories, this process can be time-consuming, delaying the inevitable outcome.
In this scenario, 40 seconds could have been saved if the nonexistence of the path had been verified beforehand.
Was the change previously discussed in an issue or on the forum?
This patch relocates the mountpoint check to the beginning of the runMount function, preceding the opening of the repository.
Checklist
changelog/unreleased/that describes the changes for our users (see template).gofmton the code in all commits.