[ https://issues.apache.org/jira/browse/OAK-12404 ]


    Julian Reschke deleted comment on OAK-12404:
    --------------------------------------

was (Author: reschke):
[~jsedding] - adjusted the fixVersion to 2.10.0.

> CompactionWriter.flush() persists partial writer before target writer
> ---------------------------------------------------------------------
>
>                 Key: OAK-12404
>                 URL: https://issues.apache.org/jira/browse/OAK-12404
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: segment-tar
>    Affects Versions: 2.6.0
>            Reporter: Julian Sedding
>            Assignee: Julian Sedding
>            Priority: Minor
>             Fix For: 2.10.0
>
>
> A partially compacted node references the fully compacted nodes below it, so 
> this persists a segment before the segment it depends on. Two consequences:
> * The head's segment becomes durable before the records it references. The 
> journal is written after both flushes (TarRevisions.doFlush), so a plain 
> crash is not corrupting, but the ordering invariant is inverted.
> * {{DefaultCleanupContext.isDanglingFutureSegment}} assumes compacted 
> segments are unused iff they are persisted after the last compacted root, and 
> reclaims them without checking reachability. After a soft-cancelled 
> compaction the compacted root is the partial root, so the target segment 
> flushed afterwards is reclaimed while still reachable from the head.
> Only observable with soft cancellation; otherwise the partial writer has 
> nothing buffered. {{AbstractGarbageCollectionStrategy}} currently supplies 
> no-op soft cancellers, so this is not reachable from production GC today, but 
> must be fixed before partial compaction is enabled.
> Reproduction: {{CompactionWriterFlushOrderTest}} (see linked PR) drives a 
> {{ClassicCompactor}} with a soft canceller and asserts that the segment 
> holding the compacted root references no segment persisted after it. Fails on 
> trunk with:
> {noformat}
> the segment holding the compacted root 2156cdbf-... 
> (GCGeneration{generation=0, fullGeneration=0, isCompacted=true}) references 1 
> segment(s) that are only persisted after it: [5fc4f9d2-... 
> GCGeneration{generation=1, fullGeneration=1, isCompacted=true}]
> {noformat}
> Fix: flush in reference order.
> {code:java}
> public void flush() throws IOException {
>     targetWriter.flush();
>     partialWriter.flush();
> }
> {code}



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to