Skip to content

fix(executor): reconcile's DuckDB takes a third of the class limit, leaving its Rust heap room at 10M (#558) - #1508

Merged
athvin merged 1 commit into
mainfrom
fix/558-reconcile-duckdb-share
Nov 30, 2026
Merged

athvin merged 1 commit into
mainfrom
fix/558-reconcile-duckdb-share

Conversation

@athvin

@athvin athvin commented Nov 30, 2026

Copy link
Copy Markdown
Owner

Closes #558

Post-merge is part of this pull request. The ledger below records whether
the follow-up work actually happened. /land-pr closes it.

What

open_order_session sizes DuckDB per task: SQL stages keep the class limit, and reconcile gets a third of it (18GB becomes 6000MB).

Why

#558's 10M run passed standardize (#1504) and match, then reconcile was OOMKilled 53 s in (exit 137): the container limit, not DuckDB's. Reconcile builds its clusters in Rust, and that heap plus an 18GB DuckDB buffer pool overran 26Gi.

Proof

Unit test reconcile_leaves_the_heap_room_and_sql_stages_keep_the_class_limit. make check exit 0. The live proof is the 10M rerun from reconcile onward on this build, recorded in this ledger.

Risk & rollback

Only reconcile's DuckDB budget changes, and reconcile's SQL is small. Rollback: git revert <merge-sha>.

Post-merge ledger

Closed by: unclosed

  • main is green with this change on it — the merge SHA, and the run
    that proves it. A later head SHA with this commit as an ancestor counts;
    a cancelled run with zero jobs does not:
  • images built, or correctly never ran because nothing that goes into
    an image changed:
  • deploy converged — proved by a line the running process emitted, not
    by the image digest and not by the workflow conclusion:
  • the push-only surface no pull request can pre-test (deploy, drift,
    kind's nightly leg) is green, or knowingly red for a reason that is not
    this change:
  • the board card reached Done through the automation rather than by
    hand, and the issue closed:
  • follow-ups are open for everything deferred here — numbers:
  • what was learned is written down where the next session will find it
    (a skill, a reference, memory) — or nothing new was learned:

Specific to this change

Context — plan, discoveries, measurements, files

Plan

Discoveries

Measurements

Files

🤖 Generated with Claude Code

…eaving its Rust heap room at 10M (#558)

#558's 10M run passed standardize and match on class L (26Gi / 18GB)
and then reconcile was OOMKilled 53 s in (exit 137). That's the
container limit, not DuckDB's. Reconcile builds its clusters in Rust:
every record key twice, the edges, the clusters and one lifecycle
event per record. At 10M that heap plus a DuckDB buffer pool allowed
18GB overran 26Gi.

open_order_session now asks duckdb_memory_for(task_id, class_limit).
SQL stages keep the class limit. reconcile gets a third (18GB becomes
6000MB), stepping down a unit so the split stays exact. A shape the
parser doesn't understand keeps the class limit rather than guessing.

Unit test reconcile_leaves_the_heap_room_and_sql_stages_keep_the_class_limit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@athvin
athvin merged commit ea585b0 into main Nov 30, 2026
40 checks passed
@athvin
athvin temporarily deployed to marketing-preview November 30, 2026 12:14 — with GitHub Actions Inactive
athvin added a commit that referenced this pull request Nov 30, 2026
…ders, not a million-tuple VALUES literal (#558) (#1511)

After #1508 capped reconcile's DuckDB at a third of the class limit, the
10M run's reconcile was still OOMKilled at class L's 26Gi, 53 s in.
Measured locally in release with the #558 corpus and model:

  1M records: reconcile 45.7 s, peak RSS 8.3 GB
  (231k scores, so the edges don't explain it)

The cause: reconcile wrote membership as one
'create temp table __mem_src as select * from (values (…), (…), …)'
with a tuple per assigned record, and the entity transitions the same
way (__ent_src). DuckDB parsed a million-tuple literal, a parse tree of
several KB per row, so at 10M about 80 GB.

Both are now created with a schema and filled through a DuckDB appender,
as #1409 did for events. The declared upsert_from_src statements are
unchanged. Measured after:

  1M records: reconcile 5.1 s, peak RSS 3.26 GB
  2M records: reconcile 12.6 s, peak RSS 4.73 GB

That's about 1.5 GB per million plus 1.8 GB, so about 16.5 GB at 10M,
inside class L's 26Gi with reconcile's DuckDB at 6 GB (#1508).

Co-authored-by: bmoore813 <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>

This branch was previously deployed

1 inactive deployment
marketing-preview — 5e95218b Deployed Nov 30, 2026 by athvin via remove closed PR previews #200
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.

10M-scale spill run without eviction

2 participants