[
https://issues.apache.org/jira/browse/OAK-12422?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Julian Sedding updated OAK-12422:
---------------------------------
Component/s: (was: segment-aws)
> Optimize archive recovery for oak-segment-azure
> -----------------------------------------------
>
> Key: OAK-12422
> URL: https://issues.apache.org/jira/browse/OAK-12422
> Project: Jackrabbit Oak
> Issue Type: Improvement
> Components: segment-azure, segment-remote, segment-tar
> Affects Versions: 2.6.0
> Reporter: Julian Sedding
> Assignee: Julian Sedding
> Priority: Major
>
> The segment archive recovery process was originally designed for
> {{oak-segment-tar}}, where an archive is a single TAR file.
> The current recovery orchestration is roughly:
> # scan the damaged archive and collect the recoverable segments
> # back up the damaged archive (i.e. write to {{*.bak}} archive)
> # create a writer for an archive with the original name
> # pass every recovered segment to the writer
> # close the writer, thereby writing binary references, segment graph and index
> For local TAR persistence, backing up the archive is normally a filesystem
> rename and rewriting the segments is necessary because the original TAR file
> was moved away.
> Remote persistence has a different layout: an archive is a directory-like
> prefix and every segment is stored as a separate blob or object. The current
> remote flow therefore performs substantial redundant I/O:
> # download every recoverable segment while scanning the archive
> # copy every blob in the archive to {{*.bak}}
> # delete every copied blob from the archive
> # re-upload every recovered segment to the original archive, effectively
> restoring blobs that were just deleted
> # write the graph, binary references, index (where applicable), and the
> closed marker
> Azure SDK v12 batches some copy operations, but the complete archive
> copy+delete and the segment re-uploads remain unnecessary. Archives commonly
> contain thousands of segments, making this recovery expensive.
> The optimized remote flow should be:
> # identify which segments should be retained and which segments should be
> discarded
> # copy only discarded segments to {{*.bak}} and delete them from the original
> archive
> # leave recoverable segment payloads in their original locations
> # parse the retained segments using the existing recovery logic to rebuild
> the graph and binary references
> # register existing segments with a recovery-aware archive writer instead of
> uploading their payloads again
> # repair Azure segment metadata if necessary
> # rebuild the archive index where applicable
> # close the writer to publish the rebuilt metadata and final closed marker
> If an expected segment object is not present, recovery must fall back to the
> normal segment-write path rather than assuming it can be reused.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)