mreutegg commented on code in PR #920:
URL: https://github.com/apache/jackrabbit-oak/pull/920#discussion_r1206734138


##########
oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoDocumentStoreIT.java:
##########
@@ -268,4 +277,109 @@ public void queryWithNullProjection() {
         docs.forEach(d -> assertEquals(4 , d.keySet().size()));
         assertEquals(10, docs.size());
     }
+
+    // OAK-10213
+    @Test
+    public void findAndUpdateBulk() {
+        DocumentStore docStore = mk.getDocumentStore();
+        DocumentNodeStore store = 
builderProvider.newBuilder().setAsyncDelay(0).getNodeStore();
+        Revision rev = Revision.newRevision(0);
+        List<UpdateOp> inserts = new ArrayList<UpdateOp>();
+        for (int i = 0; i < 10; i++) {
+            DocumentNodeState n = new DocumentNodeState(store, 
fromString("/node-" + i),
+                    new RevisionVector(rev), of(new LongPropertyState("prop", 
10L)), false, null);
+            inserts.add(n.asOperation(rev));
+        }
+        docStore.create(Collection.NODES, inserts);
+
+        List<UpdateOp> updateOps = new ArrayList<>(10);
+        for (int i = 0; i < 10; i++) {
+            UpdateOp updateOp = new UpdateOp(getIdFromPath(fromString("/node-" 
+ i)), false);
+            updateOp.set("prop", 20L);
+            updateOp.contains("prop", true);

Review Comment:
   This is a rather unusual and a bit confusing. The test setup above create a 
revision based property 'prop', whereas this update here sets a top level 
property 'prop' without a revision. These UpdateOps replace the 'prop' sub 
document with the initial revision with a field of the same name. This is not 
something the DocumentNodeStore ever does. I think it would be more realistic 
to update the document with an additional revision in the 'prop' sub document.



##########
oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoDocumentStoreIT.java:
##########
@@ -268,4 +277,109 @@ public void queryWithNullProjection() {
         docs.forEach(d -> assertEquals(4 , d.keySet().size()));
         assertEquals(10, docs.size());
     }
+
+    // OAK-10213
+    @Test
+    public void findAndUpdateBulk() {
+        DocumentStore docStore = mk.getDocumentStore();
+        DocumentNodeStore store = 
builderProvider.newBuilder().setAsyncDelay(0).getNodeStore();
+        Revision rev = Revision.newRevision(0);
+        List<UpdateOp> inserts = new ArrayList<UpdateOp>();
+        for (int i = 0; i < 10; i++) {
+            DocumentNodeState n = new DocumentNodeState(store, 
fromString("/node-" + i),
+                    new RevisionVector(rev), of(new LongPropertyState("prop", 
10L)), false, null);
+            inserts.add(n.asOperation(rev));
+        }
+        docStore.create(Collection.NODES, inserts);
+
+        List<UpdateOp> updateOps = new ArrayList<>(10);
+        for (int i = 0; i < 10; i++) {
+            UpdateOp updateOp = new UpdateOp(getIdFromPath(fromString("/node-" 
+ i)), false);
+            updateOp.set("prop", 20L);
+            updateOp.contains("prop", true);
+            updateOps.add(updateOp);
+        }

Review Comment:
   ```suggestion
           Revision updateRev = Revision.newRevision(0);
           for (int i = 0; i < 10; i++) {
               UpdateOp updateOp = new 
UpdateOp(getIdFromPath(fromString("/node-" + i)), false);
               updateOp.setMapEntry("prop", updateRev, "20");
               updateOps.add(updateOp);
           }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to