[PATCH] journal: new expiremental extension

Yuya Nishihara yuya at tcha.org
Thu Jun 23 10:51:07 EDT 2016


On Wed, 22 Jun 2016 17:05:21 +0100, Martijn Pieters wrote:
> On 22 June 2016 at 11:17, Martijn Pieters <mj at zopatista.com> wrote:
> > On 19 June 2016 at 15:32, Yuya Nishihara <yuya at tcha.org> wrote:  
> >> Perhaps we'd better start without the shared vfs? The sharedpath directory
> >> isn't covered by repo.wlock, so the journal file could be corrupted.  
> >
> > Would using with self.vfs('journal', mode='a+b', atomictemp=True): be
> > sufficient here I wonder? In case of a race condition, that'd mean
> > that we lose one of the two new record entries, as opposed to outright
> > file corruption.  
> 
> Ah, no I see already how this is handled normally; the share extension
> takes the lock in the shared repo before writing there.

I think it's okay to write journal without locking and rename it atomically.
IIRC, some cache files are saved without wlock.

If we want to make the journal 100% consistent, we'll need a lock. If we
just want to avoid data corruption, atomictemp will work.


More information about the Mercurial-devel mailing list