OpenViking icon indicating copy to clipboard operation
OpenViking copied to clipboard

[Bug]: ovpack export reads one file at a time, so exports from object storage take hours

Open ragnos-dev opened this issue 2 weeks ago • 0 comments

Version

OpenViking v0.5.4 (9dfa9017a). The same code is on current main (checked 2026-11-13).

Summary

_write_ovpack_archive in openviking/storage/ovpack/operations.py awaits read_file_bytes for each file in turn. On object storage with 0.2 to 1.4 seconds per read, an export of about 20,000 files spends 1 to 8 hours in this loop.

Reproduction

Export a pack from a store whose reads have added latency (a fake filesystem with a fixed delay per read shows the same shape). Total time is the file count times the read latency.

Proposed fix

Read ahead with bounded concurrency (a semaphore, default 8) in a sliding window of twice the concurrency, while writing zip entries and manifest sizes and hashes in the original order, so the pack is byte-identical. On a read failure, cancel and await the outstanding reads and raise as before.

Our local patch does this; at a concurrency of 8 the same export loop takes about 8 to 58 minutes. Happy to open a PR.

ragnos-dev avatar Nov 13 '26 14:11 ragnos-dev