Repository navigation
perf(wal): use optimized SHA-256 for opaque payload validation - #417
Merged
Merged
Conversation
39 of 46 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Opaque WAL records currently compute and validate payload digests with the sha2 backend, which is expensive on CPUs without dedicated SHA instructions. Use ring's optimized SHA-256 implementation while preserving the algorithm, stored digest bytes, record format, validation order and corruption checks. This does not claim an end-to-end ingestion throughput improvement.
Keep sha2 as a test-only reference for record builds and verify old/new digest compatibility at SHA block boundaries, large payload sizes and unaligned input offsets. Other features that require sha2 retain their existing dependency.
Refs #378.
Testing
The complete repository CI helper passed: 605 workspace Rust tests, Python 229 passed / 2 skipped / 1 expected failure, formatting, Clippy, Ruff and Pyright. All-feature WAL Clippy, server build and workspace packaging also passed. All 101 focused WAL tests passed; the record-only development configuration also passed its six tests. Source hashes matched before and after qualification.
The three changed files are byte-identical to the qualified implementation. Inherited main changes are audited separately; final-head GitHub CI validates the rebased integration.