feat(buffers): add reject when_full mode for disk buffers - #25965
feat(buffers): add reject when_full mode for disk buffers#25965PradeepSundarajan wants to merge 3 commits into
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
This comment has been minimized.
This comment has been minimized.
|
I have read the CLA Document and I hereby sign the CLA |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 25837f7204
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| highest priority, and it is preferable to temporarily lose events rather than cause a | ||
| slowdown in the acceptance/consumption of events. | ||
| """ | ||
| reject: """ |
There was a problem hiding this comment.
Regenerate the full configuration reference for reject
Adding reject here updates the per-component sink metadata, but website/cue/reference/generated/configuration.cue still lists only block and drop_newest for sinks.*.buffer.when_full. As a result the generated public configuration reference remains out of sync and make check-generated-docs will rewrite/fail on this change; please regenerate and commit the full generated configuration docs along with this enum update.
AGENTS.md reference: AGENTS.md:L249-L255
Useful? React with 👍 / 👎.
| if self.config.error_on_full { | ||
| record | ||
| .take_finalizer_groups() | ||
| .update_status(EventStatus::Errored); | ||
| } |
There was a problem hiding this comment.
Record disk reject drops in buffer metrics
When a disk buffer in reject mode is full, this branch only errors the finalizers before returning the record as Full; because disk buffers provide their own instrumentation, the outer BufferSender does not install the UsageAccounting::DroppedNewest counters for this stage. In production this makes rejected disk-buffer events surface as client 500s without any corresponding buffer discarded/drop metric, so please update the ledger/usage accounting before returning here and in the recovered-record full path.
Useful? React with 👍 / 👎.
Summary
Adds a new
rejectvalue for a sink buffer'swhen_fulloption. Likedrop_newest, it drops the newest event when the buffer is full, but it acknowledges the dropped event as errored instead of as a successful delivery. This lets a source withacknowledgementsenabled signal the failure back to its client rather than silently reporting success for data that Vector actually discarded — for example, thehttp_serversource returns500 Internal Server Errorinstead of its configured success code when the buffer is full. This applies to bothdiskandmemorybuffers.Implementation notes:
WhenFull::Rejectvariant.error_on_fullflag onDiskBufferConfig(set only forreject). On the buffer-full shed paths, the disk writer resolves the shed record's finalizers asErrored(via the existingFinalizerGuard) instead of letting them resolve as delivered. Block/overflow paths are unchanged (finalizers reattached for retry).Erroredin theRejectarm. For disk buffers this is a no-op — the writer has already errored and detached them.drop_newestis behaviorally unchanged (best-effort; shed events acknowledged as delivered) for both disk and memory.Vector configuration
How did you test this PR?
Added unit tests in
vector-buffers:writer_marks_shed_record_errored_when_reject— a fulldiskrejectbuffer resolves the shed record's finalizers asErrored.test_sender_reject_memory_sheds_as_errored— a fullmemoryrejectbuffer marks the shed eventErrored.test_sender_drop_newest_memory_sheds_as_delivered— contrast:drop_newestremains best-effort and rolls a shed event up asDelivered.Verified locally:
cargo test -p vector-buffers— 109 passed, 2 pre-existing ignores (run single-threaded; the disk tests collide on file locks under in-process parallelism).cargo clippy -p vector-buffers --all-targets— clean (deny(pedantic)).vector-common(33) andvector-config(44) unit tests pass.End-to-end, using a build of this branch against real Kafka (
http_server→diskbuffer withwhen_full: reject→kafka):202; once the 256 MiB buffer filled, shed POSTs returned500(vector_buffer_eventsstayed at the accepted count — rejected events never entered the buffer).202) events drained to the topic with no loss, while the rejected (500) events were correctly refused for the client to retry.Is this a breaking change?
Does this PR include user facing changes?
changelog.d/reject_when_full.feature.md.no-changeloglabel to this PR.References
Notes
rejectsection towebsite/content/en/docs/architecture/buffering-model.mdand the generatedwhen_fullenum inwebsite/cue/reference/components/generated/sinks.cue(runmake generate-component-docsto confirm the generated file matches before merge).@vectordotdev/vectorto reach out to us regarding this PR.pre-pushhook, please see this template.make fmtmake check-clippy(if there are failures it's possible some of them can be fixed withmake clippy-fix)make testgit merge origin masterandgit push.Cargo.lock), pleaserun
make build-licensesto regenerate the license inventory and commit the changes (if any). More details on the dd-rust-license-tool.