The Wayback Machine - https://web.archive.org/web/20200906112411/https://github.com/rs-ipfs/rust-ipfs/issues/243
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

Repo locking #243

Open
koivunej opened this issue Jul 16, 2020 · 0 comments
Open

Repo locking #243

koivunej opened this issue Jul 16, 2020 · 0 comments

Comments

@koivunej
Copy link
Member

@koivunej koivunej commented Jul 16, 2020

Not providing any repo locking causes difficult to debug issues as I've hit earlier myself and now others have as well, see #241.

Simplest way could be to fail at Repo::init time if a lock file exists. If the lock file doesn't exist, one must be created and again removed at exit time. Probably ok to rely on deletion at Drop, require manual recovery (file deletion) unless a (go/js) compatible recovery strategy exists.

While we are not aiming to be 100% repo compatible with the other implementations being compatible here sounds like a solid idea. go-ipfs 0.5 seems to use a simple protocol of creating an empty file $IPFS_PATH/repo_lock with the following /proc/fdinfo/$fd:

$ cat /proc/1159/fdinfo/5
pos:    0
flags:  02100002
mnt_id: 29
lock:   1: POSIX  ADVISORY  WRITE 1159 fd:01:2101410 0 EOF

Originally posted by @koivunej in #241 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.