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

Miroslav Smiljanic resolved OAK-12533.
--------------------------------------
    Fix Version/s: 2.10.0
       Resolution: Fixed

> Missing binary references (.brf) of segment archives are lost by data store 
> GC, compaction cleanup and SegmentStoreMigrator
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: OAK-12533
>                 URL: https://issues.apache.org/jira/browse/OAK-12533
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: segment-tar
>            Reporter: Miroslav Smiljanic
>            Assignee: Miroslav Smiljanic
>            Priority: Major
>             Fix For: 2.10.0
>
>
> When an archive of a segment store has no binary references entry ({{.brf}}), 
> or the entry can't be read, {{TarReader.getBinaryReferences()}} and 
> {{SegmentArchiveReader.getBinaryReferences()}} return {{null}} (see 
> OAK-12527). The operations that use the binary references of an archive then 
> lose them:
>  * *Data store GC*: {{TarReader.collectBlobReferences}} returns without 
> reporting any reference for that archive. The mark phase misses the binaries 
> referenced only from it, and the sweep can delete binaries that are still in 
> use.
>  * *Compaction cleanup*: when {{TarReader.sweep}} rewrites such an archive, 
> it copies no binary references, and {{TarWriter}} writes an empty {{.brf}} 
> into the new archive. The references are lost permanently, and later data 
> store GC runs read the empty entry without any warning.
>  * *Segment store migration*: {{SegmentStoreMigrator}} (Azure) and 
> {{AwsSegmentStoreMigrator}} skip the missing binary references silently, and 
> the archive is migrated without a {{.brf}} entry. When the target is a TAR 
> store, reading the binary references of that archive failed with the 
> following error, which looks like data corruption although the segments are 
> intact:
> {noformat}
> java.io.IOException: 
> org.apache.jackrabbit.oak.segment.file.tar.binaries.InvalidBinaryReferencesIndexException:
>  Unrecognized magic number
>     at 
> org.apache.jackrabbit.oak.segment.file.tar.SegmentTarReader.getBinaryReferences(SegmentTarReader.java:147)
> {noformat}
> Since OAK-12527 the missing entry is reported as {{null}}, so the migrated 
> archive is affected by the data store GC and cleanup problems above.
> An archive can have no usable {{.brf}} when:
>  * a remote archive (Azure, AWS) is still open, or the Oak process terminated 
> before closing it, because its binary references are written only when it is 
> closed;
>  * a TAR archive was written without it, e.g. by {{SegmentStoreMigrator}} 
> from such a remote archive;
>  * the entry is corrupt.
> TAR recovery doesn't cover this case, because it only runs for archives 
> without a valid index.
> *Fix*: recover the binary references from the segments of the archive with 
> the store's {{TarRecovery}} when the {{.brf}} entry is missing or can't be 
> read:
>  * data store GC collects the recovered references;
>  * compaction cleanup writes the recovered references of the remaining 
> segments into the rewritten archive;
>  * the migrators recover them with a read-only store of the source, so the 
> source is never modified, and always write a {{.brf}} into the target archive.



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

Reply via email to