Joscorbe commented on code in PR #1317:
URL: https://github.com/apache/jackrabbit-oak/pull/1317#discussion_r1505968214


##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/Commit.java:
##########
@@ -354,7 +360,27 @@ private void applyToDocumentStore(RevisionVector 
baseBranchRevision)
         boolean commitRootHasChanges = operations.containsKey(commitRootPath);
         for (UpdateOp op : operations.values()) {
             NodeDocument.setCommitRoot(op, revision, commitRootDepth);
+
+            // special case for :childOrder updates
+            if (!previousRevisions.isEmpty()) {
+                boolean removePreviousSetOperations = false;
+                for (Map.Entry<Key, Operation> change : 
op.getChanges().entrySet()) {
+                    if (":childOrder".equals(change.getKey().getName()) && 
Operation.Type.SET_MAP_ENTRY == change.getValue().type) {
+                        // we are setting child order, so we should remove 
previous set operations from the same branch
+                        removePreviousSetOperations= true;
+                    }
+                }
+
+                if (removePreviousSetOperations) {
+                    for (Revision rev : previousRevisions) {
+                        op.removeMapEntry(":childOrder", rev);
+                    }
+                    LOG.debug("edited op is: " + op);

Review Comment:
   I worry if this could result in too many messages if we log as `INFO` level, 
I think it's good as `DEBUG`.



-- 
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: dev-unsubscr...@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to