Skip to content

Filter records before building per-record sink futures - #266

Merged
serprex merged 1 commit into
mainfrom
split/sink-prefilter
Oct 23, 2026
Merged

serprex merged 1 commit into
mainfrom
split/sink-prefilter

Conversation

@serprex

@serprex serprex commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Batch dispatch constructs large per-record futures before sinks reject unwanted records. Check wants() before building reorder and decoder futures. Preserve batch order and final shipment.

Extracted from original #228 and based directly on main. Contains no changes from #226 or other extracted PRs.

Validation: cargo fmt --all -- --check, cargo clippy --workspace --all-targets --locked -- -D warnings, and cargo test --locked --lib emit::pipeline::reorder (5 passed). Rebuild crate for each isolated diff.

Measured impact (2026-10-22)

Compared 94b0522c90d2a9eae36222faad6e7b045236386c against shared parent 151fd47cbd75ec7b9bc63ffe7040f049e702ecd0, with each PR built separately.

Workload Base (ns/record) PR (ns/record) Median change
Decoder batch of unwanted XLOG records 11.19 [11.13, 11.27] 0.80 [0.75, 0.87] -92.9%

Workload: 20,000 batches of 512 unwanted records (10,240,000 records), sent directly through production BufferingDecoderSink::on_records, with empty predecode slice and empty descriptor logs. Check successful dispatch. Measures decoder prefilter path; reorder sink, accepted heap records, mixed batches, and end-to-end throughput remain unmeasured.

AMD Ryzen 7 7840U; rustc 1.99.1; locked dependencies; optimized release builds; mimalloc 0.1.52. Seven trials per revision, alternating base/PR order, pinned to CPUs 2,4,6 (three physical cores). Values show median [min, max]; negative time changes mean less work or waiting. Local component measurements, without PostgreSQL or ClickHouse services.

ReorderSink and BufferingDecoderSink built and awaited one handle()
future per batch record before checking wants(). The futures embed the
commit and decode paths' state, so each was a large memmove even for
records the sink skips: ReorderSink wants only xact records, about 15%
of the lifecycle benchmark's WAL. Checking first cut the memmove share
of the serial queue worker from 7.2% to 4.9%.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@serprex
serprex force-pushed the split/sink-prefilter branch from 94b0522 to bc7c82d Compare October 23, 2026 14:16
@serprex
serprex requested a review from harshil-goel October 23, 2026 14:16
@serprex
serprex merged commit 43634da into main Oct 23, 2026
6 checks passed
@serprex
serprex deleted the split/sink-prefilter branch October 23, 2026 21:30
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.

3 participants