You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Rolf Kulemann <ro...@apache.org> on 2004/04/09 08:34:48 UTC

[New Repository] Major design issue concerning state

Hello,

I see I'm lucky "moving that quick", because otherwise I never would
have found out the following.

I did a small sample with the WebDAVRepository. I'm creating docs, read
and write properties and version the docs via the WebDAV impl. of the
"new repository". Lets have a look at the requirement to create a newly
and LOCKED file in the repository. Using i.e. slides commandline client
for WebDAV u simple execute a) "lock newfilename.xml" and b) "put
src.xml newfilename.xml". BUT this only works within the same session.

That means if I lock into the webdav server a second time with the same
user, b) is not possible, because the lock is not only associated with
the user, but also bound to special session, here the first session.

To avoid this, the repsoitory impls. MUST act on the same WebdavResource
during a user session, but this is not possible by design!

Why?: Normally the Sources i.e. c) WebDAVSource are wrapping a special
d) WebdavResource. c) acts in all requests on the same d) which maintain
the state.

I have thought about alternatives, but all lead to concept where we
"need to pass around sth." reflecting the state. And that sth. is a
Source imho.

That is why I think the old SourceRepository concept is better, because
it is state aware since it acts on if wanted "stateful sources".

What is the disadvantage not being able to lock a non existent file in
order to create it?

Answer: Race issues. Lets create a new resource with put in order to
lock it afterwards. There is potential room for race conditions!

I really wonder, how this should be solved with the "new approach". Even
having ONE RepositorySource (to rule them all) would not solve it,
because it needs to wrap backend specific state which is in case of
WebDAV the WebdavResource. Thus we need single Source impls. for each
backend taking care of state. 

At the mom I recommend to extend the "old repository concept" with
versioning i.e. add methods
- checkout()
- checkin()
- uncheckout()
- setVersioned()

to the VersionalbeSourceInterface.


WDYT???
-- 
Regards,

    Rolf Kulemann


Re: [New Repository] Major design issue concerning state

Posted by Rolf Kulemann <ro...@apache.org>.
On Fri, 2004-04-09 at 09:39, Rolf Kulemann wrote:
> On Fri, 2004-04-09 at 09:22, Rolf Kulemann wrote:
> > On Fri, 2004-04-09 at 08:34, Rolf Kulemann wrote:
> > > Hello,
> > > 
> > > I see I'm lucky "moving that quick", because otherwise I never would
> > > have found out the following.
> > > 
> > > I did a small sample with the WebDAVRepository. I'm creating docs, read
> > > and write properties and version the docs via the WebDAV impl. of the
> > > "new repository". Lets have a look at the requirement to create a newly
> > > and LOCKED file in the repository. Using i.e. slides commandline client
> > > for WebDAV u simple execute a) "lock newfilename.xml" and b) "put
> > > src.xml newfilename.xml". BUT this only works within the same session.
> > > 
> > > That means if I lock into the webdav server a second time with the same
> > > user, b) is not possible, because the lock is not only associated with
> > > the user, but also bound to special session, here the first session.
> > > 
> > > To avoid this, the repsoitory impls. MUST act on the same WebdavResource
> > > during a user session, but this is not possible by design!
> > > 
> > > Why?: Normally the Sources i.e. c) WebDAVSource are wrapping a special
> > > d) WebdavResource. c) acts in all requests on the same d) which maintain
> > > the state.
> > > 
> > > I have thought about alternatives, but all lead to concept where we
> > > "need to pass around sth." reflecting the state. And that sth. is a
> > > Source imho.
> > 
> > Ok, I found maybe a solution for my special problem to create locked
> > resources in order to avoid races. I try to forget now, that there maybe
> > more state issues.
> > 
> > So it could be useful to add the following methods to the Repository
> > inteface or to the RepositoryVersioningHelper.
> > 
> > - createResource(String url, String content, boolean locked)
> > 
> > I think this would solve my major issue, because during the call, the
> > rep. impl can act for both operations (lock and put) on the same
> > WebdavResource. Of course this could be different implemented for other
> > repositories than WebDAV, but WebDAV behaves that way.
> > 
> 
> BUT another major problem is:
> 
> What if u want to lock a collection in order that lets say nobody than
> me can add nodes to it. Normally I would lock the collection and then
> invoke the createResource(), BUT this will not work, since the lock was
> created in a different session. 
> 
> How can this be "workarounded"??
> 
> createResource(String lockurl, String relativePath, String content)
> ?????

Mhh, but if I see how WebDAV behaves in terms of locking and further
acting on a locked resource, the lock() method in
WebDAVRepositoryTransactionHelper is completely useless since u can only
act on the locked resource during the same session, but that it is not
possible to call methods on the repository acting in the same session.

I dunno, but maybe it is a Slide issue that a user can not act on locked
resources via different sessions if I use WebDAV to access Slide. 


-- 
Regards,

    Rolf Kulemann


Re: [New Repository] Major design issue concerning state

Posted by Rolf Kulemann <ro...@apache.org>.
On Fri, 2004-04-09 at 09:22, Rolf Kulemann wrote:
> On Fri, 2004-04-09 at 08:34, Rolf Kulemann wrote:
> > Hello,
> > 
> > I see I'm lucky "moving that quick", because otherwise I never would
> > have found out the following.
> > 
> > I did a small sample with the WebDAVRepository. I'm creating docs, read
> > and write properties and version the docs via the WebDAV impl. of the
> > "new repository". Lets have a look at the requirement to create a newly
> > and LOCKED file in the repository. Using i.e. slides commandline client
> > for WebDAV u simple execute a) "lock newfilename.xml" and b) "put
> > src.xml newfilename.xml". BUT this only works within the same session.
> > 
> > That means if I lock into the webdav server a second time with the same
> > user, b) is not possible, because the lock is not only associated with
> > the user, but also bound to special session, here the first session.
> > 
> > To avoid this, the repsoitory impls. MUST act on the same WebdavResource
> > during a user session, but this is not possible by design!
> > 
> > Why?: Normally the Sources i.e. c) WebDAVSource are wrapping a special
> > d) WebdavResource. c) acts in all requests on the same d) which maintain
> > the state.
> > 
> > I have thought about alternatives, but all lead to concept where we
> > "need to pass around sth." reflecting the state. And that sth. is a
> > Source imho.
> 
> Ok, I found maybe a solution for my special problem to create locked
> resources in order to avoid races. I try to forget now, that there maybe
> more state issues.
> 
> So it could be useful to add the following methods to the Repository
> inteface or to the RepositoryVersioningHelper.
> 
> - createResource(String url, String content, boolean locked)
> 
> I think this would solve my major issue, because during the call, the
> rep. impl can act for both operations (lock and put) on the same
> WebdavResource. Of course this could be different implemented for other
> repositories than WebDAV, but WebDAV behaves that way.
> 

BUT another major problem is:

What if u want to lock a collection in order that lets say nobody than
me can add nodes to it. Normally I would lock the collection and then
invoke the createResource(), BUT this will not work, since the lock was
created in a different session. 

How can this be "workarounded"??

createResource(String lockurl, String relativePath, String content)
?????

-- 
Regards,

    Rolf Kulemann


Re: [New Repository] Major design issue concerning state

Posted by Rolf Kulemann <ro...@apache.org>.
On Fri, 2004-04-09 at 08:34, Rolf Kulemann wrote:
> Hello,
> 
> I see I'm lucky "moving that quick", because otherwise I never would
> have found out the following.
> 
> I did a small sample with the WebDAVRepository. I'm creating docs, read
> and write properties and version the docs via the WebDAV impl. of the
> "new repository". Lets have a look at the requirement to create a newly
> and LOCKED file in the repository. Using i.e. slides commandline client
> for WebDAV u simple execute a) "lock newfilename.xml" and b) "put
> src.xml newfilename.xml". BUT this only works within the same session.
> 
> That means if I lock into the webdav server a second time with the same
> user, b) is not possible, because the lock is not only associated with
> the user, but also bound to special session, here the first session.
> 
> To avoid this, the repsoitory impls. MUST act on the same WebdavResource
> during a user session, but this is not possible by design!
> 
> Why?: Normally the Sources i.e. c) WebDAVSource are wrapping a special
> d) WebdavResource. c) acts in all requests on the same d) which maintain
> the state.
> 
> I have thought about alternatives, but all lead to concept where we
> "need to pass around sth." reflecting the state. And that sth. is a
> Source imho.

Ok, I found maybe a solution for my special problem to create locked
resources in order to avoid races. I try to forget now, that there maybe
more state issues.

So it could be useful to add the following methods to the Repository
inteface or to the RepositoryVersioningHelper.

- createResource(String url, String content, boolean locked)

I think this would solve my major issue, because during the call, the
rep. impl can act for both operations (lock and put) on the same
WebdavResource. Of course this could be different implemented for other
repositories than WebDAV, but WebDAV behaves that way.

I will try to test such a method today.

Thoughts??

-- 
Regards,

    Rolf Kulemann


Re: [New Repository] Major design issue concerning state

Posted by Rolf Kulemann <ro...@apache.org>.
On Fri, 2004-04-09 at 11:49, Guido Casper wrote:
> The way WebDAV is designed (and the way lock tokens work) allows both 
> "session-internal-only" locking behaviour or "user-centric" locking 
> behaviour. The difficulties in managing locking state are due to the way 
> WebdavResource works.
> 
> http://marc.theaimsgroup.com/?l=slide-dev&m=108057214410350&w=2

Nice Patch. So u say it is in RC1? 
RC1 is out already I think. Should we update the webdav client jar and
go on "seeing how it all feels like"?

I have time to integrate the new method to the current WebDAVRep if this
is appreciated.

-- 
Regards,

    Rolf Kulemann


Re: [New Repository] Major design issue concerning state

Posted by Guido Casper <gc...@s-und-n.de>.
The way WebDAV is designed (and the way lock tokens work) allows both 
"session-internal-only" locking behaviour or "user-centric" locking 
behaviour. The difficulties in managing locking state are due to the way 
WebdavResource works.

http://marc.theaimsgroup.com/?l=slide-dev&m=108057214410350&w=2

Right now the only method of WebdavResource being "user-aware" is 
unlock() which seems a little inconsistent IMO. The required changes to 
the WebDAV repo impl can only be made after upgrading to RC1.

Yes, I thought about "how much state" the Repository should manage, and 
still opt for a stateless approach. I really can't see how this 
conflicts with SourceRepository since it rather expands on it.

Guido


Rolf Kulemann wrote:
> Hello,
> 
> I see I'm lucky "moving that quick", because otherwise I never would
> have found out the following.
> 
> I did a small sample with the WebDAVRepository. I'm creating docs, read
> and write properties and version the docs via the WebDAV impl. of the
> "new repository". Lets have a look at the requirement to create a newly
> and LOCKED file in the repository. Using i.e. slides commandline client
> for WebDAV u simple execute a) "lock newfilename.xml" and b) "put
> src.xml newfilename.xml". BUT this only works within the same session.
> 
> That means if I lock into the webdav server a second time with the same
> user, b) is not possible, because the lock is not only associated with
> the user, but also bound to special session, here the first session.
> 
> To avoid this, the repsoitory impls. MUST act on the same WebdavResource
> during a user session, but this is not possible by design!
> 
> Why?: Normally the Sources i.e. c) WebDAVSource are wrapping a special
> d) WebdavResource. c) acts in all requests on the same d) which maintain
> the state.
> 
> I have thought about alternatives, but all lead to concept where we
> "need to pass around sth." reflecting the state. And that sth. is a
> Source imho.
> 
> That is why I think the old SourceRepository concept is better, because
> it is state aware since it acts on if wanted "stateful sources".
> 
> What is the disadvantage not being able to lock a non existent file in
> order to create it?
> 
> Answer: Race issues. Lets create a new resource with put in order to
> lock it afterwards. There is potential room for race conditions!
> 
> I really wonder, how this should be solved with the "new approach". Even
> having ONE RepositorySource (to rule them all) would not solve it,
> because it needs to wrap backend specific state which is in case of
> WebDAV the WebdavResource. Thus we need single Source impls. for each
> backend taking care of state. 
> 
> At the mom I recommend to extend the "old repository concept" with
> versioning i.e. add methods
> - checkout()
> - checkin()
> - uncheckout()
> - setVersioned()
> 
> to the VersionalbeSourceInterface.
> 
> 
> WDYT???