On 15/03/2010 12:43 AM, Juhani Ränkimies wrote:
On Sat, Feb 27, 2010 at 1:00 AM, Mark Hammond<[email protected]> wrote:
The root of this strategy comes from a realization that if a file is opened
on windows with FILE_SHARE_DELETE, the file can be deleted *or renamed*
while it is open. One limitation is that a file of the same name can not be
re-created while the old one still has handles open (the 'deleted but still
open' file still appears in directory listings until the handle is closed,
for example)
Given this, what we can do is something like:
* Arrange for erlang to be able to open the DB and view files with this
flag.
* Instead of deleting a file before replacing it, we first rename the file
to a unique name (ie, based on a UUID) in a special directory.
* As couch starts up, attempt to delete any old files in this special
directory. In theory, no such files should exist - the OS should take care
of actually removing any such files even if erlang crashes.
The end result of this is that things can be made to work with a lot less
friction than the 'file versioning' scheme. I've a patch to couchdb that
works when used with a patch to erlang to open *all* files with that flag.
Is the couchdb patch available somewhere?
I just uploaded it to https://issues.apache.org/jira/browse/COUCHDB-86
Cheers,
Mark