Skip to content

perf(gr26): flush shelter ingest writes once per parquet chunk - #223

Merged
BK1031 merged 2 commits into
bk1031/batch-signal-insertsfrom
bk1031/chunked-ingest-writes
Aug 7, 2026
Merged

perf(gr26): flush shelter ingest writes once per parquet chunk#223
BK1031 merged 2 commits into
bk1031/batch-signal-insertsfrom
bk1031/chunked-ingest-writes

Conversation

@BK1031

@BK1031 BK1031 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor
  • The shelter ingest was persisting row-by-row: one CreateCAN round trip plus per-signal inserts for every parquet row, ~220ms/row with ClickHouse ~25-30ms from foundry (the current 730k-row batch was tracking ~45h)
  • Restructure processFile to decode each 4096-row chunk fully, then flush once per chunk: one CreateCANs batch + one CreateSignals batch — two round trips per ~4096 rows instead of ~30k
  • Add service.CreateCANs bulk counterpart of CreateCAN using PrepareBatch
  • dispatchRow becomes decode-only and returns the frame + signals; replayFrame folded in
  • Flushes stay log-and-continue like the old per-row path; job retries re-cover dropped chunks via ReplacingMergeTree dedup
  • Stacked on perf(gr26): batch signal inserts into a single round trip #222 (batched CreateSignals) — without it the per-chunk signal flush would still be per-signal round trips

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1ddd48a9f9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread gr26/job/ingest_batch.go Outdated
Per-chunk flush errors were only logged, so processFile returned success
and foreman completed the job instead of spending a retry attempt — one
transient ClickHouse blip could silently drop up to 4,096 frames. Hold
the first flush error and return it after the loop, so the rest of the
file still lands but the attempt fails and gets retried.

Report stats on the failure path too. FailRequest already carries a
result, but the worker only forwarded one to Complete; wire it into Fail
so a partial-failure run records failed_inserts, cans_dropped,
signals_dropped and per-chunk error samples alongside the decode counts.
@BK1031
BK1031 merged commit 2e12ddb into main Aug 7, 2026
19 checks passed
@BK1031
BK1031 deleted the bk1031/chunked-ingest-writes branch August 7, 2026 15:55
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.

2 participants