Closed cj-dimaggio closed 6 years ago
@Ssawa this patch probably won't get merged here, but I'll be happy to add it to http://github.com/coreos/bbolt
Agressive ad.
On jeu. 31 août 2017 00:48 Anthony Romano notifications@github.com wrote:
@Ssawa https://github.com/ssawa this patch probably won't get merged here, but I'll be happy to add it to http://github.com/coreos/bbolt https://github.com/coreos/bbolt
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/boltdb/bolt/pull/725#issuecomment-326140735, or mute the thread https://github.com/notifications/unsubscribe-auth/AAGwMHmfiEWVtY1FvZPyuI2hOzSNPWQSks5sdebTgaJpZM4PGsAP .
@vincent-petithory my apologies for trying to maintain this software
Came across this one today on a Unix system...
So when you try to open up a Bolt db that doesn't exist already exist in ReadOnly mode you get an
os.PathError
when initializing your meta pages and Bolt returnsnil
and the error. Which makes sense; you've opened (and created) the file with theO_RDONLY
flag and are now trying to write to it. I don't, personally, think that in ReadOnly mode you should initialize the database.However the issue is that this happens after you've acquired your shared lock on the FD and you now have no (direct) means of releasing it (because you've been passed back only
nil
). So if in my program I want to handle this error by creating and initializing a new database in ReadWrite mode I can't because I hang indefinitely waiting for my exclusive lock. All that this change does is make sure we call close on our partially created database before returning, closing our file so that a subsequent call to Open has a chance of acquiring an exclusive lock on the file.