You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Rishabh Daim (Jira)" <ji...@apache.org> on 2026/09/16 05:17:00 UTC

[jira] [Updated] (OAK-12400) Online revision cleanup can delete referenced segments on a store not written in compaction order (e.g. a promoted cold standby)

     [ https://issues.apache.org/jira/browse/OAK-12400?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rishabh Daim updated OAK-12400:
-------------------------------
    Affects Version/s: 2.6.0

> Online revision cleanup can delete referenced segments on a store not written in compaction order (e.g. a promoted cold standby)
> --------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: OAK-12400
>                 URL: https://issues.apache.org/jira/browse/OAK-12400
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: segment-tar
>    Affects Versions: 2.6.0
>            Reporter: Rishabh Daim
>            Assignee: Rishabh Daim
>            Priority: Critical
>
> {{DefaultCleanupContext.isDanglingFutureSegment}} detects unused (aborted-compaction) segments by
> scan position: during cleanup, TAR entries are marked newest-first and every compacted segment is
> treated as reclaimable until the last compacted root recorded in {{gc.log}} is reached (the
> {{aheadOfRoot}} flag). This assumes segments are physically laid out in compaction write order
> (the compacted root written last).
> That assumption does not hold for a segment store assembled out of compaction order — e.g. a cold
> standby, whose segments are written via {{FileStore.writeSegment}} in sync-arrival order. There the
> recorded compacted root is not the newest segment, so the reverse scan reaches live, head-referenced
> compacted segments while {{aheadOfRoot}} is still true and marks them reclaimable. Online revision
> cleanup then removes referenced segments, and a subsequent read/compaction fails with
> {{SegmentNotFoundException}}.
> h4. Steps to reproduce
> # Promote a cold standby to primary (its segment store was assembled via standby sync).
> # Run online (full) revision cleanup.
> Cleanup removes still-referenced compacted segments; the following compaction throws
> {{SegmentNotFoundException}} while traversing the head. {{oak-run check}} passes immediately before
> cleanup.
> h4. Suggested fix
> Make the dangling-segment test generation-based rather than positional: treat a compacted segment as
> an unused future segment only if its generation is strictly newer than the head generation. This is
> independent of physical segment write order and consistent for all store types.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)