On Thu, Jun 24, 2010 at 09:20:22AM +0100, Philip Martin wrote:
> Daniel Näslund <dan...@longitudo.com> writes:
> 
> > How are files installed during an update?
> > ----------------------------------------
> > We acquire a write lock
> > We crawl the wc
> > We tell the repos about our state
> > The repo runs an editor
> >   open_root(): We set status to _status_incomplete
> >     open_directory(): We set status t _status_incomplete.
> >       close_file(): We run the wq
> >     close_directory(): We run the wq
> 
> close_directory will remove status_incomplete for the directory, see
> maybe_bump_dir_info.  At present it's a direct database operation but
> it may become part of the wq for the directory.
> 
> >   close_edit(): Remove status_incomplete
> > release write_lock
> >
> > What if we get interrupted?
> > ----------------------------
> > We have this incoming change:
> >   M   A/B/lambda
> >   M   A/B/beta
> >
> > But we only process lambda and get cancelled before we start processing
> > beta. Then there's no wq started for beta. How does the wq know that the
> > update isn't complete?
> 
> The wq doesn't know or care.  All the wq knows is whether there are
> outstanding items.
> 
> > Or is the status that tells us that the update is
> > not complete? E.g. the workqueues provide write atomicity but it's the
> > status that tells us if the whole operation has succeded?
> 
> The status_incomplete remains on the directory.  It will remain until
> the user runs update successfully.
> 
> > I think it works like this:
> > ------------------------------
> > * If the next operation tries to acquire a write lock it will fail and
> >   tell the user to run 'svn cleanup'
> > * svn_wc_cleanup() will run all remaining work items in the different
> >   workqueues (will be one queue when we have one db).
> 
> Yes.  Although note that pool cleanups attempt to run any outstanding
> wq so controlled cancel will often run any wq and remove locks, just
> leaving the incomplete status.

Ok. For update that would be update_editor.c::cleanup_dir_baton() that
gets registered in cleanup_dir_baton_child() with a call to
apr_pool_cleanup_kill(). (Just putting it here for reference).

> > * Something detects that the update is incomplete and resumes it *or*
> >   something detects that the update is incomplete and reverts what has
> >   been done so far.
> 
> No.  In future it may change but at present the user needs to invoke
> update to finish the operation.

Thanks for your answers!
Daniel

Reply via email to