Daniel Shahaf wrote on Wed, Feb 23, 2011 at 16:02:49 +0200:
> julianf...@apache.org wrote on Thu, Feb 17, 2011 at 21:20:33 -0000:
> > Author: julianfoad
> > Date: Thu Feb 17 21:20:33 2011
> > New Revision: 1071795
> > 
> > URL: http://svn.apache.org/viewvc?rev=1071795&view=rev
> > Log:
> > * notes/wc-ng/pristine-store
> >   Update with initial feedback from danielsh.
> > 
> > Modified:
> >     subversion/trunk/notes/wc-ng/pristine-store
> > 
> > Modified: subversion/trunk/notes/wc-ng/pristine-store
> > URL: 
> > http://svn.apache.org/viewvc/subversion/trunk/notes/wc-ng/pristine-store?rev=1071795&r1=1071794&r2=1071795&view=diff
> > ==============================================================================
> > --- subversion/trunk/notes/wc-ng/pristine-store (original)
> > +++ subversion/trunk/notes/wc-ng/pristine-store Thu Feb 17 21:20:33 2011
> > @@ -1,22 +1,36 @@
> >  A. THE PRISTINE STORE
> >  =====================
> >  
> >  === A-1. Introduction ===
> >  
> 
> +1 on your changes here, and (having read through) virtually everywhere
> else in this commit.
> 
> I made a minor clarification in r1073749, and I have one question:
> 
> >  (d) To read a pristine text, the reader must:
> > -    1. Ensure no pristine-remove txn is in progress while querying and
> > -       opening it.
> > +    1. Query the SDB and open the file within the same SDB txn (to ensure
> > +       that no pristine-remove txn (A-3(b)) is in progress at the same
> > +       time).
> >      2. Ensure the pristine text remains in the store continuously from
> >         opening it for the duration of the read. (Perhaps by ensuring
> >         refcount remains >= 1 and/or by cooperating with the clean-up
> >         code.  Under spec B, the clean-up code is controlled by rule
> >         B-3(c), so holding any WC lock would prevent a pristine from being
> > -       deleted.)
> > +       deleted.  An alternative is to use the operating system's ability
> > +       to keep the file available for reading as long as the file handle
> > +       is open, even if the file's directory entry is removed.)
> > +
> > +(e) To clean up "orphan" pristine files:
> > +    1. 
> > +
> > +###?
> 
> I guess it would be:
> 
> (e) To clean up an "orphan" pristine file:
>     0. Acquire a 'RESERVED' lock.
>     1. Add a table row with refcount=0.
>     2. Follow the procedure A-3(b) for removing a pristine.
> 

You may have noticed that I glossed over the "How to determine which
pristines are orphaned" detail.

Coming back to that detail, it seems that iterating all on-disk
pristines is going to be expensive --- that's O(# files in wc)
pristines, and I haven't mentioned the DB queries.

Would it make sense to route the unlink() calls via the work queue, in
order to avoid having to do that expensive scan for orphans?


> And then we can also add an invariant A-2(c);
> 
> A-2(c) Pristines will only be added to or removed from the store by an
>        entity that holds an SDB lock.
> 
> Thoughts?
> 
> (I think it's useful to document the high level "What locks are needed
> for what operations" --- I was looking for such an invariant but didn't
> find any in (A).)

Reply via email to