Skip to content

Fix condor_history OperationalError on pre-rc21 provenance.db - #25

Merged
iross merged 2 commits into
mainfrom
fix/condor-history-stale-schema
Aug 24, 2026
Merged

Fix condor_history OperationalError on pre-rc21 provenance.db#25
iross merged 2 commits into
mainfrom
fix/condor-history-stale-schema

Conversation

@iross

@iross iross commented Aug 24, 2026

Copy link
Copy Markdown
Owner

Summary

  • task-30 (v0.1.0rc21) changed condor_history's schema (composite cluster_id/proc_id PK, new source/job_name/site/gpu_ids/status columns), but CREATE TABLE IF NOT EXISTS never touches an existing table.
  • Any provenance.db built under v0.1.0rc19/rc20 keeps its old cluster_id-only condor_history table forever, and every enrich-history/enrich-jobad/scan --db call against it crashes with OperationalError: no such column: source — this is exactly what was hit in production right after upgrading to rc21.
  • _init_schema now detects the stale schema (missing source column) and drops+recreates just that one table before continuing. condor_history has no incremental ingestion state to lose (unlike checkpoints/events, which track byte offsets/mtimes) — every row is fully re-derivable — so this is safe, and much cheaper than telling someone to delete their whole provenance.db.

Test plan

  • uv run pytest tests/ -q — 278 passed, 2 skipped
  • ruff check / ty check clean
  • Manually reproduced the user's exact crash with a hand-built pre-rc21 schema + row, confirmed it now self-heals (warning printed, correct columns present) instead of raising

🤖 Generated with Claude Code

iross and others added 2 commits August 24, 2026 13:57
task-30 (v0.1.0rc21) changed condor_history's schema (composite
cluster_id/proc_id PK, new source/job_name/site/gpu_ids/status
columns), but CREATE TABLE IF NOT EXISTS never touches an existing
table. Any provenance.db built under v0.1.0rc19/rc20 kept its old
cluster_id-only condor_history table, and every enrich-history/
enrich-jobad/scan --db call against it crashed with
"OperationalError: no such column: source" -- hit in production
immediately after upgrading to rc21.

_init_schema now detects a condor_history table missing the `source`
column and drops it before recreating. condor_history (unlike
checkpoints/events) has no incremental ingestion state to lose --
every row is fully re-derivable by rerunning enrich-history/
enrich-jobad/scan --db -- so this is safe, and cheaper than telling
someone to delete their whole provenance.db (which would also force a
full rebuild of checkpoints/events). Logs a warning explaining what
happened.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
condor_history's Schedd.history() scans its backing store sequentially
per query regardless of constraint complexity, so batching cluster_ids
into many small queries multiplies total scan work instead of reducing
it. Adds per-batch timing to the progress output and exposes
--batch-size on the CLI so this can be diagnosed and tuned without a
code change; raises the default from 50 to 500.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@iross
iross merged commit d153eb7 into main Aug 24, 2026
1 check passed
@iross
iross deleted the fix/condor-history-stale-schema branch August 24, 2026 19:56
This was referenced Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant