jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r948381 - in /jackrabbit/branches/1.4/jackrabbit-core: ./ src/main/java/org/apache/jackrabbit/core/ src/main/java/org/apache/jackrabbit/core/state/ src/test/java/org/apache/jackrabbit/core/
Date Wed, 26 May 2010 10:05:19 GMT
Author: jukka
Date: Wed May 26 10:05:18 2010
New Revision: 948381

URL: http://svn.apache.org/viewvc?rev=948381&view=rev
Log:
1.4: Merged revision 794292 from the 1.5 branch (JCR-2129)

Added:
    jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentAddRemoveMoveTest.java
      - copied unchanged from r794292, jackrabbit/branches/1.5/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentAddRemoveMoveTest.java
    jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentAddRemovePropertyTest.java
      - copied unchanged from r794292, jackrabbit/branches/1.5/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentAddRemovePropertyTest.java
    jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentMixinModificationTest.java
      - copied unchanged from r794292, jackrabbit/branches/1.5/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentMixinModificationTest.java
    jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentModificationBase.java
      - copied unchanged from r794292, jackrabbit/branches/1.5/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentModificationBase.java
    jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentModificationWithSNSTest.java
      - copied unchanged from r794292, jackrabbit/branches/1.5/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentModificationWithSNSTest.java
    jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentMoveTest.java
      - copied unchanged from r794292, jackrabbit/branches/1.5/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentMoveTest.java
    jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentReorderTest.java
      - copied unchanged from r794292, jackrabbit/branches/1.5/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentReorderTest.java
Modified:
    jackrabbit/branches/1.4/jackrabbit-core/   (props changed)
    jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/   (props
changed)
    jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChangeLog.java
    jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/LocalItemStateManager.java
    jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeStateMerger.java
    jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java
    jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
    jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentNodeModificationTest.java
    jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/TestAll.java

Propchange: jackrabbit/branches/1.4/jackrabbit-core/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed May 26 10:05:18 2010
@@ -1 +1,2 @@
+/jackrabbit/branches/1.5/jackrabbit-core:794292
 /jackrabbit/trunk/jackrabbit-core:653417,654078,654514,655917,656240,656655,656664,658583,668086,668147,672125,678788,679389,680135,681031,681287,682409,683268,686688,691181,691550,694164,698200,698209,709142,718981,727402,733080,734366,746932

Propchange: jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed May 26 10:05:18 2010
@@ -1,2 +1,3 @@
+/jackrabbit/branches/1.5/jackrabbit-core/src/main/java/org/apache/jackrabbit/core:794292
 /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core:653417,654078,654514,655917,656240,656655,656664,658583,668086,668147,672125,678788,679389,680135,681031,681287,682409,683268,686688,691181,691550,694164,698200,698209,709142,718981,727402,733080,734366,746932
 /jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons:760876

Modified: jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChangeLog.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChangeLog.java?rev=948381&r1=948380&r2=948381&view=diff
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChangeLog.java
(original)
+++ jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChangeLog.java
Wed May 26 10:05:18 2010
@@ -142,6 +142,18 @@ public class ChangeLog {
     }
 
     /**
+     * Returns a flag indicating whether a given item state is marked as
+     * modified in this log.
+     *
+     * @param id the id of the item.
+     * @return <code>true</code> if the item state is marked as modified in this
+     *         log; <code>false</code> otherwise.
+     */
+    public boolean isModified(ItemId id) {
+        return modifiedStates.containsKey(id);
+    }
+
+    /**
      * Return a node references object given its id. Returns
      * <code>null</code> if the node reference is not in the modified
      * section.

Modified: jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/LocalItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/LocalItemStateManager.java?rev=948381&r1=948380&r2=948381&view=diff
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/LocalItemStateManager.java
(original)
+++ jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/LocalItemStateManager.java
Wed May 26 10:05:18 2010
@@ -408,9 +408,7 @@ public class LocalItemStateManager
                 cache.cache(local);
             }
         }
-        if (local != null) {
-            dispatcher.notifyStateCreated(created);
-        }
+        dispatcher.notifyStateCreated(created);
     }
 
     /**

Modified: jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeStateMerger.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeStateMerger.java?rev=948381&r1=948380&r2=948381&view=diff
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeStateMerger.java
(original)
+++ jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeStateMerger.java
Wed May 26 10:05:18 2010
@@ -106,7 +106,7 @@ class NodeStateMerger {
                         NodeState.ChildNodeEntry cne =
                                 (NodeState.ChildNodeEntry) iter.next();
 
-                        if (context.isAdded(cne.getId())) {
+                        if (context.isAdded(cne.getId()) || context.isModified(cne.getId()))
{
                             // a new child node entry has been added to this state;
                             // check for name collisions with other state
                             if (overlayedState.hasChildNodeEntry(cne.getName())) {
@@ -121,6 +121,8 @@ class NodeStateMerger {
                             }
 
                             added.add(cne);
+                        } else {
+                            // externally added
                         }
                     }
 
@@ -128,9 +130,11 @@ class NodeStateMerger {
                          iter.hasNext();) {
                         NodeState.ChildNodeEntry cne =
                                 (NodeState.ChildNodeEntry) iter.next();
-                        if (context.isDeleted(cne.getId())) {
+                        if (context.isDeleted(cne.getId()) || context.isModified(cne.getId()))
{
                             // a child node entry has been removed from this node state
                             removed.add(cne);
+                        } else {
+                            // externally removed
                         }
                     }
 
@@ -161,14 +165,6 @@ class NodeStateMerger {
                         PropertyId propId =
                                 new PropertyId(state.getNodeId(), name);
                         if (context.isAdded(propId)) {
-                            // a new property name has been added to this state;
-                            // check for name collisions
-                            if (overlayedState.hasPropertyName(name)
-                                    || overlayedState.hasChildNodeEntry(name)) {
-                                // conflicting names
-                                return false;
-                            }
-
                             added.add(name);
                         }
                     }
@@ -209,6 +205,7 @@ class NodeStateMerger {
     static interface MergeContext {
         boolean isAdded(ItemId id);
         boolean isDeleted(ItemId id);
+        boolean isModified(ItemId id);
         boolean allowsSameNameSiblings(NodeId id);
     }
 }

Modified: jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java?rev=948381&r1=948380&r2=948381&view=diff
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java
(original)
+++ jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java
Wed May 26 10:05:18 2010
@@ -792,9 +792,23 @@ public class SessionItemStateManager
             // local state was created
             ItemState transientState = transientStore.get(created.getId());
             if (transientState != null) {
-                // underlying state has been permanently created
-                transientState.pull();
-                transientState.setStatus(ItemState.STATUS_EXISTING);
+                if (transientState.hasOverlayedState()) {
+                    // underlying state has been permanently created
+                    transientState.pull();
+                    transientState.setStatus(ItemState.STATUS_EXISTING);
+                } else {
+                    // this is a notification from another session
+                    try {
+                        ItemState local = stateMgr.getItemState(created.getId());
+                        transientState.connect(local);
+                        // update mod count
+                        transientState.setModCount(local.getModCount());
+                        transientState.setStatus(ItemState.STATUS_EXISTING_MODIFIED);
+                    } catch (ItemStateException e) {
+                        // something went wrong, mark as stale
+                        transientState.setStatus(ItemState.STATUS_STALE_MODIFIED);
+                    }
+                }
                 visibleState = transientState;
             }
         }
@@ -828,6 +842,12 @@ public class SessionItemStateManager
                                     return atticStore.contains(id);
                                 }
 
+                                public boolean isModified(ItemId id) {
+                                    ItemState is = transientStore.get(id);
+                                    return is != null
+                                            && is.getStatus() == ItemState.STATUS_EXISTING_MODIFIED;
+                                }
+
                                 public boolean allowsSameNameSiblings(NodeId id) {
                                     NodeState ns;
                                     try {
@@ -872,6 +892,13 @@ public class SessionItemStateManager
             if (transientState != null) {
                 transientState.setStatus(ItemState.STATUS_STALE_DESTROYED);
                 visibleState = transientState;
+            } else {
+                // check attic
+                transientState = atticStore.get(destroyed.getId());
+                if (transientState != null) {
+                    atticStore.remove(destroyed.getId());
+                    transientState.onDisposed();
+                }
             }
         }
         dispatcher.notifyStateDestroyed(visibleState);

Modified: jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java?rev=948381&r1=948380&r2=948381&view=diff
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
(original)
+++ jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
Wed May 26 10:05:18 2010
@@ -596,6 +596,10 @@ public class SharedItemStateManager
                                             return local.deleted(id);
                                         }
 
+                                        public boolean isModified(ItemId id) {
+                                            return local.isModified(id);
+                                        }
+
                                         public boolean allowsSameNameSiblings(NodeId id)
{
                                             NodeState ns;
                                             try {

Modified: jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentNodeModificationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentNodeModificationTest.java?rev=948381&r1=948380&r2=948381&view=diff
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentNodeModificationTest.java
(original)
+++ jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentNodeModificationTest.java
Wed May 26 10:05:18 2010
@@ -120,7 +120,17 @@ public class ConcurrentNodeModificationT
                     state = "adding property to subnode " + i;
                     n1.setProperty("testprop", "xxx");
                     if (i % 10 == 0) {
-                        state = "saving pending subnodes";
+                        state = "saving pending (added) subnodes";
+                        session.save();
+                    }
+                    randomSleep();
+                }
+
+                for (int i = 0; i < NUM_NODES; i++) {
+                    state = "removing subnode " + i;
+                    n.getNode("x" + identity + i).remove();
+                    if (i % 10 == 0) {
+                        state = "saving pending (removed) subnodes";
                         session.save();
                     }
                     randomSleep();

Modified: jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/TestAll.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/TestAll.java?rev=948381&r1=948380&r2=948381&view=diff
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/TestAll.java
(original)
+++ jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/TestAll.java
Wed May 26 10:05:18 2010
@@ -37,6 +37,14 @@ public class TestAll extends TestCase {
         suite.addTestSuite(TransientRepositoryTest.class);
         suite.addTestSuite(XATest.class);
 
+        // test related to NodeStateMerger
+        suite.addTestSuite(ConcurrentAddRemoveMoveTest.class);
+        suite.addTestSuite(ConcurrentAddRemovePropertyTest.class);
+        suite.addTestSuite(ConcurrentMixinModificationTest.class);
+        suite.addTestSuite(ConcurrentModificationWithSNSTest.class);
+        suite.addTestSuite(ConcurrentMoveTest.class);
+        suite.addTestSuite(ConcurrentReorderTest.class);
+
         return suite;
     }
 }



Mime
View raw message