Miroslav Smiljanic created OAK-12516:
----------------------------------------

             Summary: SegmentStoreMigrator silently skips missing binary 
references producing a TAR archive that fails with "Unrecognized magic number"
                 Key: OAK-12516
                 URL: https://issues.apache.org/jira/browse/OAK-12516
             Project: Jackrabbit Oak
          Issue Type: Bug
          Components: segment-aws, segment-azure, segment-tar
            Reporter: Miroslav Smiljanic


For remote segment stores (Azure, AWS) the binary references file 
({{{}<archive>.brf{}}}) of an archive can be missing:
 * the archive is still open (it is the archive currently being written to), or
 * the Oak process terminated before the archive was closed.

In both cases {{SegmentArchiveReader.getBinaryReferences()}} returns 
{{{}null{}}}, which the interface allows ({{{}@Nullable{}}}).

{{SegmentStoreMigrator.migrateBinaryRef}} skips the missing binary references 
without any warning, and the archive is migrated without a {{.brf}} entry. When 
the target is a TAR store, reading the binary references of that archive with 
{{org.apache.jackrabbit.oak.segment.file.tar.SegmentTarReader}} fails with:
{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}
{{SegmentTarReader}} assumes the {{.brf}} entry is always present right before 
the graph entry. When it is missing, it reads the end of the last segment 
instead. The error looks like data corruption, but the segments are intact.

 



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

Reply via email to