jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r1564331 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java
Date Tue, 04 Feb 2014 15:01:25 GMT
Author: mreutegg
Date: Tue Feb  4 15:01:25 2014
New Revision: 1564331

URL: http://svn.apache.org/r1564331
Log:
OAK-1384: Background write does not update all _lastRev

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java?rev=1564331&r1=1564330&r2=1564331&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java
Tue Feb  4 15:01:25 2014
@@ -1323,7 +1323,7 @@ public final class DocumentNodeStore
     }
 
     void backgroundWrite() {
-        if (unsavedLastRevisions.getPaths().size() == 0) {
+        if (unsavedLastRevisions.getPaths().isEmpty()) {
             return;
         }
         ArrayList<String> paths = new ArrayList<String>(unsavedLastRevisions.getPaths());
@@ -1333,10 +1333,11 @@ public final class DocumentNodeStore
         UpdateOp updateOp = null;
         Revision lastRev = null;
         List<String> ids = new ArrayList<String>();
-        for (int i = 0; i < paths.size(); i++) {
+        for (int i = 0; i < paths.size(); ) {
             String p = paths.get(i);
             Revision r = unsavedLastRevisions.get(p);
             if (r == null) {
+                i++;
                 continue;
             }
             int size = ids.size();
@@ -1347,16 +1348,18 @@ public final class DocumentNodeStore
                 updateOp = commit.getUpdateOperationForNode(p);
                 lastRev = r;
                 ids.add(Utils.getIdFromPath(p));
+                i++;
             } else if (r.equals(lastRev)) {
                 // use multi update when possible
                 ids.add(Utils.getIdFromPath(p));
+                i++;
             }
             // call update if any of the following is true:
             // - this is the second-to-last or last path (update last path, the
             //   root document, individually)
             // - revision is not equal to last revision (size of ids didn't change)
             // - the update limit is reached
-            if (i + 2 >= paths.size()
+            if (i + 2 > paths.size()
                     || size == ids.size()
                     || ids.size() >= BACKGROUND_MULTI_UPDATE_LIMIT) {
                 store.update(Collection.NODES, ids, updateOp);



Mime
View raw message