fix(buffers): flush partial sink batches during disk-buffer shutdown #27260
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #27260"
general
weight: 0.35
pront
Summary
This replaces #26969, which I have now closed. GitHub permission issues prevented me from posting comments on the old PR. Please continue review here. This PR carries forward the latest branch, including the merges from
masterthroughd6da0c7bb0.With disk buffering, a partial sink batch can wait for
batch.timeout_secsduring shutdown: the disk reader waits for acknowledgements before returning EOF, while the batcher needs EOF to flush the records that will produce those acknowledgements. A long batch timeout can therefore exhaust the shutdown grace period even when the destination is healthy.Separate input exhaustion from acknowledgement completion. Retain the receiver after natural EOF so sinks can flush their final batches, then process outstanding acknowledgements and persist the reader checkpoint before the sink task completes. Reload-detached receivers remain available for reuse. The shutdown reporter also defers success to the aggregate task result so a checkpoint failure cannot be masked by a completed task.
Add regression coverage for partial partitions, pending finalizers and shutdown deadlines, final-write/rollover races, replay, checkpoint failures, and memory/disk receiver reuse. Update the buffer property model and direct buffer consumers for the two-phase lifecycle.
References
Closes #25774.
Related reports and history:
The reload issues are linked as related context. This PR's shutdown regression tests cover natural input EOF; the broader reload behavior needs separate validation.
Vector configuration
The topology tests construct their configuration in Rust: a test source feeds a disk-buffered test sink using the production
PartitionedBatcher, with two partial partitions, a five-minute batch timeout, and a two-second shutdown limit. No configuration fields or on-disk formats change.For the real-process smoke test, used
stdin → disk buffer → HTTP sinkwith a loopback HTTP receiver returning HTTP 200. Temporary paths and the receiver port are normalized below:The process was started with
--graceful-shutdown-limit-secs 30.How did you test this PR?
The results below are carried forward from #26969. The recorded local build and smoke tests were run at
7a2c82d703, before the later merges frommaster. Tests have not been rerun for this PR recreation.On macOS arm64 with the pinned Rust 1.96.1 toolchain:
make check-clippywith the feature set below: passed.make fmt,make check-fmt,make check-markdown, andmake check-changelog-fragments: passed.Confirmed the batching regression reaches the shutdown deadline with the original v0.61.0 buffer lifecycle code restored, and the reporter regression detects the original false-success behavior. Both pass with the fix.
The parallel topology run failed in the existing
topology_reload_preserves_enrichment_table_statetest; that test passed in isolation and in the full serial suite.Real-process shutdown and delivery verification
Reproduction scripts, YAML configuration, results for all seven checks, captured HTTP requests, and shutdown logs are available in the smoke-test gist.
Built and tested commit
7a2c82d703on macOS arm64 using the debug binary (vector 0.62.0-dev-custom-7a2c82d703). Built viacargo vdev run, which selected onlysources-stdinandsinks-httpfor the configuration above. These smoke checks ran after the merge from master.With a 30-second shutdown grace period and a 300-second batch timeout:
aandb. Each event included a message and a nested payload with a sequence number, boolean, Unicode text, and an array./aor/b, and event order within each partition.Additional real-process checks with a two-second grace period verified that Vector waited for HTTP responses delayed by 300 ms, reached the shutdown deadline when responses were withheld, and replayed all four unacknowledged events on restart. The deadline check used logs because the process currently returns exit code 0 even when the shutdown grace period expires.
These are functional checks against a local HTTP receiver; throughput has not been benchmarked. Live S3 verification has not been run.
Does this PR include user facing changes?
changelog.d/25774_disk_buffer_shutdown.fix.md.