rishabhdaim commented on code in PR #1262: URL: https://github.com/apache/jackrabbit-oak/pull/1262#discussion_r1448750789
########## oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollector.java: ########## @@ -1252,6 +1282,37 @@ public void removeGarbage(final VersionGCStats stats) { delayOnModifications(timer.stop().elapsed(MILLISECONDS), cancel); } } + + private boolean verify(NodeDocument oldDoc, NodeDocument newDoc, UpdateOp update) { + if (oldDoc.entrySet().equals(newDoc.entrySet())) { + return true; + } + // read both nodes at headRevision - with lastRevision with the ownHeadRevision + // (using own's headRevision as we're only interested at the state at headRevision time) + DocumentNodeState oldNS = oldDoc.getNodeAtRevision(nodeStore, headRevision, ownHeadRevision); + DocumentNodeState newNS = newDoc.getNodeAtRevision(nodeStore, headRevision, ownHeadRevision); + if (oldNS == null && newNS == null) { + // both don't exist - fine, that's considered equal + return true; + } else if ((oldNS == null && newNS != null) + || (oldNS != null && newNS == null)) { + // failure : one is deleted/missing, the other not + log.error("removeGarbage.verify : failure in DetailedGC" + + " with id : {}, oldNS exists : {}, newNS exists: {}, update: {}", + oldDoc.getId(), oldNS == null, newNS == null, update); + return false; Review Comment: In this logic if `oldNs` is null then we should ignore and return true. ########## oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollector.java: ########## @@ -1252,6 +1282,37 @@ public void removeGarbage(final VersionGCStats stats) { delayOnModifications(timer.stop().elapsed(MILLISECONDS), cancel); } } + + private boolean verify(NodeDocument oldDoc, NodeDocument newDoc, UpdateOp update) { Review Comment: What I meant is that https://github.com/apache/jackrabbit-oak/pull/1262/files#diff-e47c4905644873320ba8f5ed72096b1c6b2ad3fdec6d51241b27a413c371562aR1297-R1303 In the above code, if `oldNs` is null then we should ignore and return true. -- 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