-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Remove FLOCK or make it optional #988
Comments
Hey @ehsannm, what's the error you see on android? The directory lock prevents multiple badger instances from accessing the same data directory (unless badger is in read-only mode). Making it optional would be easy but I'd like to understand the problem first. I do not have much experience with android. Any links or references would be appreciated. :) |
Hi @jarifibrahim, Thanks for your response. avc: denied { lock } for path="/data/data/com.ronaksoftware.river.beta/files/databases/river/badger" dev="vdc" ino=15589 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0 It seems that flock in some cases needs root access. |
@ehsannm Could it be possible that the android device has some other app (maybe an anti-virus) which acquire the lock on the same file? |
@jarifibrahim It is not happen on all androids, some of them. But our app needs to be compatible with all androids. It may be because of SELinux on some androids. We temporary fixed by changing the code in the badger, but we think if you provide it as an option then we don't need to fork the project for such a little change, or may be another lock mechanism ?!! |
@ehsannm I still feel the issue is with android. The @manishrjain what do you think? Can we make the file locking optional? |
@jarifibrahim I think so too, but what could we do? we cannot force users to update their phones, Internally we are making sure that we do not access the badger concurrently because it is in our code but forcing users to update their phone is not practical |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@ehsannm Feel free to send a PR for this. |
@jarifibrahim I created a pull request #1046 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@jarifibrahim is anything else i need to do ? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue was marked as stale and no activity has occurred since then, therefore it will now be closed. Please, reopen if the issue is still relevant. |
Are there any updates on this please? |
Hey @jonknight73 @ehsannm the issue got closed because of inactivity. I've reopened it. I've raised a PR to fix this which is based on @ehsannm original PR. |
Thank you very much. I'll be delighted to be able to move off my fork back into the main repo. |
Fixes #988 Based on #1046 This PR adds `BypassDirLock` option which allows badger to work without acquiring a lock on the data directory. This option could lead to data corruption if used with multiple badger instances trying to write to the same badger directory. Co-authored-by: Ehsan Noureddin Moosa <[email protected]>
Fixes #988 Based on #1046 This PR adds `BypassDirLock` option which allows badger to work without acquiring a lock on the data directory. This option could lead to data corruption if used with multiple badger instances trying to write to the same badger directory. Co-authored-by: Ehsan Noureddin Moosa <[email protected]> (cherry picked from commit 1bcbefc)
Fixes #988 Based on #1046 This PR adds `BypassDirLock` option which allows badger to work without acquiring a lock on the data directory. This option could lead to data corruption if used with multiple badger instances trying to write to the same badger directory. Co-authored-by: Ehsan Noureddin Moosa <[email protected]> (cherry picked from commit 1bcbefc)
Fixes hypermodeinc/badger#988 Based on hypermodeinc/badger#1046 This PR adds `BypassDirLock` option which allows badger to work without acquiring a lock on the data directory. This option could lead to data corruption if used with multiple badger instances trying to write to the same badger directory. Co-authored-by: Ehsan Noureddin Moosa <[email protected]>
Hi,
We are using badger as our data storage in our project. We run badger on Android and iOS devices. We have problem on some androids, which it seems they have problem with the FLOCK. When we ignore the err in Open method [db.go - line: 232] then we have no problem.
dirLockGuard, err = acquireDirectoryLock(opt.Dir, lockFile, opt.ReadOnly)
if err != nil {
return nil, err
}
for the moment we forked, and changed the code to fix our problem. However I was wondering any better solution do you offer ?
The text was updated successfully, but these errors were encountered: