openlibrary icon indicating copy to clipboard operation
openlibrary copied to clipboard

Cover archival to archive.org appears stalled since `covers_0014` - 2.24M covers (15%) have no bulk backup

Open capricornusx opened this issue 3 months ago • 1 comments

Problem

Bulk cover archives on archive.org (covers_0000–covers_0014) are missing two full historical ID ranges (covers_0006, covers_0007) and stop entirely at ID 14,999,999. Based on the official covers metadata dump, this currently means 2,242,201 covers (≈15% of all covers in the system) have zero backup copy anywhere - not in original resolution, and for one of the two historical gaps, not in any resolution at all.

The uncovered tail is actively growing at roughly 16,000–17,000 covers/month with nothing catching it up - every cover added since the last covers_0014 upload exists only as a live, single copy on OL's own infrastructure.

What currently exists on archive.org

Sizes are exact .tar/.zip byte sums pulled from each item's /metadata/<id> endpoint (methodology at the bottom).

Range (original tier) Size
covers_0000 40.8 GB
covers_0001 36.1 GB
covers_0002 34.0 GB
covers_0003 18.9 GB
covers_0004 5.9 GB
covers_0005 390.3 GB
covers_0006 missing
covers_0007 missing
covers_0008 300.1 GB
covers_0009 476.6 GB
covers_0010 332.3 GB
covers_0011 315.0 GB
covers_0012 322.1 GB
covers_0013 197.8 GB
covers_0014 141.1 GB

Derived-size tiers (l_covers_* / m_covers_* / s_covers_*) total 383.5 GB / 145.8 GB / 23.8 GB across all present ranges. Notably:

  • l_covers_0006, m_covers_0006, s_covers_0006 do exist (22.4 / 8.7 / 1.8 GB) even though original-resolution covers_0006 does not - range 6 is partially recoverable at reduced resolution.
  • Nothing exists for range 7 in any tier. Unrecoverable from bulk data by any means other than the live API.

Grand total currently downloadable in bulk, all tiers: 3,164.2 GB.

What the covers metadata dump says about the actual gap

Using ol_dump_covers_metadata_latest.txt.gz (id, width, height, created), a full scan of all 14,920,917 records shows:

Total records 14,920,917
ID range 1 – 15,242,455
IDs inside the 6,000,000–7,999,999 gap 1,999,844 (99.99% of the theoretical range - dense, fully-used ID space)
IDs above 14,999,999 (past the last existing item) 242,357, created 2025-05-05 → 2026-07-31
Total covers with no bulk backup 2,242,201

Cost of recovering this via the public API instead

Respecting the documented Covers API rate limit (3 req/s with identified User-Agent):

Scope Requests Time at 3 req/s
Single size (e.g. L only) 2,242,201 ~207 hours (~8.6 days), continuous
All four sizes 8,968,804 ~830 hours (~34.6 days), continuous

This is what any good-faith third-party mirror is currently forced into, purely because the bulk path stopped - the same job historically produced a bulk item for every other 1M-ID range.

Reproducing the bug

  1. Go to https://archive.org/details/covers_0006 or covers_0007 → item does not exist (404).
  2. Go to https://archive.org/details/covers_0014 → item exists but is unusually small (141.1 GB vs. 300–480 GB for neighboring ranges), suggesting the range wasn't fully populated before archival stopped.
  3. Download ol_dump_covers_metadata_latest.txt.gz and check for id values above 14,999,999 → 242,357 present, with created dates through 2026-07-31.
  • Expected behavior: a covers_0015+ item (or a rolling equivalent) should exist covering IDs added after covers_0014, the same way covers_0008–covers_0014 were each produced in turn.
  • Actual behavior: no bulk item exists past covers_0014, and the gap has grown continuously for over a year.

Context

  • Environment: prod (archive.org bulk items + openlibrary.org data dumps)
  • Related issues:
    • #476 - original report of the covers_0006/covers_0007/l_covers_0007 gap (2017), still unresolved 9 years later.
    • #8278 (closed via #9296) - proposed a monthly cover archival cron; still labeled State: Blocked at time of closing, and the issue text describes the recipe as a manual stopgap "until there's a fully automatic cron." Related to #6822 and #7691.
    • #5402 - a separate, unrelated cron (main data dumps) went silent the same way ("Data Dumps not auto-generating" → "Run manually for now"), suggesting this may be a recurring pattern in the olsystem/cron.d scheduling setup rather than something specific to covers.

Breakdown

Implementation Details (for maintainers)

openlibrary/coverstore/archive.py (current master) defines:

ITEM_SIZE = 1_000_000
BATCH_SIZE = 10_000
BATCH_SIZES = ("", "s", "m", "l")

This matches the range/tier structure observed on archive.org exactly, confirming the archiver is designed to write into these same public covers_NNNN / s_covers_NNNN items - there is no separate, hidden archive being missed.

Critically, Batch.get_pending() only finds batches by globbing zip files already present in config.data_root/items/covers_* on the coverstore server's local disk. If the job that zips and uploads pending batches isn't running on schedule, new covers simply accumulate as raw files locally and never reach any bulk item - consistent with the steadily growing, entirely unbacked-up tail shown above.

Our best guess is this is an operational gap (cron not running / needs a manual catch-up run per the #8278 recipe), not missing functionality. Happy to be corrected if there's a reason new items aren't being cut.

Requirements Checklist

  • [ ] Confirm whether archive.archive() + Batch.process_pending(upload=True, finalize=True) is currently scheduled/running on ol-covers0
  • [ ] If stalled, re-run the #8278 catch-up recipe to flush the local backlog into new archive.org items (covers_0015+, and covers_0006/covers_0007 if source files still exist)
  • [ ] If a fully automatic cron isn't feasible soon, consider a temporary elevated Covers API rate limit for a one-off, coordinated community backfill (fixed IP + identified contact) so volunteers can close the gap without weeks of continuous polling

Related files

  • openlibrary/coverstore/archive.py
  • olsystem/etc/cron.d/* (cron scheduling, per #5402 precedent)

Stakeholders

  • @mekarpeles (lead on both Module: Cover Service and Module: Data dumps, author of #8278)

Volunteer offer

I'm willing to help offset the bandwidth cost of any newly-published items: once covers_0006/covers_0007/a new tail item exist as torrents, I'll download and reseed them as a super-seeder until the swarm reaches a healthy ratio (targeting 3–5x), so this doesn't just add load without giving something back.

Methodology / reproducibility

  • Bulk item sizes: curl -s https://archive.org/metadata/<item_id> | jq '[.files[] | select(.name | endswith(".tar")) | (.size|tonumber)] | add'
  • Gap/tail analysis: full streaming scan of ol_dump_covers_metadata_latest.txt.gz, classifying each id against the known covered ranges (0–5,999,999 and 8,000,000–14,999,999) and the two known-missing sub-ranges.

Happy to share the exact scripts if useful for verification.

capricornusx avatar Aug 08 '26 10:08 capricornusx

Thank you @capricornusx for submitting this issue!

[!WARNING] This issue requires access to internal infrastructure, production systems, or institutional knowledge unavailable to community contributors. It can only be resolved by a maintainer or staff member.

⚠️ Contributors, this issue will be ready to work on once:

  • [ ] Triage — maintainers will add Priority: * and Lead: @*
  • [ ] Needs: Staff / Internal — confirming and restarting the archival cron requires access to ol-covers0 production infrastructure

Context

  • The constants cited in the issue's Implementation Details match current master exactly: https://github.com/internetarchive/openlibrary/blob/4036cc90ffed7a88ed54e0c3e38ab7de8a6c9565/openlibrary/coverstore/archive.py#L22-L24 (ITEM_SIZE, BATCH_SIZE, BATCH_SIZES), confirming the archiver is still designed to write into the same public covers_NNNN/s_covers_NNNN/m_covers_NNNN/l_covers_NNNN items observed on archive.org.
  • Batch.get_pending() (https://github.com/internetarchive/openlibrary/blob/4036cc90ffed7a88ed54e0c3e38ab7de8a6c9565/openlibrary/coverstore/archive.py#L142-L150) only globs zip files already sitting in config.data_root/items/covers_* on local disk — it has no independent trigger, so if nothing calls archive() + Batch.process_pending() on a schedule, covers simply accumulate locally and never reach a bulk item. This supports the issue's own conclusion that this is an operational (cron) gap rather than a code/functionality gap.
  • This repo has no cron.d/scheduling config for the coverstore archiver — that scheduling lives in the separate olsystem repo (not in $GITHUB_WORKSPACE), which is consistent with why this can't be confirmed or fixed by a community contributor.
  • #9836 (open, Priority: 2) is directly relevant to the covers_0014 anomaly noted in this issue: in Sept 2024 @mekarpeles found that covers_0014 batch 62 was uploaded to archive.org while incomplete, and that stray/duplicate files were still sitting in ol-covers0:/1/var/lib/openlibrary/coverstore/localdisk afterward. That's a plausible explanation for why covers_0014 (141.1 GB) is much smaller than its neighbors, and suggests the same fragile upload/finalize sequence may be implicated in the stall reported here.
  • PR #9296, "Prepares cover archival to be run as cron" (merged 2024-05-22), closed #8278 (open request for a monthly archival cron) — but #8278 itself was closed while still labeled State: Blocked, and its own text describes the fix as a manual stopgap "until there's a fully automatic cron." No later issue or PR indicates a fully automatic cron was ever completed.
  • #7691 (open) proposes extending the existing BWB monthly cron to also archive/import covers — a different proposed mechanism for the same underlying gap.
  • #476 (2017) is the original report of the exact covers_0006/covers_0007/l_covers_0007 gap called out here — unresolved for 9 years.
  • #5402 shows this exact failure mode (a scheduled data cron silently stopping and only recoverable via manual staff intervention) already happened once for the main data-dumps cron, suggesting a broader pattern in how olsystem cron jobs are monitored (or not) rather than something specific to covers.

Issue Assessment

Open questions

  • Is archive.archive() + Batch.process_pending(upload=True, finalize=True) currently scheduled on ol-covers0, and if so, why has no covers_0015+ item been produced in over a year? (Requires prod/olsystem access to answer.)
  • Given the same silent-cron-failure pattern already occurred in #5402, is there any monitoring/alerting for the coverstore archival cron specifically, or would it need to stop again for another year before being noticed? (No monitoring config for this job exists in this repo; answering this requires internal infra knowledge.)
  • Is a coordinated, rate-limit-exempted community backfill (per the volunteer offer in this issue) something staff are willing to support, or is a server-side cron fix strongly preferred as the sole path forward?

🔔 Stakeholders

@scottbarnes — root cause here is most likely an unmonitored/stalled cron on ol-covers0 production infrastructure (ops), and #5402 shows the same silent-cron-failure pattern already occurred once on the data-dumps side.

Full triage checklist
  • [x] Triage — labels reviewed this pass (Module: Cover Service, Affects: Operations, Needs: Staff / Internal added; Needs: Breakdown removed — issue already includes a concrete requirements checklist)
  • [x] Problem / opportunity — problem is clear, quantified (2.24M covers / 15%, growing ~16-17k/month), and actionable
  • [x] Scope — single, well-scoped problem (stalled bulk archival); the rate-limit ask is a tightly related fallback, not scope creep
  • [x] Justification — impact and recovery cost are quantified with reproducible methodology
  • [x] Success & testing criteria — implicit but clear: a covers_0015+ item (or equivalent) should exist covering the tail, following the same pattern as prior ranges
  • [x] Proposal & breakdown — concrete requirements checklist present, though execution requires staff/prod access
  • [x] If bug: environment & repro steps — environment (prod archive.org + openlibrary.org dumps) and repro steps provided
  • [x] Risks, concerns, open questions — surfaced above
  • [x] Richy context — code, commits, and related issues/PRs reviewed; no exact duplicate found (closest prior art: #476, #8278/#9296, #9836, #7691)
  • [x] References — archive.org item links, dump file, and methodology all present

[!NOTE] This comment was automatically generated by Richy, Open Library's issue enrichment assistant, on behalf of @mekarpeles. This is NOT a sign-off. This issue needs lead review before work begins.

openlibrary-bot avatar Aug 08 '26 10:08 openlibrary-bot