ozeigermann 2004/03/30 05:55:45
Modified: src/webdav/server/org/apache/slide/webdav/util
UriHandler.java
src/share/org/apache/slide/store ExtendedStore.java
src/doc changelog.xml
Log:
Fix for bug #26913
Revision Changes Path
1.28 +48 -38
jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/UriHandler.java
Index: UriHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/UriHandler.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- UriHandler.java 24 Feb 2004 17:03:34 -0000 1.27
+++ UriHandler.java 30 Mar 2004 13:55:45 -0000 1.28
@@ -49,6 +49,8 @@
*/
public class UriHandler implements DeltavConstants, AclConstants, DaslConstants {
+ private final static Object HISTORY_LOCK = new Object();
+
/**
* Factory method.
*/
@@ -105,46 +107,54 @@
Content content = nsaToken.getContentHelper();
String hpath = hpathHandler.toString();
- NodeRevisionDescriptors hpathNrds =
- content.retrieve( sToken, hpath );
-
- NodeRevisionDescriptor hpathNrd =
- content.retrieve( sToken, hpathNrds );
-
- NodeProperty nextHnProp = hpathNrd.getProperty(I_NEXT_HISTORY_NAME,
- NamespaceCache.SLIDE_URI);
- if (nextHnProp == null) {
- // convert to slide namespace if this property is still
- // in DAV: namespace
- nextHnProp = hpathNrd.getProperty( I_NEXT_HISTORY_NAME );
- if (nextHnProp != null) {
- hpathNrd.removeProperty(nextHnProp);
- nextHnProp = new NodeProperty(I_NEXT_HISTORY_NAME,
- nextHnProp.getValue(),
- NamespaceCache.SLIDE_URI);
+ // XXX guarantees that reading and writing of history counting property
+ // is atomic. This is necessary as part of the fix to the problem described
in
+ // bug #26913. While the history counter is incremented no other tx can be
allowed
+ // to access the counter, that's why a write lock that is valid until
commit is needed.
+ // As this requires locking going through to the store and must thus tunnel
caching
+ // the other part of the fix is a HACK in ExtendedStore
+ synchronized (HISTORY_LOCK) {
+ NodeRevisionDescriptors hpathNrds =
+ content.retrieve( sToken, hpath );
+
+ NodeRevisionDescriptor hpathNrd =
+ content.retrieve( sToken, hpathNrds );
+
+ NodeProperty nextHnProp = hpathNrd.getProperty(I_NEXT_HISTORY_NAME,
+
NamespaceCache.SLIDE_URI);
+ if (nextHnProp == null) {
+ // convert to slide namespace if this property is still
+ // in DAV: namespace
+ nextHnProp = hpathNrd.getProperty( I_NEXT_HISTORY_NAME );
+ if (nextHnProp != null) {
+ hpathNrd.removeProperty(nextHnProp);
+ nextHnProp = new NodeProperty(I_NEXT_HISTORY_NAME,
+ nextHnProp.getValue(),
+ NamespaceCache.SLIDE_URI);
+ nextHnProp.setKind( NodeProperty.Kind.PROTECTED );
+ hpathNrd.setProperty( nextHnProp );
+ }
+ }
+ if( nextHnProp == null || nextHnProp.getValue() == null ) {
+ nextHnProp =
+ new NodeProperty(I_NEXT_HISTORY_NAME,
+ I_INITIAL_HISTORY_NAME,
+ NamespaceCache.SLIDE_URI);
nextHnProp.setKind( NodeProperty.Kind.PROTECTED );
hpathNrd.setProperty( nextHnProp );
}
- }
- if( nextHnProp == null || nextHnProp.getValue() == null ) {
- nextHnProp =
- new NodeProperty(I_NEXT_HISTORY_NAME,
- I_INITIAL_HISTORY_NAME,
- NamespaceCache.SLIDE_URI);
- nextHnProp.setKind( NodeProperty.Kind.PROTECTED );
+
+ String nextHnStr = (String)nextHnProp.getValue();
+ result = new UriHandler( hpath+"/"+nextHnStr );
+
+ long nextHnLong = Long.parseLong( nextHnStr );
+ nextHnProp = new NodeProperty(I_NEXT_HISTORY_NAME,
+ String.valueOf(nextHnLong + 1),
+ NamespaceCache.SLIDE_URI );
hpathNrd.setProperty( nextHnProp );
+
+ content.store( sToken, hpath, hpathNrd, null ); //revisionContent = null
}
-
- String nextHnStr = (String)nextHnProp.getValue();
- result = new UriHandler( hpath+"/"+nextHnStr );
-
- long nextHnLong = Long.parseLong( nextHnStr );
- nextHnProp = new NodeProperty(I_NEXT_HISTORY_NAME,
- String.valueOf(nextHnLong + 1),
- NamespaceCache.SLIDE_URI );
- hpathNrd.setProperty( nextHnProp );
-
- content.store( sToken, hpath, hpathNrd, null ); //revisionContent = null
return result;
}
1.8 +16 -8
jakarta-slide/src/share/org/apache/slide/store/ExtendedStore.java
Index: ExtendedStore.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/share/org/apache/slide/store/ExtendedStore.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ExtendedStore.java 25 Feb 2004 15:15:14 -0000 1.7
+++ ExtendedStore.java 30 Mar 2004 13:55:45 -0000 1.8
@@ -346,7 +346,7 @@
public NodeRevisionContent retrieveRevisionContent(Uri uri,
NodeRevisionDescriptor revisionDescriptor)
throws ServiceAccessException, RevisionNotFoundException {
- if (contentStore.cacheResults() && contentCache != null) {
+ if (contentStore.cacheResults() && contentCache != null &&
!omitCachingBecauseOfEvilHistoryHack(uri)) {
if (isForceStoreEnlistment(uri)) {
enlist(this);
}
@@ -447,7 +447,7 @@
//
public ObjectNode retrieveObject(Uri uri) throws ServiceAccessException,
ObjectNotFoundException {
- if (nodeStore.cacheResults()) {
+ if (nodeStore.cacheResults() && !omitCachingBecauseOfEvilHistoryHack(uri)) {
if (isForceStoreEnlistment(uri)) {
enlist(this);
}
@@ -689,7 +689,7 @@
public NodeRevisionDescriptors retrieveRevisionDescriptors(Uri uri)
throws ServiceAccessException, RevisionDescriptorNotFoundException {
- if (revisionDescriptorsStore.cacheResults()) {
+ if (revisionDescriptorsStore.cacheResults() &&
!omitCachingBecauseOfEvilHistoryHack(uri)) {
if (isForceStoreEnlistment(uri)) {
enlist(this);
}
@@ -754,7 +754,7 @@
public NodeRevisionDescriptor retrieveRevisionDescriptor(Uri uri,
NodeRevisionNumber revisionNumber)
throws ServiceAccessException, RevisionDescriptorNotFoundException {
- if (revisionDescriptorStore.cacheResults()) {
+ if (revisionDescriptorStore.cacheResults() &&
!omitCachingBecauseOfEvilHistoryHack(uri)) {
if (isForceStoreEnlistment(uri)) {
enlist(this);
}
@@ -988,6 +988,14 @@
getLogger().log(re, LOG_CHANNEL, Logger.CRITICAL);
setRollbackOnly();
throw re;
+ }
+
+ // XXX HACK checks if the requested uri is the history folder. In this
+ // case caching must be disabled to pass any lock operations to the physical
store.
+ // This is needed as part of the fix to the problem described in
+ // bug #26913
+ protected boolean omitCachingBecauseOfEvilHistoryHack(Uri uri) {
+ return ("/history".equals(uri.toString()));
}
protected class TxCacheWrapper implements ObjectCache {
1.92 +1 -0 jakarta-slide/src/doc/changelog.xml
Index: changelog.xml
===================================================================
RCS file: /home/cvs/jakarta-slide/src/doc/changelog.xml,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -r1.91 -r1.92
--- changelog.xml 16 Mar 2004 14:09:36 -0000 1.91
+++ changelog.xml 30 Mar 2004 13:55:45 -0000 1.92
@@ -15,6 +15,7 @@
release.
<changelog>
+ <fix date="March 30, 2004" author="ozeigermann" bugzilla-id="26913">Massive
concurrent writes no longer cause lots of conflicts.</fix>
<fix date="March 16, 2004" author="mholz">Fix authentication and name
problem in WebdavResource</fix>
<update date="February 26, 2004" author="ozeigermann">Replaced JDOM b9 with
JDOM HEAD version checked out at 26th, February, 2004. Adapted XMLOutputter code to
this.</update>
<update date="February 26, 2004" author="ozeigermann">Refactored and
cleaned up XMLResourceDescriptor to be standalone and removed now obsolete classes
from filestore package.</update>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]