jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1450247 - in /jackrabbit/oak/trunk/oak-mongomk/src: main/java/org/apache/jackrabbit/mongomk/prototype/ test/java/org/apache/jackrabbit/mongomk/prototype/
Date Tue, 26 Feb 2013 16:07:08 GMT
Author: thomasm
Date: Tue Feb 26 16:07:08 2013
New Revision: 1450247

URL: http://svn.apache.org/r1450247
Log:
OAK-619 Lock-free MongoMK implementation (move old revisions into a separate document)

Modified:
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/Commit.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MemoryDocumentStore.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoDocumentStore.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoMK.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/Node.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/UpdateOp.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/Utils.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/prototype/MongoDocumentStoreTest.java

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/Commit.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/Commit.java?rev=1450247&r1=1450246&r2=1450247&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/Commit.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/Commit.java
Tue Feb 26 16:07:08 2013
@@ -20,6 +20,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
+import java.util.Map.Entry;
 
 import org.apache.jackrabbit.mk.api.MicroKernelException;
 import org.apache.jackrabbit.mk.json.JsopStream;
@@ -32,6 +33,9 @@ import org.apache.jackrabbit.oak.commons
  */
 public class Commit {
     
+    // TODO too small
+    private static final int MAX_MAP_SIZE = 16 * 1024;
+    
     private final MongoMK mk;
     private final Revision revision;
     private HashMap<String, UpdateOp> operations = new HashMap<String, UpdateOp>();
@@ -72,9 +76,9 @@ public class Commit {
     
     void updateProperty(String path, String propertyName, String value) {
         UpdateOp op = getUpdateOperationForNode(path);
-        op.addMapEntry(propertyName, revision.toString(), value);
+        op.addMapEntry(propertyName + "." + revision.toString(), value);
         long increment = mk.getWriteCountIncrement(path);
-        op.increment("_writeCount", 1 + increment);
+        op.increment(UpdateOp.WRITE_COUNT, 1 + increment);
     }
 
     void addNode(Node n) {
@@ -137,8 +141,8 @@ public class Commit {
         }
         if (root != null) {
             long increment = mk.getWriteCountIncrement(commitRoot);
-            root.increment("_writeCount", 1 + increment);
-            root.addMapEntry("_revisions", revision.toString(), "true");
+            root.increment(UpdateOp.WRITE_COUNT, 1 + increment);
+            root.addMapEntry(UpdateOp.REVISIONS + "." + revision.toString(), "true");
             createOrUpdateNode(store, root);
             operations.put(commitRoot, root);
         }
@@ -146,8 +150,20 @@ public class Commit {
     
     private void createOrUpdateNode(DocumentStore store, UpdateOp op) {
         Map<String, Object> map = store.createOrUpdate(Collection.NODES, op);
+        int size = Utils.getMapSize(map);
+        if (size > MAX_MAP_SIZE) {
+            UpdateOp[] split = splitDocument(map);
+            
+            // TODO check if the new main document is actually smaller;
+            // otherwise, splitting doesn't make sense
+            
+            // the old version
+            store.createOrUpdate(Collection.NODES, split[0]);
+            // the (shrunken) main document
+            store.createOrUpdate(Collection.NODES, split[1]);
+        }
         // TODO detect conflicts here
-        Long count = (Long) map.get("_writeCount");
+        Long count = (Long) map.get(UpdateOp.WRITE_COUNT);
         if (count == null) {
             count = 0L;
         }
@@ -155,6 +171,56 @@ public class Commit {
         writeCounts.put(path, count);
     }
     
+    private UpdateOp[] splitDocument(Map<String, Object> map) {
+        String path = (String) map.get(UpdateOp.PATH);
+        String id = (String) map.get(UpdateOp.ID);
+        Long previous = (Long) map.get(UpdateOp.PREVIOUS);
+        if (previous == null) {
+            previous = 0L;
+        } else {
+            previous++;
+        }
+        UpdateOp old = new UpdateOp(path, id + "/" + previous, true);
+        UpdateOp main = new UpdateOp(path, id, false);
+        main.set(UpdateOp.PREVIOUS, previous);
+        for (Entry<String, Object> e : map.entrySet()) {
+            String key = e.getKey();
+            if (key.equals(UpdateOp.PATH)) {
+                // ok
+            } else if (key.equals(UpdateOp.ID)) {
+                // ok
+            } else if (key.equals(UpdateOp.PREVIOUS)) {
+                // ok
+            } else if (key.equals(UpdateOp.WRITE_COUNT)) {
+                // only maintain the write count on the main document
+                main.set(UpdateOp.WRITE_COUNT, e.getValue());
+            } else {
+                // UpdateOp.DELETED,
+                // UpdateOp.REVISIONS,
+                // and regular properties
+                @SuppressWarnings("unchecked")
+                Map<String, Object> valueMap = (Map<String, Object>) e.getValue();
+                Revision latestRev = null;
+                for (String r : valueMap.keySet()) {
+                    Revision propRev = Revision.fromString(r);
+                    if (latestRev == null || mk.isRevisionNewer(propRev, latestRev)) {
+                        latestRev = propRev;
+                    }
+                }
+                for (String r : valueMap.keySet()) {
+                    Revision propRev = Revision.fromString(r);
+                    Object v = valueMap.get(r);
+                    if (propRev.equals(latestRev)) {
+                        main.setMapEntry(key + "." + propRev.toString(), v);
+                    } else {
+                        old.addMapEntry(key + "." + propRev.toString(), v);
+                    }
+                }
+            }
+        }
+        return new UpdateOp[]{old, main};
+    }
+
     /**
      * Apply the changes to the MongoMK (to update the cache).
      */
@@ -198,7 +264,7 @@ public class Commit {
                     writeCountInc++;
                     String id = Node.convertPathToDocumentId(path);
                     Map<String, Object> map = mk.getDocumentStore().find(Collection.NODES,
id);
-                    Long oldWriteCount = (Long) map.get("_writeCount");
+                    Long oldWriteCount = (Long) map.get(UpdateOp.WRITE_COUNT);
                     writeCount = oldWriteCount == null ? 0 : oldWriteCount;
                 }
             }
@@ -238,9 +304,9 @@ public class Commit {
     public void removeNode(String path) {
         removedNodes.add(path);
         UpdateOp op = getUpdateOperationForNode(path);
-        op.addMapEntry("_deleted", revision.toString(), "true");
+        op.addMapEntry(UpdateOp.DELETED + "." + revision.toString(), "true");
         long increment = mk.getWriteCountIncrement(path);
-        op.increment("_writeCount", 1 + increment);
+        op.increment(UpdateOp.WRITE_COUNT, 1 + increment);
     }
 
 }

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MemoryDocumentStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MemoryDocumentStore.java?rev=1450247&r1=1450246&r2=1450247&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MemoryDocumentStore.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MemoryDocumentStore.java
Tue Feb 26 16:07:08 2013
@@ -131,7 +131,7 @@ public class MemoryDocumentStore impleme
     public static void applyChanges(Map<String, Object> target, UpdateOp update) {
         for (Entry<String, Operation> e : update.changes.entrySet()) {
             String k = e.getKey();
-            Object old = target.get(k);
+            String[] kv = k.split("\\.");
             Operation op = e.getValue();
             switch (op.type) {
             case SET: {
@@ -139,6 +139,7 @@ public class MemoryDocumentStore impleme
                 break;
             }
             case INCREMENT: {
+                Object old = target.get(k);
                 Long x = (Long) op.value;
                 if (old == null) {
                     old = 0L;
@@ -147,23 +148,30 @@ public class MemoryDocumentStore impleme
                 break;
             }
             case ADD_MAP_ENTRY: {
+                Object old = target.get(kv[0]);
                 @SuppressWarnings("unchecked")
                 Map<String, String> m = (Map<String, String>) old;
                 if (m == null) {
                     m = Utils.newMap();
-                    target.put(k, m);
+                    target.put(kv[0], m);
                 }
-                m.put(op.subKey.toString(), op.value.toString());
+                m.put(kv[1], op.value.toString());
                 break;
             }
             case REMOVE_MAP_ENTRY: {
+                Object old = target.get(kv[0]);
                 @SuppressWarnings("unchecked")
                 Map<String, String> m = (Map<String, String>) old;
                 if (m != null) {
-                    m.remove(op.subKey.toString());
+                    m.remove(kv[1]);
                 }
                 break;
             }
+            case SET_MAP_ENTRY: {
+                Map<String, String> m = Utils.newMap();
+                target.put(k, m);
+                break;
+            }
             }
         }
     }

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoDocumentStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoDocumentStore.java?rev=1450247&r1=1450246&r2=1450247&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoDocumentStore.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoDocumentStore.java
Tue Feb 26 16:07:08 2013
@@ -39,8 +39,6 @@ import com.mongodb.WriteResult;
  * A document store that uses MongoDB as the backend.
  */
 public class MongoDocumentStore implements DocumentStore {
-
-    public static final String KEY_PATH = "_id";
     
     private static final boolean LOG = false;
     private static final boolean LOG_TIME = true;
@@ -105,7 +103,7 @@ public class MongoDocumentStore implemen
             String fromKey, String toKey, int limit) {
         log("query", fromKey, toKey, limit);
         DBCollection dbCollection = getDBCollection(collection);
-        QueryBuilder queryBuilder = QueryBuilder.start(KEY_PATH);
+        QueryBuilder queryBuilder = QueryBuilder.start(UpdateOp.ID);
         queryBuilder.greaterThanEquals(fromKey);
         queryBuilder.lessThan(toKey);
         DBObject query = queryBuilder.get();
@@ -116,7 +114,7 @@ public class MongoDocumentStore implemen
             for (int i = 0; i < limit && cursor.hasNext(); i++) {
                 DBObject o = cursor.next();
                 Map<String, Object> map = convertFromDBObject(o);
-                String path = (String) map.get("_id");
+                String path = (String) map.get(UpdateOp.ID);
                 synchronized (cache) {
                     cache.put(path, map);
                 }
@@ -167,13 +165,20 @@ public class MongoDocumentStore implemen
                     break;
                 }
                 case ADD_MAP_ENTRY: {
-                    setUpdates.append(k + "." + op.subKey.toString(), op.value.toString());
+                    setUpdates.append(k, op.value.toString());
                     break;
                 }
                 case REMOVE_MAP_ENTRY: {
                     // TODO
                     break;
                 }
+                case SET_MAP_ENTRY: {
+                    String[] kv = k.split("\\.");
+                    BasicDBObject sub = new BasicDBObject();
+                    sub.put(kv[1], op.value.toString());
+                    setUpdates.append(kv[0], sub);
+                    break;
+                }
             }
         }
 
@@ -196,10 +201,11 @@ public class MongoDocumentStore implemen
                     null /*sort*/, false /*remove*/, update, true /*returnNew*/,
                     true /*upsert*/);
             Map<String, Object> map = convertFromDBObject(oldNode);
-            String path = (String) map.get("_id");
+            String path = (String) map.get(UpdateOp.ID);
             synchronized (cache) {
                 cache.put(path, map);
             }
+            log("createOrUpdate returns ", map);      
             return map;
         } catch (Exception e) {
             throw new MicroKernelException(e);
@@ -232,14 +238,15 @@ public class MongoDocumentStore implemen
                         inserts[i].put(k, op.value);
                         break;
                     }
+                    case SET_MAP_ENTRY:
                     case ADD_MAP_ENTRY: {
-                        DBObject value = new BasicDBObject(op.subKey.toString(), op.value.toString());
-                        inserts[i].put(k, value);
+                        String[] kv = k.split("\\.");
+                        DBObject value = new BasicDBObject(kv[1], op.value.toString());
+                        inserts[i].put(kv[0], value);
                         break;
                     }
                     case REMOVE_MAP_ENTRY: {
-                        // TODO
-                        break;
+                        // nothing to do for new entries
                     }
                 }
             }
@@ -254,7 +261,7 @@ public class MongoDocumentStore implemen
             }
             synchronized (cache) {
                 for (Map<String, Object> map : maps) {
-                    String path = (String) map.get("_id");
+                    String path = (String) map.get(UpdateOp.ID);
                     synchronized (cache) {
                         cache.put(path, map);
                     }
@@ -278,9 +285,14 @@ public class MongoDocumentStore implemen
     private static Map<String, Object> convertFromDBObject(DBObject n) {
         Map<String, Object> copy = Utils.newMap();
         if (n != null) {
-            synchronized (n) {
-                for (String key : n.keySet()) {
-                    copy.put(key, n.get(key));
+            for (String key : n.keySet()) {
+                Object o = n.get(key);
+                if (o instanceof String) {
+                    copy.put(key, o);
+                } else if (o instanceof Long) {
+                    copy.put(key, o);
+                } else if (o instanceof BasicDBObject) {
+                    copy.put(key, o);
                 }
             }
         }
@@ -297,7 +309,7 @@ public class MongoDocumentStore implemen
     }
 
     private static DBObject getByPathQuery(String path) {
-        return QueryBuilder.start(KEY_PATH).is(path).get();
+        return QueryBuilder.start(UpdateOp.ID).is(path).get();
     }
     
     @Override
@@ -310,7 +322,11 @@ public class MongoDocumentStore implemen
     
     private static void log(Object... args) {
         if (LOG) {
-            System.out.println(Arrays.toString(args));
+            String msg = Arrays.toString(args);
+            if (msg.length() > 10000) {
+                msg = msg.length() + ": " + msg;
+            }
+            System.out.println(msg);
         }
     }
 

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoMK.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoMK.java?rev=1450247&r1=1450246&r2=1450247&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoMK.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoMK.java
Tue Feb 26 16:07:08 2013
@@ -211,7 +211,7 @@ public class MongoMK implements MicroKer
         return x.compareRevisionTime(requestRevision) >= 0;
     }
     
-    private boolean isRevisionNewer(Revision x, Revision previous) {
+    boolean isRevisionNewer(Revision x, Revision previous) {
         // TODO currently we only compare the timestamps
         return x.compareRevisionTime(previous) >= 0;
     }
@@ -236,7 +236,7 @@ public class MongoMK implements MicroKer
                 continue;
             }
             // TODO put the whole node in the cache
-            String id = e.get("_id").toString();
+            String id = e.get(UpdateOp.ID).toString();
             String p = id.substring(2);
             c.children.add(p);
         }
@@ -257,7 +257,7 @@ public class MongoMK implements MicroKer
         Long w = writeCountIncrements.get(path);
         long writeCount = w == null ? 0 : w;
         for (String key : map.keySet()) {
-            if (key.equals("_writeCount")) {
+            if (key.equals(UpdateOp.WRITE_COUNT)) {
                 writeCount += (Long) map.get(key);
             }
             if (key.startsWith("_")) {
@@ -508,7 +508,7 @@ public class MongoMK implements MicroKer
     private boolean isDeleted(Map<String, Object> nodeProps, Revision rev) {
         @SuppressWarnings("unchecked")
         Map<String, String> valueMap = (Map<String, String>) nodeProps
-                .get("_deleted");
+                .get(UpdateOp.DELETED);
         if (valueMap != null) {
             for (Map.Entry<String, String> e : valueMap.entrySet()) {
                 // TODO What if multiple revisions are there?. Should we sort
@@ -524,7 +524,7 @@ public class MongoMK implements MicroKer
         }
         return false;
     }
-
+    
     private static String stripBranchRevMarker(String revisionId){
         if(revisionId.startsWith("b")){
             return revisionId.substring(1);

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/Node.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/Node.java?rev=1450247&r1=1450246&r2=1450247&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/Node.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/Node.java
Tue Feb 26 16:07:08 2013
@@ -68,12 +68,9 @@ public class Node {
     UpdateOp asOperation(boolean isNew) {
         String id = convertPathToDocumentId(path);
         UpdateOp op = new UpdateOp(path, id, isNew);
-        op.set("_id", id);
-        if (!isNew) {
-            op.increment("_changeCount", 1L);
-        }
+        op.set(UpdateOp.ID, id);
         for (String p : properties.keySet()) {
-            op.addMapEntry(p, rev.toString(), properties.get(p));
+            op.addMapEntry(p + "." + rev.toString(), properties.get(p));
         }
         return op;
     }
@@ -101,8 +98,9 @@ public class Node {
      */
     private static boolean filter(String key) {
         //TODO We need to move node properties to a sub key
-        //so that all other top level props can be considered as
-        //system generated and handled in a better way
+        // so that all other top level props can be considered as
+        // system generated and handled in a better way,
+        // or escape properties that start with a _
         return key.startsWith("_");
     }
     

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/UpdateOp.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/UpdateOp.java?rev=1450247&r1=1450246&r2=1450247&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/UpdateOp.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/UpdateOp.java
Tue Feb 26 16:07:08 2013
@@ -24,6 +24,13 @@ import java.util.TreeMap;
  */
 public class UpdateOp {
     
+    static final String ID = "_id";
+    static final String PATH = "_path";
+    static final String WRITE_COUNT = "_writeCount";
+    static final String REVISIONS = "_revisions";
+    static final String PREVIOUS = "_prev";
+    static final String DELETED = "_deleted";
+    
     final String path;
     
     final String key;
@@ -61,10 +68,22 @@ public class UpdateOp {
      * @param property the property
      * @param value the value
      */
-    void addMapEntry(String property, String subKey, Object value) {
+    void addMapEntry(String property, Object value) {
         Operation op = new Operation();
         op.type = Operation.Type.ADD_MAP_ENTRY;
-        op.subKey = subKey;
+        op.value = value;
+        changes.put(property, op);
+    }
+    
+    public void removeMapEntry(String property) {
+        Operation op = new Operation();
+        op.type = Operation.Type.REMOVE_MAP_ENTRY;
+        changes.put(property, op);
+    }
+    
+    public void setMapEntry(String property, Object value) {
+        Operation op = new Operation();
+        op.type = Operation.Type.SET_MAP_ENTRY;
         op.value = value;
         changes.put(property, op);
     }
@@ -142,7 +161,14 @@ public class UpdateOp {
               * Remove the sub-key / value pair.
               * The value in the stored node is a map.
               */ 
-             REMOVE_MAP_ENTRY 
+             REMOVE_MAP_ENTRY,
+             
+             /**
+              * Set the sub-key / value pair.
+              * The value in the stored node is a map.
+              */
+             SET_MAP_ENTRY,
+             
          }
              
         
@@ -152,17 +178,12 @@ public class UpdateOp {
         Type type;
         
         /**
-         * The sub-key.
-         */
-        Object subKey;
-        
-        /**
          * The value, if any.
          */
         Object value;
         
         public String toString() {
-            return type + ": " + subKey + " = " + value;
+            return type + " " + value;
         }
         
     }

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/Utils.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/Utils.java?rev=1450247&r1=1450246&r2=1450247&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/Utils.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/Utils.java
Tue Feb 26 16:07:08 2013
@@ -17,6 +17,7 @@
 package org.apache.jackrabbit.mongomk.prototype;
 
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.TreeMap;
 
 /**
@@ -31,5 +32,22 @@ public class Utils {
     static <K, V> Map<K, V> newMap() {
         return new TreeMap<K, V>();
     }
+
+    @SuppressWarnings("unchecked")
+    public static int getMapSize(Map<String, Object> map) {
+        int size = 0;
+        for (Entry<String, Object> e : map.entrySet()) {
+            size += e.getKey().length();
+            Object o = e.getValue();
+            if (o instanceof String) {
+                size += o.toString().length();
+            } else if (o instanceof Long) {
+                size += 8;
+            } else if (o instanceof Map) {
+                size += 8 + getMapSize((Map<String, Object>) o);
+            }
+        }
+        return size;
+    }
     
 }

Modified: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/prototype/MongoDocumentStoreTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/prototype/MongoDocumentStoreTest.java?rev=1450247&r1=1450246&r2=1450247&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/prototype/MongoDocumentStoreTest.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/prototype/MongoDocumentStoreTest.java
Tue Feb 26 16:07:08 2013
@@ -64,7 +64,7 @@ public class MongoDocumentStoreTest {
         DocumentStore docStore = openDocumentStore();
 
         UpdateOp updateOp = new UpdateOp("/", "/", true);
-        updateOp.addMapEntry("property1", "key1", "value1");
+        updateOp.addMapEntry("property1.key1", "value1");
         updateOp.increment("property2", 1);
         updateOp.set("property3", "value3");
         docStore.createOrUpdate(Collection.NODES, updateOp);
@@ -96,8 +96,8 @@ public class MongoDocumentStoreTest {
         for (int i = 0; i < nUpdates; i++) {
             String path = "/node" + i;
             UpdateOp updateOp = new UpdateOp(path, path, true);
-            updateOp.set(MongoDocumentStore.KEY_PATH, "/node" + i);
-            updateOp.addMapEntry("property1", "key1", "value1");
+            updateOp.set(UpdateOp.ID, "/node" + i);
+            updateOp.addMapEntry("property1.key1", "value1");
             updateOp.increment("property2", 1);
             updateOp.set("property3", "value3");
             updateOps.add(updateOp);
@@ -212,7 +212,7 @@ public class MongoDocumentStoreTest {
             for (int i = 0; i < nNodes; i++) {
                 String path = "/" + nodeName + i;
                 UpdateOp updateOp = new UpdateOp(path, path, true);
-                updateOp.addMapEntry("property1", "key1", "value1");
+                updateOp.addMapEntry("property1.key1", "value1");
                 updateOp.set("property3", "value3");
                 docStore.createOrUpdate(Collection.NODES, updateOp);
             }
@@ -222,7 +222,7 @@ public class MongoDocumentStoreTest {
             for (int i = 0; i < nNodes; i++) {
                 String path = "/" + nodeName + i;
                 UpdateOp updateOp = new UpdateOp(path, path, false);
-                updateOp.addMapEntry("property1", "key2", "value2");
+                updateOp.addMapEntry("property1.key2", "value2");
                 updateOp.set("property4", "value4");
                 docStore.createOrUpdate(Collection.NODES, updateOp);
             }



Mime
View raw message