Return-Path: X-Original-To: apmail-jackrabbit-commits-archive@www.apache.org Delivered-To: apmail-jackrabbit-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E8BB498F1 for ; Wed, 18 Apr 2012 13:39:54 +0000 (UTC) Received: (qmail 11644 invoked by uid 500); 18 Apr 2012 13:39:54 -0000 Delivered-To: apmail-jackrabbit-commits-archive@jackrabbit.apache.org Received: (qmail 11616 invoked by uid 500); 18 Apr 2012 13:39:54 -0000 Mailing-List: contact commits-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list commits@jackrabbit.apache.org Received: (qmail 11609 invoked by uid 99); 18 Apr 2012 13:39:54 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Apr 2012 13:39:54 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Apr 2012 13:39:51 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 82576238897A; Wed, 18 Apr 2012 13:39:30 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1327507 - in /jackrabbit/branches/2.2: ./ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/daily/ Date: Wed, 18 Apr 2012 13:39:30 -0000 To: commits@jackrabbit.apache.org From: schans@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120418133930.82576238897A@eris.apache.org> Author: schans Date: Wed Apr 18 13:39:29 2012 New Revision: 1327507 URL: http://svn.apache.org/viewvc?rev=1327507&view=rev Log: JCR-3292: Prevent workspace.move() from causing data inconsistencies (merged from trunk) Added: jackrabbit/branches/2.2/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentAddMoveRemoveTest.java - copied, changed from r1327180, jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentAddMoveRemoveTest.java Modified: jackrabbit/branches/2.2/ (props changed) jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java jackrabbit/branches/2.2/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/daily/DailyIntegrationTest.java Propchange: jackrabbit/branches/2.2/ ------------------------------------------------------------------------------ Merged /jackrabbit/trunk:r1327180 Modified: jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java?rev=1327507&r1=1327506&r2=1327507&view=diff ============================================================================== --- jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java (original) +++ jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java Wed Apr 18 13:39:29 2012 @@ -550,7 +550,9 @@ public class BatchedItemOperations exten srcNameIndex = 1; } + stateMgr.store(target); if (renameOnly) { + stateMgr.store(srcParent); // change child node entry destParent.renameChildNodeEntry(srcPath.getName(), srcNameIndex, destPath.getName()); @@ -564,6 +566,9 @@ public class BatchedItemOperations exten throw new UnsupportedRepositoryOperationException(msg); } + stateMgr.store(srcParent); + stateMgr.store(destParent); + // do move: // 1. remove child node entry from old parent if (srcParent.removeChildNodeEntry(target.getNodeId())) { @@ -574,14 +579,6 @@ public class BatchedItemOperations exten } } - // store states - stateMgr.store(target); - if (renameOnly) { - stateMgr.store(srcParent); - } else { - stateMgr.store(destParent); - stateMgr.store(srcParent); - } return target.getNodeId(); } Copied: jackrabbit/branches/2.2/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentAddMoveRemoveTest.java (from r1327180, jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentAddMoveRemoveTest.java) URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.2/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentAddMoveRemoveTest.java?p2=jackrabbit/branches/2.2/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentAddMoveRemoveTest.java&p1=jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentAddMoveRemoveTest.java&r1=1327180&r2=1327507&rev=1327507&view=diff ============================================================================== --- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentAddMoveRemoveTest.java (original) +++ jackrabbit/branches/2.2/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/ConcurrentAddMoveRemoveTest.java Wed Apr 18 13:39:29 2012 @@ -24,7 +24,6 @@ import javax.jcr.RepositoryException; import javax.jcr.Session; import org.apache.jackrabbit.core.integration.random.operation.Operation; -import org.apache.jackrabbit.core.persistence.check.ConsistencyReport; /** * ConcurrentAddMoveRemoveTest performs a test with 5 threads which @@ -51,11 +50,7 @@ public class ConcurrentAddMoveRemoveTest @Override public void tearDown() throws Exception { - ConsistencyReport consistencyReport = TestHelper.checkConsistency(testRootNode.getSession(), false, null); - //for (ReportItem item : consistencyReport.getItems()) { - // System.out.println(item.getMessage()); - //} - assertTrue(consistencyReport.getItems().size() == 0); + // TODO: Should run consistency check here when it's available in 2.2. super.tearDown(); } Modified: jackrabbit/branches/2.2/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/daily/DailyIntegrationTest.java URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.2/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/daily/DailyIntegrationTest.java?rev=1327507&r1=1327506&r2=1327507&view=diff ============================================================================== --- jackrabbit/branches/2.2/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/daily/DailyIntegrationTest.java (original) +++ jackrabbit/branches/2.2/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/daily/DailyIntegrationTest.java Wed Apr 18 13:39:29 2012 @@ -20,6 +20,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; import org.apache.jackrabbit.core.ConcurrencyTest; +import org.apache.jackrabbit.core.ConcurrentAddMoveRemoveTest; import org.apache.jackrabbit.core.ConcurrentCheckinMixedTransactionTest; import org.apache.jackrabbit.core.ConcurrentLoginTest; import org.apache.jackrabbit.core.ConcurrentNodeModificationTest; @@ -54,6 +55,7 @@ public class DailyIntegrationTest extend suite.addTestSuite(ConcurrentVersioningTest.class); suite.addTestSuite(ConcurrentVersioningWithTransactionsTest.class); suite.addTestSuite(ConcurrentCheckinMixedTransactionTest.class); + suite.addTestSuite(ConcurrentAddMoveRemoveTest.class); suite.addTestSuite(LockTest.class); suite.addTestSuite(ReadVersionsWhileModified.class); suite.addTestSuite(ConcurrentLockingTest.class);