rishabhdaim commented on code in PR #1422: URL: https://github.com/apache/jackrabbit-oak/pull/1422#discussion_r1567245847
########## oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollector.java: ########## @@ -1216,34 +1220,27 @@ private boolean isDeletedOrOrphanedNode(final NodeState traversedState, phases.stop(GCPhase.DETAILED_GC_COLLECT_ORPHAN_NODES); return false; } - if (detailedGcMode == DetailedGCMode.GAP_ORPHANS - || detailedGcMode == DetailedGCMode.GAP_ORPHANS_EMPTYPROPS) { + if (detailedGcMode == DetailedGCMode.GAP_ORPHANS || detailedGcMode == DetailedGCMode.GAP_ORPHANS_EMPTYPROPS) { // check the ancestor docs for gaps final Path docPath = doc.getPath(); - final Path geaPath = greatestExistingAncestorOrSelf; - final Path geaChildPath = docPath - .getAncestor(docPath.getDepth() - geaPath.getDepth() - 1); + final Path geaChildPath = docPath.getAncestor(docPath.getDepth() - greatestExistingAncestorOrSelf.getDepth() - 1); Boolean missingType = missingDocsTypes.get(geaChildPath); if (missingType == null) { // we don't have it cached yet - so do the potentially expensive find - final NodeDocument d = nodeStore.getDocumentStore().find(NODES, - Utils.getIdFromPath(geaChildPath)); - final boolean parentDocExists = d != null; - missingType = !parentDocExists; + missingType = versionStore.getDocument(getIdFromPath(geaChildPath), of(ID)).isEmpty(); if (missingDocsTypes.size() > DETAILED_GC_MISSING_DOCS_TYPE_CACHE_SIZE) { final Iterator<Path> it = missingDocsTypes.keySet().iterator(); it.next(); it.remove(); if (missingDocsTypes.size() > DETAILED_GC_MISSING_DOCS_TYPE_CACHE_SIZE) { // should never really happen, if it does: clear all, break out - log.error("isDeletedOrOrphanedNode : knownNullDocs removal failed, size was {}", - missingDocsTypes.size()); + log.error("isDeletedOrOrphanedNode : knownNullDocs removal failed, size was {}", missingDocsTypes.size()); missingDocsTypes.clear(); } } missingDocsTypes.put(geaChildPath, missingType); } - if (missingType == false) { + if (!missingType) { Review Comment: missingType can't be null here, `null` is handled in the above code. Again suggestion by intelliJ -- 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