Skip to content

feat(parquet): migrate the writer to buffer-and-put on the Store seam (rfc0013 green) - #236

Merged
jensholdgaard merged 2 commits into
mainfrom
rfc0013-green-writer-seam
Jun 16, 2026
Merged

feat(parquet): migrate the writer to buffer-and-put on the Store seam (rfc0013 green)#236
jensholdgaard merged 2 commits into
mainfrom
rfc0013-green-writer-seam

Conversation

@jensholdgaard

Copy link
Copy Markdown
Owner

RFC 0013 green — completes the .2 seam for the write half: Writer now publishes through Store instead of a temp file + rename. Companion to the reader (#233) and manifest (#234) seams.

What

  • Writer encodes into an in-memory ArrowWriter<Vec<u8>> and Store::put_blockings the finished bytes on close (was: stream to <uuid>.parquet.tmp File, rename on close).
  • The object-store put is the atomic commit point — the local backend stages to a private temp object and renames internally, so readers still see a complete file or nothing. Atomicity + durability are unchanged (object_store local put = staged + rename + no-fsync, exactly as the old close did per its own docs); only the on-disk temp artifact is gone.
  • num_rows tracked directly (per accepted sub-batch) since into_inner returns the buffer, not metadata. Row-group sizing (§3.5) still applies within the buffer.
  • Removed the Drop impl (no temp file to clean) and WriterError::Io's now-unused source_path field; tidied the temp/rename docs.

⚠️ Contract change (§6.2) — pre-approved to land with the S3 work

The .parquet.tmp-during-write and Drop-cleanup behaviour is gone. tests/partition_layout.rs's atomic-publish test is rewritten to the buffer-and-put contract:

  • nothing is published before close;
  • a writer dropped without close publishes nothing (no temp artifact to clean up);
  • close publishes the final <uuid>.parquet atomically, no .tmp left behind.

The test doc spells out the before/after. Only the data Writer migrates here; the audit writer keeps its temp-file scheme (separate concern, out of scope).

Invariants / notes

  • No on-disk format change (§3.5 untouched — identical Parquet bytes). §3.4 durability unchanged (WAL is the horizon; the Parquet put was never fsync'd).
  • Memory profile: buffer-and-put holds the whole file in memory before the put — the §4 256MB–2GB target-file tradeoff inherent to the chosen model. put_multipart streaming is a future optimisation.
  • Compaction (the writer's only production consumer) passes unchanged; full workspace cargo test green; clippy -D warnings + cargo doc -D warnings clean.

🤖 Generated with Claude Code

… (rfc0013 green)

`Writer` now encodes into an in-memory `ArrowWriter<Vec<u8>>` and publishes the
finished bytes via `Store::put_blocking` on close, instead of streaming to a
`<uuid>.parquet.tmp` File and renaming it. The object-store put is the atomic
commit point (the local backend stages + renames internally), preserving the
"readers see a complete file or nothing" guarantee. Atomicity and durability
are unchanged from the prior scheme (object_store's local put does staged +
rename + no-fsync, exactly as `close` did); only the on-disk temp artifact is
gone. Row-group sizing (§3.5) still applies within the buffer; `num_rows` is now
tracked directly (incremented per accepted sub-batch) since `into_inner` returns
the buffer, not metadata.

CONTRACT CHANGE (§6.2, maintainer pre-approved to land with the S3 work): the
`.parquet.tmp`-during-write / Drop-cleanup behaviour is gone. `tests/partition_
layout.rs`'s atomic-publish test is rewritten to the buffer-and-put contract —
nothing is published before `close`, a writer dropped without `close` publishes
nothing (no temp artifact to clean), and `close` publishes the final
`<uuid>.parquet` atomically. The `Drop` impl is removed (no temp file to remove)
and `WriterError::Io`'s now-unused `source_path` (two-path/rename) field is
dropped. The data `Writer` is the only migration here; the audit writer keeps
its temp-file scheme (separate, out of this slice).

Memory note: buffer-and-put holds the whole file in memory before the put (the
§4 256MB–2GB target-file tradeoff inherent to the chosen model); `put_multipart`
streaming is a future optimisation. Compaction (the writer's main consumer)
passes unchanged; full workspace green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@jensholdgaard, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 6 minutes and 8 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e158726b-d48f-40cd-9a65-aeaf68da670f

📥 Commits

Reviewing files that changed from the base of the PR and between 3d3454c and a5af46c.

📒 Files selected for processing (2)
  • crates/ourios-parquet/src/writer.rs
  • crates/ourios-parquet/tests/partition_layout.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch rfc0013-green-writer-seam

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR completes the RFC 0013 “write half” seam for ourios-parquet by migrating the partition data Writer from a temp-file + rename workflow to an in-memory buffer that is atomically committed via Store::put_blocking on close, and updates the partition layout integration test to match the new publish contract.

Changes:

  • Refactors Writer to encode Parquet into ArrowWriter<Vec<u8>> and publish bytes through Store::put_blocking only on Writer::close.
  • Tracks num_rows incrementally during append_records (since into_inner returns bytes, not Parquet metadata).
  • Updates partition_layout test coverage to assert “publish only on close; drop publishes nothing; no .parquet.tmp artifact”.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
crates/ourios-parquet/src/writer.rs Switches writer to buffer-and-put via Store, removes temp-file lifecycle, and adds direct row counting.
crates/ourios-parquet/tests/partition_layout.rs Updates atomic-publish contract test to validate the new buffer-and-put behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/ourios-parquet/src/writer.rs Outdated
Comment thread crates/ourios-parquet/src/writer.rs Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@jensholdgaard
jensholdgaard merged commit 806595a into main Jun 16, 2026
13 checks passed
@jensholdgaard
jensholdgaard deleted the rfc0013-green-writer-seam branch June 16, 2026 08:49
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