jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1831481 - in /jackrabbit/branches/2.10: ./ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/ConsistencyCheckerImpl.java jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/ConsistencyCheckerImplTest.java
Date Sat, 12 May 2018 14:20:33 GMT
Author: reschke
Date: Sat May 12 14:20:32 2018
New Revision: 1831481

URL: http://svn.apache.org/viewvc?rev=1831481&view=rev
Log:
JCR-3929: ConsistencyChecker now deals with empty repositories (ported to 2.10)

(thanks to pacuk.anton@gmail.com for investigating)

Modified:
    jackrabbit/branches/2.10/   (props changed)
    jackrabbit/branches/2.10/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/ConsistencyCheckerImpl.java
    jackrabbit/branches/2.10/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/ConsistencyCheckerImplTest.java

Propchange: jackrabbit/branches/2.10/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat May 12 14:20:32 2018
@@ -1,4 +1,4 @@
 /jackrabbit/branches/2.12:1776442,1776451,1776500,1776524
 /jackrabbit/branches/JCR-2272:1173165-1176545
 /jackrabbit/sandbox/JCR-2415-lucene-3.0:1060860-1064038
-/jackrabbit/trunk:1709811,1717599,1729382,1732436,1740814-1740815,1751279,1752165,1753226,1757322,1758600,1759607,1759782,1759865,1761679,1761909,1762422,1763558,1766398,1771078,1771741,1771939,1771999,1772049,1772343,1772444,1772457,1772530,1772544,1773579,1773591,1773745,1774443,1775123,1775132,1775315,1775384,1775414,1775419,1775437,1775444,1775463,1775472-1775473,1775481,1775485,1775496,1775509,1775514,1775613,1775617,1775621,1775624,1775629,1775631-1775632,1775634-1775635,1775637,1775657,1776410,1776414,1776416-1776417,1776421,1779166,1779460,1780208,1786325,1787043,1787381,1792193,1793315,1793323,1793327,1793332,1796980,1797209,1797917,1798586,1799429,1802977,1807234,1807244,1811667,1814831,1817097,1826230,1826647,1826940,1826964
+/jackrabbit/trunk:1709811,1717599,1729382,1732436,1740814-1740815,1751279,1752165,1753226,1757322,1758600,1759607,1759782,1759865,1761679,1761909,1762422,1763558,1766398,1771078,1771741,1771939,1771999,1772049,1772343,1772444,1772457,1772530,1772544,1773579,1773591,1773745,1774443,1775123,1775132,1775315,1775384,1775414,1775419,1775437,1775444,1775463,1775472-1775473,1775481,1775485,1775496,1775509,1775514,1775613,1775617,1775621,1775624,1775629,1775631-1775632,1775634-1775635,1775637,1775657,1776410,1776414,1776416-1776417,1776421,1779166,1779460,1780208,1786325,1787043,1787381,1792193,1793315,1793323,1793327,1793332,1796980,1797209,1797917,1798586,1799429,1802977,1807234,1807244,1810108,1811667,1814831,1817097,1826230,1826647,1826940,1826964

Modified: jackrabbit/branches/2.10/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/ConsistencyCheckerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.10/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/ConsistencyCheckerImpl.java?rev=1831481&r1=1831480&r2=1831481&view=diff
==============================================================================
--- jackrabbit/branches/2.10/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/ConsistencyCheckerImpl.java
(original)
+++ jackrabbit/branches/2.10/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/ConsistencyCheckerImpl.java
Sat May 12 14:20:32 2018
@@ -243,7 +243,9 @@ public class ConsistencyCheckerImpl {
                     allInfos.putAll(batch);
                 }
 
-                if (pm.exists(lastId)) {
+                if (lastId == null) {
+                    log.info("No nodes exists, skipping");
+                } else if (pm.exists(lastId)) {
                     for (Map.Entry<NodeId, NodeInfo> entry : allInfos.entrySet()) {
                         checkBundleConsistency(entry.getKey(), entry.getValue(), allInfos);
                     }

Modified: jackrabbit/branches/2.10/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/ConsistencyCheckerImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.10/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/ConsistencyCheckerImplTest.java?rev=1831481&r1=1831480&r2=1831481&view=diff
==============================================================================
--- jackrabbit/branches/2.10/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/ConsistencyCheckerImplTest.java
(original)
+++ jackrabbit/branches/2.10/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/ConsistencyCheckerImplTest.java
Sat May 12 14:20:32 2018
@@ -18,6 +18,7 @@ package org.apache.jackrabbit.core.data;
 
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
@@ -221,6 +222,13 @@ public class ConsistencyCheckerImplTest
         assertTrue("Expected orphan to be modified", listener.changes.isModified(orphanedId));
     }
 
+    public void testEmptyRepo() throws RepositoryException {
+        List<NodePropBundle> t = Collections.emptyList();
+        MockPersistenceManager pm = new MockPersistenceManager(t);
+        ConsistencyCheckerImpl checker = new ConsistencyCheckerImpl(pm, null, null, null);
+        checker.check(null, false);
+    }
+
     public void testDoubleCheckOrphanedNode() throws RepositoryException {
         NodePropBundle orphaned = new NodePropBundle(new NodeId(0, 1));
         orphaned.setParentId(new NodeId(1, 0));
@@ -453,6 +461,11 @@ public class ConsistencyCheckerImplTest
         }
 
         @Override
+        public boolean exists(final NodeId id) {
+            return bundles.containsKey(id);
+        }
+
+        @Override
         protected void evictBundle(final NodeId id) {
         }
 



Mime
View raw message