Skip to content

perf(storage): hash CSR shards on write instead of reading them back (#1384) - #1552

Merged
DecisionNerd merged 1 commit into
mainfrom
perf/1384-csr-hash-on-write
Sep 22, 2026
Merged

DecisionNerd merged 1 commit into
mainfrom
perf/1384-csr-hash-on-write

Conversation

@DecisionNerd

@DecisionNerd DecisionNerd commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The last remaining read-back-to-hash in the encode publish path. write_csr_shard wrote each bounded CSR shard, then read the whole file back to hash it (codec::read + sha256_hex), doubling the shard's device I/O on the publish-side critical path. That violates #1384's accepted decision 1: no pass reads data back in order to hash it.

Now each shard is encoded once into memory (shards are admission-bounded, ≤1M entries), the exact bytes that land on disk are preflight-verified and SHA-256'd, and the file is written once. The recorded digest is identical to what the read-back produced, so receipts, shard-set reuse and manifest naming are unchanged.

Refusals are preserved, not moved

What remains read-back on purpose

Small JSON controls (per-index .csr.json, adjacency manifest) are still verified by read-back in encode_adjacency — kilobytes against gigabytes, and an independent on-disk check of the shard digest chain. The 45 GB shape_consume_reauthentication row in the retained baseline is the whole shaping region under a legacy phase name (its reads are the partitioner's real data movement), not authentication; that accounting note feeds #1384's boundary ledger.

Validation

  • TMPDIR=<ext4> cargo test -p graphforge-storage --lib: 1,277 passed, 0 failed (includes the adjacency determinism and portable-import publish paths; the 3 tests that fail under the default tmpfs /tmp fail identically on the pristine base — the documented GF_UNSUPPORTED_FILESYSTEM admission).
  • cargo fmt --all -- --check clean; cargo clippy --workspace -- -D warnings passes.
  • cargo test -p graphforge-benchmark-certify compiles clean against the changed API.

Refs #1384


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@coderabbitai

coderabbitai Bot commented Sep 22, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository: CurateLabs/graphforge/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 125fae19-9908-4815-a25c-14eafbeea28f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Warning

Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption.


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.

@github-actions github-actions Bot added the core Core source code changes label Sep 22, 2026
@DecisionNerd
DecisionNerd added this pull request to the merge queue Sep 22, 2026
Merged via the queue into main with commit 82b163e Sep 22, 2026
21 checks passed
@DecisionNerd
DecisionNerd deleted the perf/1384-csr-hash-on-write branch September 22, 2026 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core source code changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant