[
https://issues.apache.org/jira/browse/OAK-12527?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Miroslav Smiljanic updated OAK-12527:
-------------------------------------
Description:
{{SegmentArchiveReader.getBinaryReferences()}} may return {{null}} when an
archive has no binary references. The remote readers (Azure, AWS) do that when
the {{.brf}} file is missing.
{{SegmentTarReader.getBinaryReferences()}} is declared {{{}@NotNull{}}}. It
doesn't check whether the archive has a {{.brf}} entry; it computes where the
entry should end from the sizes of the index and graph entries and reads from
there. When the entry is missing (e.g. a TAR archive written by
{{SegmentStoreMigrator}} before OAK-12516), it reads the end of the last
segment and fails with:
{noformat}
java.io.IOException:
org.apache.jackrabbit.oak.segment.file.tar.binaries.InvalidBinaryReferencesIndexException:
Unrecognized magic number
{noformat}
A {{.brf}} entry with a corrupt magic number fails with the same exception, so
callers can't tell a missing entry from a corrupt one.
The archive layout distinguishes the two cases. After the segments, a TAR
archive contains the {{{}.brf{}}}, {{.gph}} and {{.idx}} entries, in this
order, each with a header containing its name.
> SegmentTarReader cannot distinguish a missing from a corrupt binary
> references entry
> ------------------------------------------------------------------------------------
>
> Key: OAK-12527
> URL: https://issues.apache.org/jira/browse/OAK-12527
> Project: Jackrabbit Oak
> Issue Type: Improvement
> Components: segment-tar
> Reporter: Miroslav Smiljanic
> Assignee: Miroslav Smiljanic
> Priority: Major
>
> {{SegmentArchiveReader.getBinaryReferences()}} may return {{null}} when an
> archive has no binary references. The remote readers (Azure, AWS) do that
> when the {{.brf}} file is missing.
> {{SegmentTarReader.getBinaryReferences()}} is declared {{{}@NotNull{}}}. It
> doesn't check whether the archive has a {{.brf}} entry; it computes where the
> entry should end from the sizes of the index and graph entries and reads from
> there. When the entry is missing (e.g. a TAR archive written by
> {{SegmentStoreMigrator}} before OAK-12516), it reads the end of the last
> segment and fails with:
> {noformat}
> java.io.IOException:
> org.apache.jackrabbit.oak.segment.file.tar.binaries.InvalidBinaryReferencesIndexException:
> Unrecognized magic number
> {noformat}
> A {{.brf}} entry with a corrupt magic number fails with the same exception,
> so callers can't tell a missing entry from a corrupt one.
> The archive layout distinguishes the two cases. After the segments, a TAR
> archive contains the {{{}.brf{}}}, {{.gph}} and {{.idx}} entries, in this
> order, each with a header containing its name.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)