jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r1547468 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/reference/ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype...
Date Tue, 03 Dec 2013 16:38:35 GMT
Author: tripod
Date: Tue Dec  3 16:38:35 2013
New Revision: 1547468

URL: http://svn.apache.org/r1547468
Log:
OAK-1242 Weak reference targets added after the reference property are not indexed

- also fixes: OAK-1257 Adding a new reference to an existing MV property deletes the back
references of the old ones

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUtils.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/reference/NodeReferenceConstants.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/reference/ReferenceEditor.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/reference/ReferenceEditorProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/reference/ReferenceIndex.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/InitialContent.java
    jackrabbit/oak/trunk/oak-jcr/pom.xml
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/ReferencesTest.java
    jackrabbit/oak/trunk/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/RepositoryUpgrade.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUtils.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUtils.java?rev=1547468&r1=1547467&r2=1547468&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUtils.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUtils.java
Tue Dec  3 16:38:35 2013
@@ -39,6 +39,7 @@ import javax.jcr.RepositoryException;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.Type;
 import org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider;
+import org.apache.jackrabbit.oak.plugins.index.reference.NodeReferenceConstants;
 import org.apache.jackrabbit.oak.plugins.memory.PropertyStates;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
@@ -119,6 +120,12 @@ public class IndexUtils {
         entry.setNames(PROPERTY_NAMES, propertyNames);
     }
 
+    public static void createReferenceIndex(@Nonnull NodeBuilder index) {
+        index.child(NodeReferenceConstants.NAME)
+                .setProperty(JCR_PRIMARYTYPE, INDEX_DEFINITIONS_NODE_TYPE, NAME)
+                .setProperty(TYPE_PROPERTY_NAME, NodeReferenceConstants.TYPE);
+    }
+
     public static boolean isIndexNodeType(NodeState state) {
         PropertyState ps = state.getProperty(JCR_PRIMARYTYPE);
         return ps != null

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/reference/NodeReferenceConstants.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/reference/NodeReferenceConstants.java?rev=1547468&r1=1547467&r2=1547468&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/reference/NodeReferenceConstants.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/reference/NodeReferenceConstants.java
Tue Dec  3 16:38:35 2013
@@ -18,6 +18,10 @@ package org.apache.jackrabbit.oak.plugin
 
 public class NodeReferenceConstants {
 
+    public static final String NAME = "reference";
+
+    public static final String TYPE = "reference";
+
     public final static String REF_NAME = ":references";
 
     public final static String WEAK_REF_NAME = ":weakreferences";

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/reference/ReferenceEditor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/reference/ReferenceEditor.java?rev=1547468&r1=1547467&r2=1547468&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/reference/ReferenceEditor.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/reference/ReferenceEditor.java
Tue Dec  3 16:38:35 2013
@@ -17,19 +17,17 @@
 package org.apache.jackrabbit.oak.plugins.index.reference;
 
 import static com.google.common.collect.ImmutableSet.of;
+import static com.google.common.collect.Iterables.addAll;
 import static com.google.common.collect.Maps.newHashMap;
 import static com.google.common.collect.Sets.newHashSet;
+import static javax.jcr.PropertyType.REFERENCE;
+import static javax.jcr.PropertyType.WEAKREFERENCE;
 import static org.apache.jackrabbit.JcrConstants.JCR_SYSTEM;
 import static org.apache.jackrabbit.JcrConstants.JCR_UUID;
 import static org.apache.jackrabbit.oak.api.CommitFailedException.INTEGRITY;
-import static org.apache.jackrabbit.oak.api.Type.REFERENCE;
-import static org.apache.jackrabbit.oak.api.Type.REFERENCES;
 import static org.apache.jackrabbit.oak.api.Type.STRING;
 import static org.apache.jackrabbit.oak.api.Type.STRINGS;
-import static org.apache.jackrabbit.oak.api.Type.WEAKREFERENCE;
-import static org.apache.jackrabbit.oak.api.Type.WEAKREFERENCES;
 import static org.apache.jackrabbit.oak.commons.PathUtils.concat;
-import static org.apache.jackrabbit.oak.commons.PathUtils.elements;
 import static org.apache.jackrabbit.oak.commons.PathUtils.isAbsolute;
 import static org.apache.jackrabbit.oak.plugins.index.reference.NodeReferenceConstants.REF_NAME;
 import static org.apache.jackrabbit.oak.plugins.index.reference.NodeReferenceConstants.WEAK_REF_NAME;
@@ -39,12 +37,9 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
 
-import javax.annotation.Nonnull;
-
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.api.PropertyState;
-import org.apache.jackrabbit.oak.core.ImmutableRoot;
-import org.apache.jackrabbit.oak.plugins.identifier.IdentifierManager;
+import org.apache.jackrabbit.oak.plugins.index.IndexEditor;
 import org.apache.jackrabbit.oak.plugins.index.property.strategy.ContentMirrorStoreStrategy;
 import org.apache.jackrabbit.oak.spi.commit.DefaultEditor;
 import org.apache.jackrabbit.oak.spi.commit.Editor;
@@ -55,7 +50,7 @@ import org.apache.jackrabbit.oak.spi.sta
  * Index editor for keeping a references to a node up to date.
  * 
  */
-class ReferenceEditor extends DefaultEditor {
+class ReferenceEditor extends DefaultEditor implements IndexEditor {
 
     private static ContentMirrorStoreStrategy STORE = new ContentMirrorStoreStrategy();
 
@@ -68,10 +63,9 @@ class ReferenceEditor extends DefaultEdi
     /** Path of this editor, built lazily in {@link #getPath()}. */
     private String path;
 
-    /** The Id Manager, built lazily in {@link #getIdManager()}. */
-    private IdentifierManager idManager;
+    private final NodeState root;
 
-    private final NodeBuilder builder;
+    private final NodeBuilder definition;
 
     /**
      * the uuid of the current node, null if the node doesn't have this
@@ -119,11 +113,12 @@ class ReferenceEditor extends DefaultEdi
      */
     private final Set<String> newIds;
 
-    public ReferenceEditor(NodeBuilder builder) {
+    public ReferenceEditor(NodeBuilder definition, NodeState root) {
         this.parent = null;
         this.name = null;
         this.path = "/";
-        this.builder = builder;
+        this.definition = definition;
+        this.root = root;
         this.uuid = null;
         this.newRefs = newHashMap();
         this.rmRefs = newHashMap();
@@ -138,7 +133,8 @@ class ReferenceEditor extends DefaultEdi
         this.parent = parent;
         this.name = name;
         this.path = null;
-        this.builder = parent.builder;
+        this.definition = parent.definition;
+        this.root = parent.root;
         this.uuid = uuid;
         this.newRefs = parent.newRefs;
         this.rmRefs = parent.rmRefs;
@@ -159,20 +155,6 @@ class ReferenceEditor extends DefaultEdi
         return path;
     }
 
-    /**
-     * Returns the id manager, building it lazily when first requested.
-     */
-    private IdentifierManager getIdManager() {
-        if (idManager == null) {
-            if (parent != null) {
-                return parent.getIdManager();
-            }
-            this.idManager = new IdentifierManager(new ImmutableRoot(
-                    this.builder.getNodeState()));
-        }
-        return idManager;
-    }
-
     @Override
     public void enter(NodeState before, NodeState after)
             throws CommitFailedException {
@@ -191,73 +173,50 @@ class ReferenceEditor extends DefaultEdi
             }
             rmIds.addAll(discardedIds);
 
-            // local uuid-> nodebuilder cache
-            Map<String, NodeBuilder> builders = newHashMap();
+            // update references
             for (Entry<String, Set<String>> ref : rmRefs.entrySet()) {
                 String uuid = ref.getKey();
                 if (rmIds.contains(uuid)) {
                     continue;
                 }
-                NodeBuilder child = resolveUUID(uuid, getIdManager(), builder,
-                        builders);
-                if (child == null) {
-                    throw new CommitFailedException(INTEGRITY, 2,
-                            "Unable to resolve UUID " + uuid);
-                }
                 Set<String> rm = ref.getValue();
                 Set<String> add = newHashSet();
                 if (newRefs.containsKey(uuid)) {
                     add = newRefs.remove(uuid);
                 }
-                update(child, REF_NAME, uuid, add, rm);
+                update(definition, REF_NAME, uuid, add, rm);
             }
             for (Entry<String, Set<String>> ref : newRefs.entrySet()) {
                 String uuid = ref.getKey();
                 if (rmIds.contains(uuid)) {
                     continue;
                 }
-                NodeBuilder child = resolveUUID(uuid, getIdManager(), builder,
-                        builders);
-                if (child == null) {
-                    throw new CommitFailedException(INTEGRITY, 3,
-                            "Unable to resolve UUID " + uuid);
-                }
                 Set<String> add = ref.getValue();
                 Set<String> rm = newHashSet();
-                update(child, REF_NAME, uuid, add, rm);
+                update(definition, REF_NAME, uuid, add, rm);
             }
+
+            // update weak references
             for (Entry<String, Set<String>> ref : rmWeakRefs.entrySet()) {
                 String uuid = ref.getKey();
                 if (rmIds.contains(uuid)) {
                     continue;
                 }
-                NodeBuilder child = resolveUUID(uuid, getIdManager(), builder,
-                        builders);
-                if (child == null) {
-                    // TODO log warning?
-                    continue;
-                }
                 Set<String> rm = ref.getValue();
                 Set<String> add = newHashSet();
                 if (newWeakRefs.containsKey(uuid)) {
                     add = newWeakRefs.remove(uuid);
                 }
-                update(child, WEAK_REF_NAME, uuid, add, rm);
+                update(definition, WEAK_REF_NAME, uuid, add, rm);
             }
             for (Entry<String, Set<String>> ref : newWeakRefs.entrySet()) {
                 String uuid = ref.getKey();
                 if (rmIds.contains(uuid)) {
                     continue;
                 }
-                NodeBuilder child = resolveUUID(uuid, getIdManager(), builder,
-                        builders);
-                if (child == null) {
-                    // TODO log warning?
-                    continue;
-                }
                 Set<String> add = ref.getValue();
                 Set<String> rm = newHashSet();
-                update(child, WEAK_REF_NAME, uuid, add, rm);
+                update(definition, WEAK_REF_NAME, uuid, add, rm);
             }
         }
     }
@@ -269,13 +228,17 @@ class ReferenceEditor extends DefaultEdi
 
     @Override
     public void propertyChanged(PropertyState before, PropertyState after) {
+
         if (before != null) {
-            if (before.getType() == REFERENCE || before.getType() == REFERENCES) {
-                put(rmRefs, before.getValue(STRINGS),
-                        concat(getPath(), before.getName()));
+            if (before.getType().tag() == REFERENCE) {
+                if (isVersionStorePath(getPath())) {
+                    addAll(discardedIds, before.getValue(STRINGS));
+                } else {
+                    put(rmRefs, before.getValue(STRINGS),
+                            concat(getPath(), before.getName()));
+                }
             }
-            if (before.getType() == WEAKREFERENCE
-                    || before.getType() == WEAKREFERENCES) {
+            if (before.getType().tag() == WEAKREFERENCE) {
                 put(rmWeakRefs, before.getValue(STRINGS),
                         concat(getPath(), before.getName()));
             }
@@ -288,12 +251,15 @@ class ReferenceEditor extends DefaultEdi
             }
         }
         if (after != null) {
-            if (after.getType() == REFERENCE || after.getType() == REFERENCES) {
-                put(newRefs, after.getValue(STRINGS),
-                        concat(getPath(), after.getName()));
+            if (after.getType().tag() == REFERENCE) {
+                if (isVersionStorePath(getPath())) {
+                    addAll(discardedIds, after.getValue(STRINGS));
+                } else {
+                    put(newRefs, after.getValue(STRINGS),
+                            concat(getPath(), after.getName()));
+                }
             }
-            if (after.getType() == WEAKREFERENCE
-                    || after.getType() == WEAKREFERENCES) {
+            if (after.getType().tag() == WEAKREFERENCE) {
                 put(newWeakRefs, after.getValue(STRINGS),
                         concat(getPath(), after.getName()));
             }
@@ -307,10 +273,6 @@ class ReferenceEditor extends DefaultEdi
 
     @Override
     public Editor childNodeAdded(String name, NodeState after) {
-        String path = concat(getPath(), name);
-        if (isVersionStorePath(path)) {
-            return null;
-        }
         String uuid = after.getString(JCR_UUID);
         if (uuid != null) {
             newIds.add(uuid);
@@ -321,22 +283,14 @@ class ReferenceEditor extends DefaultEdi
     @Override
     public Editor childNodeChanged(String name, NodeState before,
             NodeState after) {
-        String path = concat(getPath(), name);
-        if (isVersionStorePath(path)) {
-            return null;
-        }
         return new ReferenceEditor(this, name, after.getString(JCR_UUID));
     }
 
     @Override
     public Editor childNodeDeleted(String name, NodeState before)
             throws CommitFailedException {
-        String path = concat(getPath(), name);
-        if (isVersionStorePath(path)) {
-            return null;
-        }
         String uuid = before.getString(JCR_UUID);
-        if (uuid != null && check(before, REF_NAME, uuid)) {
+        if (uuid != null && check(definition.getNodeState(), REF_NAME, uuid)) {
             rmIds.add(uuid);
         }
         return new ReferenceEditor(this, name, uuid);
@@ -344,33 +298,10 @@ class ReferenceEditor extends DefaultEdi
 
     // ---------- Utils -----------------------------------------
 
-    private static NodeBuilder resolveUUID(String uuid,
-            IdentifierManager idManager, NodeBuilder root,
-            Map<String, NodeBuilder> builders) {
-        if (builders.containsKey(uuid)) {
-            return builders.get(uuid);
+    private static boolean isVersionStorePath(String oakPath) {
+        if (oakPath == null) {
+            return false;
         }
-        String path = idManager.resolveUUID(uuid);
-
-        if (path == null) {
-            return null;
-        }
-        NodeBuilder child = getChild(root, path);
-        if (child != null) {
-            builders.put(uuid, child);
-        }
-        return child;
-    }
-
-    private static NodeBuilder getChild(NodeBuilder root, String path) {
-        NodeBuilder child = root;
-        for (String p : elements(path)) {
-            child = child.child(p);
-        }
-        return child;
-    }
-
-    private static boolean isVersionStorePath(@Nonnull String oakPath) {
         if (oakPath.indexOf(JCR_SYSTEM) == 1) {
             for (String p : SYSTEM_PATHS) {
                 if (oakPath.startsWith(p)) {
@@ -407,8 +338,9 @@ class ReferenceEditor extends DefaultEdi
         }
     }
 
-    private static boolean check(NodeState ns, String name, String key) {
-        return ns.hasChildNode(name) && STORE.count(ns, name, of(key), 1) > 0;
+    private static boolean check(NodeState definition, String name, String key) {
+        return definition.hasChildNode(name)
+                && STORE.count(definition, name, of(key), 1) > 0;
     }
 
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/reference/ReferenceEditorProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/reference/ReferenceEditorProvider.java?rev=1547468&r1=1547467&r2=1547468&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/reference/ReferenceEditorProvider.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/reference/ReferenceEditorProvider.java
Tue Dec  3 16:38:35 2013
@@ -16,23 +16,26 @@
  */
 package org.apache.jackrabbit.oak.plugins.index.reference;
 
+import static org.apache.jackrabbit.oak.plugins.index.reference.NodeReferenceConstants.TYPE;
+
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Service;
-import org.apache.jackrabbit.oak.api.CommitFailedException;
+import org.apache.jackrabbit.oak.plugins.index.IndexEditorProvider;
 import org.apache.jackrabbit.oak.spi.commit.Editor;
-import org.apache.jackrabbit.oak.spi.commit.EditorProvider;
-import org.apache.jackrabbit.oak.spi.commit.VisibleEditor;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 
 @Component
-@Service(EditorProvider.class)
-public class ReferenceEditorProvider implements EditorProvider {
+@Service(IndexEditorProvider.class)
+public class ReferenceEditorProvider implements IndexEditorProvider {
 
     @Override
-    public Editor getRootEditor(NodeState before, NodeState after,
-            NodeBuilder builder) throws CommitFailedException {
-        return new VisibleEditor(new ReferenceEditor(builder));
+    public Editor getIndexEditor(String type, NodeBuilder definition,
+            NodeState root) {
+        if (TYPE.equals(type)) {
+            return new ReferenceEditor(definition, root);
+        }
+        return null;
     }
 
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/reference/ReferenceIndex.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/reference/ReferenceIndex.java?rev=1547468&r1=1547467&r2=1547468&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/reference/ReferenceIndex.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/reference/ReferenceIndex.java
Tue Dec  3 16:38:35 2013
@@ -22,17 +22,16 @@ import static java.lang.Double.POSITIVE_
 import static javax.jcr.PropertyType.REFERENCE;
 import static javax.jcr.PropertyType.WEAKREFERENCE;
 import static org.apache.jackrabbit.oak.api.Type.STRING;
-import static org.apache.jackrabbit.oak.commons.PathUtils.elements;
 import static org.apache.jackrabbit.oak.commons.PathUtils.getName;
 import static org.apache.jackrabbit.oak.commons.PathUtils.getParentPath;
+import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.INDEX_DEFINITIONS_NAME;
+import static org.apache.jackrabbit.oak.plugins.index.reference.NodeReferenceConstants.NAME;
 import static org.apache.jackrabbit.oak.plugins.index.reference.NodeReferenceConstants.REF_NAME;
 import static org.apache.jackrabbit.oak.plugins.index.reference.NodeReferenceConstants.WEAK_REF_NAME;
 import static org.apache.jackrabbit.oak.spi.query.Cursors.newPathCursor;
 
 import java.util.ArrayList;
 
-import org.apache.jackrabbit.oak.core.ImmutableRoot;
-import org.apache.jackrabbit.oak.plugins.identifier.IdentifierManager;
 import org.apache.jackrabbit.oak.plugins.index.property.strategy.ContentMirrorStoreStrategy;
 import org.apache.jackrabbit.oak.query.index.FilterImpl;
 import org.apache.jackrabbit.oak.spi.query.Cursor;
@@ -55,7 +54,7 @@ class ReferenceIndex implements QueryInd
 
     @Override
     public String getIndexName() {
-        return "reference";
+        return NAME;
     }
 
     @Override
@@ -92,18 +91,15 @@ class ReferenceIndex implements QueryInd
         return newPathCursor(new ArrayList<String>());
     }
 
-    private static Cursor lookup(NodeState state, String uuid,
+    private static Cursor lookup(NodeState root, String uuid,
             final String name, String index) {
-        String path = getIdManager(state).resolveUUID(uuid);
-        NodeState child = state;
-        for (String p : elements(path)) {
-            child = child.getChildNode(p);
-        }
-        if (!child.exists()) {
+        NodeState indexRoot = root.getChildNode(INDEX_DEFINITIONS_NAME)
+                .getChildNode(NAME);
+        if (!indexRoot.exists()) {
             return newPathCursor(new ArrayList<String>());
         }
         Iterable<String> paths = STORE.query(new FilterImpl(), index + "("
-                + uuid + ")", child, index, null);
+                + uuid + ")", indexRoot, index, null);
 
         if (!"*".equals(name)) {
             paths = filter(paths, new Predicate<String>() {
@@ -122,10 +118,6 @@ class ReferenceIndex implements QueryInd
         return newPathCursor(paths);
     }
 
-    private static IdentifierManager getIdManager(NodeState state) {
-        return new IdentifierManager(new ImmutableRoot(state));
-    }
-
     @Override
     public String getPlan(Filter filter, NodeState root) {
         StringBuilder buff = new StringBuilder("reference");

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/InitialContent.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/InitialContent.java?rev=1547468&r1=1547467&r2=1547468&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/InitialContent.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/InitialContent.java
Tue Dec  3 16:38:35 2013
@@ -85,6 +85,7 @@ public class InitialContent implements R
                     ImmutableList.of(JCR_PRIMARYTYPE, JCR_MIXINTYPES), null);
             // the cost of using the property index for "@primaryType is not null" is very
high
             nt.setProperty(IndexConstants.ENTRY_COUNT_PROPERTY_NAME, Long.valueOf(Long.MAX_VALUE));
+            IndexUtils.createReferenceIndex(index);
         }
 
         NodeState base = builder.getNodeState();

Modified: jackrabbit/oak/trunk/oak-jcr/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/pom.xml?rev=1547468&r1=1547467&r2=1547468&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-jcr/pom.xml Tue Dec  3 16:38:35 2013
@@ -50,9 +50,6 @@
       org.apache.jackrabbit.test.api.WorkspaceMoveSameNameSibsTest#testMoveNodesOrderingSupportedByParent
<!-- OAK-118 -->
       org.apache.jackrabbit.test.api.WorkspaceMoveTest#testMoveNodesLocked              
              <!-- OAK-118 -->
 
-      org.apache.jackrabbit.oak.jcr.ReferencesTest#testWeakReferencesAddLater <!-- OAK-1242
-->
-      org.apache.jackrabbit.oak.jcr.ReferencesTest#testMVReferencesAltering <!-- OAK-1257
-->
-
       <!-- Locking : not fully implemented -->
       org.apache.jackrabbit.test.api.lock.LockTest#testNodeLocked
       org.apache.jackrabbit.test.api.lock.LockTest#testParentChildDeepLock

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/ReferencesTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/ReferencesTest.java?rev=1547468&r1=1547467&r2=1547468&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/ReferencesTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/ReferencesTest.java
Tue Dec  3 16:38:35 2013
@@ -18,7 +18,6 @@ package org.apache.jackrabbit.oak.jcr;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.io.OutputStream;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.LinkedList;

Modified: jackrabbit/oak/trunk/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/RepositoryUpgrade.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/RepositoryUpgrade.java?rev=1547468&r1=1547467&r2=1547468&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/RepositoryUpgrade.java
(original)
+++ jackrabbit/oak/trunk/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/RepositoryUpgrade.java
Tue Dec  3 16:38:35 2013
@@ -38,6 +38,7 @@ import org.apache.jackrabbit.core.nodety
 import org.apache.jackrabbit.core.persistence.PersistenceManager;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.Type;
+import org.apache.jackrabbit.oak.plugins.index.IndexUpdateProvider;
 import org.apache.jackrabbit.oak.plugins.index.reference.ReferenceEditorProvider;
 import org.apache.jackrabbit.oak.plugins.name.NamespaceConstants;
 import org.apache.jackrabbit.oak.plugins.name.Namespaces;
@@ -279,7 +280,7 @@ public class RepositoryUpgrade {
             CommitHook hook = new CompositeHook(
                     new EditorHook(new RegistrationEditorProvider()),
                     new EditorHook(new GroupEditorProvider()),
-                    new EditorHook(new ReferenceEditorProvider())
+                    new EditorHook(new IndexUpdateProvider(new ReferenceEditorProvider()))
             );
             target.merge(builder, hook, null);
         } catch (Exception e) {



Mime
View raw message