Skip to content

fix(ingest): write raw_records in 500-row slices, so standardize fits in memory at 10M (#1494) - #1496

Merged
athvin merged 1 commit into
mainfrom
fix/std-current-version-narrow
Nov 30, 2026
Merged

athvin merged 1 commit into
mainfrom
fix/std-current-version-narrow

Conversation

@athvin

@athvin athvin commented Nov 30, 2026 •

Copy link
Copy Markdown
Owner

Closes #1494

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

What

Ingest keeps #1475's single staged appender, but writes raw_records in 500-row seq slices (append_from_src now takes a range), one Parquet file each, not one file for the whole delivery.

Why

#558's 10M run failed in standardize: Out of Memory, 7.4/7.4 GiB at class L. With one large raw_records file, standardize's per-thread scan state outgrows the limit. The old 500-row-file layout passed at 10M.

Proof

Bisected locally at 2M rows with a 1.5 GB limit:

  • one file OOMs at 4 and 12 threads and passes at 1 and 2;
  • small row groups in one file (2048, 4096, 16384), 2,000-row files and 20,000-row files all still OOM;
  • prefetch and metadata-cache settings don't help;
  • 500-row files pass, twice.
    With this change, on the real code path: ingest 111.7 s (106 s as one file), 4,000 files, standardize passes in 165.5 s. The large-delivery test (1,201 rows, three slices) asserts CSV order. make check exit 0.

Risk & rollback

Ingest issues one short statement per 500 rows, inside the same lake transaction, so a failure still lands nothing. Rollback: git revert <merge-sha> (10M standardize OOMs again).

Post-merge ledger

Closed by: agent · session Claude Code:24d16c2e-fec6-49d8-9797-060338df4848 on Mac · 2026-11-30T08:34:29Z

  • 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: — 0633718, rust 46381089863 + frontend 46381089827 success
  • images built, or correctly never ran because nothing that goes into
    an image changed: — success, run 46381089925
  • deploy converged — proved by a line the running process emitted, not
    by the image digest and not by the workflow conclusion: — run 46381683817 success (0633718); 10M-scale spill run without eviction #558's 10M rerun on this build is the live proof, recorded below once it reaches match
  • 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: — infra success on 0633718
  • the board card reached Done through the automation rather than by
    hand, and the issue closed: — fix(standardize): picking each record's current version after every transform OOMs at 10M — the window buffers all ~25 standardized columns #1494 CLOSED by fix(ingest): write raw_records in 500-row slices, so standardize fits in memory at 10M (#1494) #1496 via automation
  • follow-ups are open for everything deferred here — numbers: — none
  • what was learned is written down where the next session will find it
    (a skill, a reference, memory) — or nothing new was learned: — DuckDB's per-thread scan state over one large Parquet file outgrew the limit where 500-row files did not; small row groups inside one file did not help, so bound the files

Specific to this change

Context — plan, discoveries, measurements, files

Plan

Discoveries

Measurements

Files

Details of the bisect are on #1494.

🤖 Generated with Claude Code

… in memory at 10M (#1494)

#1475 staged a delivery and wrote it in one INSERT … SELECT, so one
Parquet file. #558's 10M run then failed in standardize: Out of Memory,
7.4/7.4 GiB at class L, three minutes in. With the old layout (500-row
files) standardize had passed at 10M in 7.4 minutes.

Bisected locally at 2M rows with a 1.5 GB limit:
- one file OOMs at 4 and 12 threads and passes at 1 and 2, so the cost
  is per-thread scan state;
- small Parquet row groups inside one file (2048, 4096, 16384) still
  OOM, as do 2,000- and 20,000-row files;
- disabling parquet prefetching or the metadata cache doesn't help;
- 500-row files pass at 12 threads, twice;
- moving the current-version window before the transforms didn't help,
  so it isn't part of this change.

The staged appender stays. append_from_src now takes a seq range, and
landing writes the staged rows in RAW_FILE_ROWS (500) slices, one short
statement each. The old path's cost was 5,500 bound parameters per
statement, not the count. Measured (debug build, 2M rows): ingest
111.7 s against 106 s for one file, 4,000 files, and standardize passes
at 1.5 GB / 12 threads in 165.5 s.

The large-delivery test (1,201 rows, three slices) still asserts CSV
order. The rollback and golden tests pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@athvin
athvin merged commit 0633718 into main Nov 30, 2026
44 checks passed
@athvin
athvin temporarily deployed to marketing-preview November 30, 2026 08:22 — with GitHub Actions Inactive
athvin added a commit that referenced this pull request Nov 30, 2026
…ndardize needs more than 8GB of DuckDB (#558) (#1501)

#558's 10M run on er-dev, with a realistic-cardinality corpus, failed
standardize with Out of Memory (7.4/7.4 GiB) at class L's 14Gi / 8GB:
- on #1475's single-file layout, after 3 minutes;
- on #1496's 500-row files, after 4.5 minutes, at 13.2 of 14 GiB.
The old layout's earlier pass at 10M was on a low-cardinality corpus.

Every runner-l shape has at least 32 GiB (c5ad, c6id or c8id.4xlarge;
m6id has 64), and L used 14 of it. L is now 26Gi with DuckDB at 18GB,
which keeps DuckDB strictly below the container (the D-SIZING
invariant) and leaves room for the node's daemonsets. That means one L
pod per node. The dev namespace already admits at most two L pods,
since ephemeral storage refuses a third: 2 x 26Gi + app = 57Gi of the
80Gi quota.

helm template renders ER_DUCKDB_MEMORY_LIMIT=18GB with 26Gi requests
and limits. infrastructure.md §6.5, batch-orchestration-design and the
quota comment are updated.

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 — 3e9b96e3 Deployed Nov 30, 2026 by athvin via remove closed PR previews #193
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.

fix(standardize): picking each record's current version after every transform OOMs at 10M — the window buffers all ~25 standardized columns

2 participants