[
https://issues.apache.org/jira/browse/OAK-12531?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Rishabh Daim updated OAK-12531:
-------------------------------
Component/s: documentmk
Affects Version/s: 1.84.0
2.8.0
Description:
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.
was:
Full GC can propose removing commit metadata that is still needed to
reconstruct a node's child view. With embedded verification enabled, cleanup is
rejected even though the current user-property values are unchanged.
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.
The warning is {{removeGarbage.verify : verifyViaTraversedState failed}}.
Candidate revision counts are reported, but the rejected document is not
updated.
h3. Diagnosis
Local dry-run instrumentation of the exact 2.8.0 verifier isolated the mismatch:
* The original document reconstructed directly matches the state obtained by
traversal.
* Simulated cleanup preserves the current user-property value but removes
historical {{_commitRoot}} entries from multiple cluster IDs.
* The computed {{DocumentNodeState.getLastRevision()}} vector loses cluster
components. The stored {{_lastRev}} map is unchanged.
* Child enumeration through the reconstructed state sees fewer children, so
{{AbstractNodeState.equals}} fails.
* Restoring only the original {{_commitRoot}} entries on an in-memory copy,
while leaving user-property history pruned, restores the complete child view
and full state equality. No persistent data was changed for this diagnosis.
{{NodeDocument.createLastRevs()}} derives per-cluster modification revisions
from both {{_lastRev}} and local {{_revisions}}/{{_commitRoot}} metadata.
Removing entries solely because they no longer support a retained property
value can therefore change the revision vector used for descendant reads.
h3. Regression scenario
# Use a synthetic document store with multiple cluster node IDs.
# Create a parent with children written from different cluster nodes and retain
historical property/commit-root revisions on that parent.
# Arrange for its persisted {{_lastRev}} not to cover every cluster component
needed for the pre-cleanup child view.
# Advance the clock beyond the Full GC retention window and run mode 6 with
embedded verification.
# Assert that cleanup preserves the visible subtree and can complete without
rejecting the parent. Exercise the same scenario with verification disabled to
detect actual visibility changes rather than relying only on the warning.
Expected: Full GC preserves the metadata required for equivalent child reads
while pruning obsolete property revisions.
Actual: the proposed commit-root pruning changes the computed revision vector
and child visibility; verification rejects the update.
A minimal synthetic regression and fix are to be developed on trunk. No
production document, identifiers, connection details, or raw data are included.
> 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
>
> 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)