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

Re: Fixing issue 644

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2002-04-19 21:57:45 CEST

Philip Martin <philip@codematters.co.uk> writes:

> > > Assuming it is hard for the server to do this, I was thinking of
> > > getting the client to call svn_ra_dav__get_props_resource on the path
> > > to be added, and detecting the conflict by the fact that the function
> > > doesn't fail. Does this sound like the right solution?
> >
> > No, I don't think so. That would imply a PROPFIND roundtrip for every PUT
> > operation. Ick.
>
> Well, not every put operation. Only for files that are added, not
> those that are updated, and even then it is not necessary to do the
> check if the parent directory is being added in the same commit, since
> then the file cannot already exist (MKCOL already detects the conflict
> if one tries to add a directory that already exists). But yes, it
> does imply some round trips.
>
> >
> > I believe that we can use an If: header or an If-<something> header
> > associated with the PUT to say something along the lines of, "If nothing is
> > there" or "Only if revision FOO is there".
> >
> > Normally, when we do a PUT, we send a diff with a base for the diff delta.
> > That could be half of the verification: that the target we're PUTting
> > against is actually what is described in the delta. Hmm. But that isn't
> > quite right. We might want to PUT a file to location FOO, but describe that
> > file as a delta against BAR.
> >
> > Ah well. An If header seems the right approach. In HTTP / WebDAV terms, If
> > headers are assertions about the state of the resource specified by the
> > Request-URI. In our case, we want to assert the file is or is not present.
> >
> > More thinking seems necessary...
>
> Eek! Looks like I might have to read more about WebDAV after all :-(

So having read a bit, adding a header "If-None-Match: /repo/foo" when
creating the file with an URL "http://some.host/repo/foo" looks like
it ought to do the trick. Thing is, if I try this it doesn't seem to
work, I can still create the file multiple times.

Now adding the header "If-None-Match: *" causes all file creates to
fail, so the If-None-Match header mechanism works. I suppose I must be
using the wrong tag, I tried lots of things but "*" was the only one
that triggered a precondition failure.

Aside from the implementation, a design problem with this approach is
that it delays the conflict detection until the deltas are sent. I
thought subversion was meant to detect conflicts before sending all
the deltas, to avoid the case where large amounts of data get sent
only for a conflict to be detected near the end. This means that
delaying the conflict detection until the PUT is too late, isn't it?
In which case we are back to calling PROPFIND for added files.

-- 
Philip
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Apr 19 21:58:48 2002

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.