jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexparvule...@apache.org
Subject svn commit: r1572477 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/reference/ReferenceEditor.java
Date Thu, 27 Feb 2014 09:14:31 GMT
Author: alexparvulescu
Date: Thu Feb 27 09:14:30 2014
New Revision: 1572477

URL: http://svn.apache.org/r1572477
Log:
OAK-1397 VersionHistory#removeVersion
 - fixed the reference editor to correctly remove reference to a deleted version


Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/reference/ReferenceEditor.java

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=1572477&r1=1572476&r2=1572477&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
Thu Feb 27 09:14:30 2014
@@ -106,6 +106,8 @@ class ReferenceEditor extends DefaultEdi
      */
     private final Set<String> discardedIds;
 
+    private final Set<String> versionStoreIds;
+
     /**
      * set of ids that were added during this commit. we need it to reconcile
      * moves
@@ -126,6 +128,7 @@ class ReferenceEditor extends DefaultEdi
         this.rmWeakRefs = newHashMap();
         this.rmIds = newHashSet();
         this.discardedIds = newHashSet();
+        this.versionStoreIds = newHashSet();
         this.newIds = newHashSet();
     }
 
@@ -142,6 +145,7 @@ class ReferenceEditor extends DefaultEdi
         this.rmWeakRefs = parent.rmWeakRefs;
         this.rmIds = parent.rmIds;
         this.discardedIds = parent.discardedIds;
+        this.versionStoreIds = parent.versionStoreIds;
         this.newIds = parent.newIds;
     }
 
@@ -173,6 +177,10 @@ class ReferenceEditor extends DefaultEdi
             }
             rmIds.addAll(discardedIds);
 
+            // remove ids that are actually deleted (that exist in the rmRefs.keySet())
+            versionStoreIds.removeAll(rmRefs.keySet());
+            rmIds.addAll(versionStoreIds);
+
             // update references
             for (Entry<String, Set<String>> ref : rmRefs.entrySet()) {
                 String uuid = ref.getKey();
@@ -232,7 +240,7 @@ class ReferenceEditor extends DefaultEdi
         if (before != null) {
             if (before.getType().tag() == REFERENCE) {
                 if (isVersionStorePath(getPath())) {
-                    addAll(discardedIds, before.getValue(STRINGS));
+                    addAll(versionStoreIds, before.getValue(STRINGS));
                 } else {
                     put(rmRefs, before.getValue(STRINGS),
                             concat(getPath(), before.getName()));
@@ -253,7 +261,7 @@ class ReferenceEditor extends DefaultEdi
         if (after != null) {
             if (after.getType().tag() == REFERENCE) {
                 if (isVersionStorePath(getPath())) {
-                    addAll(discardedIds, after.getValue(STRINGS));
+                    addAll(versionStoreIds, after.getValue(STRINGS));
                 } else {
                     put(newRefs, after.getValue(STRINGS),
                             concat(getPath(), after.getName()));



Mime
View raw message