jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r1516160 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/plugins/mongomk/ test/java/org/apache/jackrabbit/oak/plugins/mongomk/
Date Wed, 21 Aug 2013 13:39:48 GMT
Author: mreutegg
Date: Wed Aug 21 13:39:48 2013
New Revision: 1516160

URL: http://svn.apache.org/r1516160
Log:
OAK-926: MongoMK: split documents when they are too large
- Remove path from UpdateOp

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/ClusterNodeInfo.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/Collision.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/Commit.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoMK.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/Node.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/NodeDocument.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/UpdateOp.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoDocumentStoreTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/ClusterNodeInfo.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/ClusterNodeInfo.java?rev=1516160&r1=1516159&r2=1516160&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/ClusterNodeInfo.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/ClusterNodeInfo.java
Wed Aug 21 13:39:48 2013
@@ -160,7 +160,7 @@ public class ClusterNodeInfo {
         }
         for (int i = 0; i < 10; i++) {
             ClusterNodeInfo clusterNode = createInstance(store, machineId, instanceId);
-            UpdateOp update = new UpdateOp(null, "" + clusterNode.id, true);
+            UpdateOp update = new UpdateOp("" + clusterNode.id, true);
             update.set(ID, String.valueOf(clusterNode.id));
             update.set(MACHINE_ID_KEY, clusterNode.machineId);
             update.set(INSTANCE_ID_KEY, clusterNode.instanceId);
@@ -231,7 +231,7 @@ public class ClusterNodeInfo {
         if (now + nextCheckMillis + nextCheckMillis < leaseEndTime) {
             return;
         }
-        UpdateOp update = new UpdateOp(null, "" + id, true);
+        UpdateOp update = new UpdateOp("" + id, true);
         leaseEndTime = now + leaseTime;
         update.set(LEASE_END_KEY, leaseEndTime);
         store.createOrUpdate(Collection.CLUSTER_NODES, update);
@@ -246,7 +246,7 @@ public class ClusterNodeInfo {
     }
     
     public void dispose() {
-        UpdateOp update = new UpdateOp(null, "" + id, true);
+        UpdateOp update = new UpdateOp("" + id, true);
         update.set(LEASE_END_KEY, null);
         store.createOrUpdate(Collection.CLUSTER_NODES, update);
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/Collision.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/Collision.java?rev=1516160&r1=1516159&r2=1516160&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/Collision.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/Collision.java
Wed Aug 21 13:39:48 2013
@@ -115,8 +115,7 @@ class Collision {
             }
         }
         // at this point we have a commitRootPath
-        UpdateOp op = new UpdateOp(commitRootPath,
-                Utils.getIdFromPath(commitRootPath), false);
+        UpdateOp op = new UpdateOp(Utils.getIdFromPath(commitRootPath), false);
         document = store.find(Collection.NODES, op.getKey());
         // check commit status of revision
         if (document.isCommitted(revision)) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/Commit.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/Commit.java?rev=1516160&r1=1516159&r2=1516160&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/Commit.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/Commit.java
Wed Aug 21 13:39:48 2013
@@ -83,7 +83,7 @@ public class Commit {
         UpdateOp op = operations.get(path);
         if (op == null) {
             String id = Utils.getIdFromPath(path);
-            op = new UpdateOp(path, id, false);
+            op = new UpdateOp(id, false);
             NodeDocument.setModified(op, revision);
             operations.put(path, op);
         }
@@ -321,17 +321,17 @@ public class Commit {
             if (newestRev == null) {
                 if (op.isDelete || !op.isNew) {
                     conflictMessage = "The node " + 
-                            op.path + " does not exist or is already deleted";
+                            op.getKey() + " does not exist or is already deleted";
                 }
             } else {
                 if (op.isNew) {
                     conflictMessage = "The node " + 
-                            op.path + " was already added in revision\n" + 
+                            op.getKey() + " was already added in revision\n" +
                             newestRev;
                 } else if (mk.isRevisionNewer(newestRev, baseRevision)
                         && (op.isDelete || isConflicting(doc, op))) {
                     conflictMessage = "The node " + 
-                            op.path + " was changed in revision\n" + newestRev +
+                            op.getKey() + " was changed in revision\n" + newestRev +
                             ", which was applied after the base revision\n" + 
                             baseRevision;
                 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoMK.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoMK.java?rev=1516160&r1=1516159&r2=1516160&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoMK.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoMK.java
Wed Aug 21 13:39:48 2013
@@ -1082,7 +1082,7 @@ public class MongoMK implements MicroKer
 
         String revisionId = stripBranchRevMarker(branchRevisionId);
         // make branch commits visible
-        UpdateOp op = new UpdateOp("/", Utils.getIdFromPath("/"), false);
+        UpdateOp op = new UpdateOp(Utils.getIdFromPath("/"), false);
         Revision revision = Revision.fromString(revisionId);
         Branch b = branches.getBranch(revision);
         Revision mergeCommit = newRevision();

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/Node.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/Node.java?rev=1516160&r1=1516159&r2=1516160&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/Node.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/Node.java
Wed Aug 21 13:39:48 2013
@@ -75,7 +75,7 @@ public class Node implements CacheValue 
      */
     UpdateOp asOperation(boolean isNew) {
         String id = Utils.getIdFromPath(path);
-        UpdateOp op = new UpdateOp(path, id, isNew);
+        UpdateOp op = new UpdateOp(id, isNew);
         op.set(Document.ID, id);
         NodeDocument.setModified(op, rev);
         op.setMapEntry(NodeDocument.DELETED, rev.toString(), "false");

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/NodeDocument.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/NodeDocument.java?rev=1516160&r1=1516159&r2=1516160&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/NodeDocument.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/NodeDocument.java
Wed Aug 21 13:39:48 2013
@@ -500,9 +500,9 @@ public class NodeDocument extends Docume
         } else {
             previous++;
         }
-        UpdateOp old = new UpdateOp(path, id + "/" + previous, true);
+        UpdateOp old = new UpdateOp(id + "/" + previous, true);
         setModified(old, commitRevision);
-        UpdateOp main = new UpdateOp(path, id, false);
+        UpdateOp main = new UpdateOp(id, false);
         setModified(main, commitRevision);
         main.set(NodeDocument.PREVIOUS, previous);
         for (Map.Entry<String, Object> e : data.entrySet()) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/UpdateOp.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/UpdateOp.java?rev=1516160&r1=1516159&r2=1516160&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/UpdateOp.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/UpdateOp.java
Wed Aug 21 13:39:48 2013
@@ -21,12 +21,10 @@ import java.util.Map.Entry;
 import java.util.TreeMap;
 
 /**
- * A MongoDB "update" operation for one node.
+ * A MongoDB "update" operation for one document.
  */
 public class UpdateOp {
 
-    final String path;
-    
     final String key;
     
     final boolean isNew;
@@ -37,21 +35,15 @@ public class UpdateOp {
     /**
      * Create an update operation for the given document. The commit root is assumed
      * to be the path, unless this is changed later on.
-     * 
-     * @param path the node path (for nodes)
+     *
      * @param key the primary key
      * @param isNew whether this is a new document
      */
-    UpdateOp(String path, String key, boolean isNew) {
-        this.path = path;
+    UpdateOp(String key, boolean isNew) {
         this.key = key;
         this.isNew = isNew;
     }
     
-    String getPath() {
-        return path;
-    }
-    
     String getKey() {
         return key;
     }
@@ -182,7 +174,7 @@ public class UpdateOp {
     }
     
     public UpdateOp getReverseOperation() {
-        UpdateOp reverse = new UpdateOp(path, key, isNew);
+        UpdateOp reverse = new UpdateOp(key, isNew);
         for (Entry<String, Operation> e : changes.entrySet()) {
             Operation r = e.getValue().getReverse();
             if (r != null) {

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoDocumentStoreTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoDocumentStoreTest.java?rev=1516160&r1=1516159&r2=1516160&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoDocumentStoreTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoDocumentStoreTest.java
Wed Aug 21 13:39:48 2013
@@ -77,7 +77,7 @@ public class MongoDocumentStoreTest {
     public void addGetAndRemove() throws Exception {
         DocumentStore docStore = openDocumentStore();
 
-        UpdateOp updateOp = new UpdateOp("/", "/", true);
+        UpdateOp updateOp = new UpdateOp("/", true);
         updateOp.setMapEntry("property1", "key1", "value1");
         updateOp.increment("property2", 1);
         updateOp.set("property3", "value3");
@@ -106,7 +106,7 @@ public class MongoDocumentStoreTest {
         List<UpdateOp> updateOps = new ArrayList<UpdateOp>();
         for (int i = 0; i < nUpdates; i++) {
             String path = "/node" + i;
-            UpdateOp updateOp = new UpdateOp(path, path, true);
+            UpdateOp updateOp = new UpdateOp(path, true);
             updateOp.set(Document.ID, "/node" + i);
             updateOp.setMapEntry("property1", "key1", "value1");
             updateOp.increment("property2", 1);
@@ -144,17 +144,17 @@ public class MongoDocumentStoreTest {
     @Test
     public void containsMapEntry() {
         DocumentStore docStore = openDocumentStore();
-        UpdateOp op = new UpdateOp("/node", "/node", true);
+        UpdateOp op = new UpdateOp("/node", true);
         op.setMapEntry("map", "key", "value");
         docStore.createOrUpdate(Collection.NODES, op);
 
-        op = new UpdateOp("/node", "/node", false);
+        op = new UpdateOp("/node", false);
         op.set("prop", "value");
         op.containsMapEntry("map", "unknown-key", true);
         // update if unknown-key exists -> must not succeed
         assertNull(docStore.findAndUpdate(Collection.NODES, op));
 
-        op = new UpdateOp("/node", "/node", false);
+        op = new UpdateOp("/node", false);
         op.set("prop", "value");
         op.containsMapEntry("map", "key", true);
         // update if key exists -> must succeed
@@ -165,7 +165,7 @@ public class MongoDocumentStoreTest {
         assertNotNull(doc.get("prop"));
         assertEquals("value", doc.get("prop"));
 
-        op = new UpdateOp("/node", "/node", false);
+        op = new UpdateOp("/node", false);
         op.set("prop", "other");
         op.containsMapEntry("map", "key", false);
         // update if key does not exist -> must not succeed
@@ -266,7 +266,7 @@ public class MongoDocumentStoreTest {
         private void addNodes() {
             for (int i = 0; i < nNodes; i++) {
                 String path = "/" + nodeName + i;
-                UpdateOp updateOp = new UpdateOp(path, path, true);
+                UpdateOp updateOp = new UpdateOp(path, true);
                 updateOp.setMapEntry("property1", "key1", "value1");
                 updateOp.set("property3", "value3");
                 docStore.createOrUpdate(Collection.NODES, updateOp);
@@ -276,7 +276,7 @@ public class MongoDocumentStoreTest {
         private void updateNodes() {
             for (int i = 0; i < nNodes; i++) {
                 String path = "/" + nodeName + i;
-                UpdateOp updateOp = new UpdateOp(path, path, false);
+                UpdateOp updateOp = new UpdateOp(path, false);
                 updateOp.setMapEntry("property1", "key2", "value2");
                 updateOp.set("property4", "value4");
                 docStore.createOrUpdate(Collection.NODES, updateOp);



Mime
View raw message