[
https://issues.apache.org/jira/browse/OAK-12531?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Rishabh Daim resolved OAK-12531.
--------------------------------
Fix Version/s: 2.10.0
Resolution: Fixed
> Full GC commit-root cleanup loses cross-cluster child visibility
> ----------------------------------------------------------------
>
> Key: OAK-12531
> URL: https://issues.apache.org/jira/browse/OAK-12531
> Project: Jackrabbit Oak
> Issue Type: Bug
> Components: documentmk
> Affects Versions: 1.84.0, 2.8.0
> Reporter: Rishabh Daim
> Assignee: Rishabh Daim
> Priority: Major
> Fix For: 2.10.0
>
>
> Full GC can remove commit metadata still needed to reconstruct a node's child
> view. With embedded verification enabled, cleanup is rejected even though
> current user-property values are unchanged. Without verification, the same
> cleanup can hide children.
> h3. Affected behavior
> Reproduced with oak-run 1.84.0 and the unmodified 2.8.0 release using Full GC
> mode 6 (ORPHANS_EMPTYPROPS_KEEP_ONE_ALL_PROPS), dryRun=true and verify=true.
> Also reproduced by a synthetic regression on trunk at
> {{3e918022228f81da0cd740dfa7cd677cd7ba4c55}}.
> The warning is {{removeGarbage.verify : verifyViaTraversedState failed}}.
> Candidate revision counts are reported, but the rejected document is not
> updated.
> h3. Cause
> {{NodeDocument.createLastRevs()}} derives per-cluster modification revisions
> from both {{_lastRev}} and local {{_revisions}}/{{_commitRoot}} metadata.
> {{collectUnusedInternalPropertyRevisions()}} can remove a cluster's latest
> committed {{_commitRoot}} entry when no retained property value references
> it. If persisted {{_lastRev}} does not cover that cluster's changes, the
> computed {{DocumentNodeState.getLastRevision()}} vector regresses and
> descendant reads lose visibility.
> Dry-run instrumentation confirmed that the original document reconstructed
> directly matches traversal. Simulated cleanup leaves the current property
> unchanged but changes the computed revision vector and child enumeration.
> Restoring only {{_commitRoot}} entries on an in-memory copy restores full
> state equality, without restoring obsolete user-property history.
> h3. Synthetic reproduction
> # Share a fresh {{MemoryDocumentStore}} between {{DocumentNodeStore}} cluster
> IDs 1 and 2, using a virtual clock and disabled background scheduling.
> # From cluster 1, create {{/parent}} and {{/other}} in one commit.
> # From cluster 1, update a property on both nodes and create
> {{/parent/firstChild}}. Commit another property update on both nodes.
> Updating both paths ensures commit roots reside on the repository root rather
> than the parent.
> # Flush background operations and synchronize cluster 2. From cluster 2,
> overwrite the same property on both nodes and create {{/parent/secondChild}}.
> Flush and synchronize cluster 1.
> # On the synthetic parent document only, remove cluster 1's persisted
> {{_lastRev}} map entry. Its committed {{_commitRoot}} history still supplies
> that cluster's latest revision, so both children remain visible before GC.
> # Add a newer, uncommitted property/commit-root entry to exercise skipping
> uncommitted revisions when determining what metadata to retain.
> # Advance the clock by two hours. Run Full GC mode 6 with a one-hour
> retention window, scoped to {{/parent}}.
> # With verification enabled, assert cleanup is accepted and obsolete property
> history is pruned. Repeat as a verified dry-run. With verification disabled,
> assert both children, full node-state equality, and the original computed
> revision vector remain intact.
> Before the fix, all three configurations fail: normal and dry-run
> verification reject the parent, while unverified cleanup regresses the
> revision vector and child view.
> h3. Fix and regression
> The local fix retains the newest committed {{_commitRoot}} entry per cluster
> when collecting unused internal property revisions. Older entries remain
> eligible for collection; a newer uncommitted entry does not replace the
> required committed one. No {{_lastRev}} rewrite or verification bypass is
> introduced.
> {{FullGCRevisionRetentionTest}} contains the three parameterized synthetic
> cases. Run with:
> {code}
> mvn -pl oak-store-document -Dtest=FullGCRevisionRetentionTest test
> {code}
> No production document, identifiers, connection details, or raw data are
> included.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)