[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] lock transaction-current separately from current

From: Malcolm Rowe <malcolm-svn-dev_at_farside.org.uk>
Date: 2007-11-26 17:27:15 CET

On Thu, Nov 08, 2007 at 06:06:12PM -0800, David Glasser wrote:
> > We could switch the lockfile to a new transaction-current-lock, sure,
> > though it'd be much better if we switched to:
> >
> > open transaction-current
> > lock
> > read
> > seek
> > write
> > fflush
> > close
>
> Hmm. Are you sure this is safe? What if the server crashed while
> halfway through writing out the line? (Or between the trunc that I
> suspect would be necessary there and the write?) Sure, in practice
> buffering is going to make the former case impossible, but is it
> really OK?
>

I believe that writes below the block size of the disk (as these will
be) are guaranteed atomic by POSIX, though I admit I haven't verified
that.

We don't need a trunc() since we're always going to overwrite with
something the same size or longer.

Regards,
Malcolm

  • application/pgp-signature attachment: stored
Received on Mon Nov 26 17:27:34 2007

This is an archived mail posted to the Subversion Dev mailing list.