Skip to content

enhancement(buffers): improve disk buffer lifecycle visibility - #26050

Open
Jansen-w wants to merge 37 commits into
vectordotdev:masterfrom
Jansen-w:fix/disk-buffer-orphan-safety
Open

Jansen-w wants to merge 37 commits into
vectordotdev:masterfrom
Jansen-w:fix/disk-buffer-orphan-safety

Conversation

@Jansen-w

@Jansen-w Jansen-w commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Report disk buffers under data_dir that are not referenced by the active configuration.
  • Run discovery on one dedicated worker outside Tokio, bounded to one active scan and one latest pending request, so filesystem traversal cannot delay startup, reload, or runtime shutdown.
  • Discard scan results superseded by reload and resolve symlinked roots, directories, and files without following cycles or paths outside the buffer root.
  • Schedule diagnostics after successful startup, reload, and rollback. The immediate post-reload scan temporarily excludes paths from the previous configuration because detached sinks may still be draining them.
  • Warn when existing, removed, or replaced disk buffers contain unread data, using nonblocking approximate event and byte snapshots. If usage cannot be sampled without waiting, report that it is unavailable.
  • Preserve existing reload, draining, locking, routing, and shutdown behavior.

Graceful shutdown behavior is intentionally unchanged here; that behavior is isolated in #26238.

Vector configuration

No standalone configuration is required. The diagnostics apply to sinks configured with disk buffers during startup and configuration reload.

How did you test this PR?

  • vector-buffers library suite: 115 passed, 2 ignored, covering disk-buffer encoding, filtering, overflow, acknowledgement, recovery, and usage accounting
  • 3 focused orphan-scanner tests covering core configured/orphan discovery, symlink cycle and root-escape safety, and nonblocking runtime shutdown
  • Standalone Vector process with 5,000 live HTTP events: verified the removal usage warning, immediate previous-path exclusion, later detached-drain warning, complete background delivery, and successful re-add of the same buffer path
  • Minimal-feature and broad non-Kafka Clippy runs with -D warnings
  • cargo fmt --all -- --check
  • GitHub Actions test, Clippy, formatting, generated-doc, and changelog checks

Is this a breaking change?

  • Yes
  • No

Does this PR include user facing changes?

  • Yes. A changelog fragment is included.
  • No. A maintainer will apply the no-changelog label to this PR.

References

Related: #26238

@github-actions github-actions Bot added the domain:topology Anything related to Vector's topology code label Aug 7, 2026
@Jansen-w Jansen-w closed this Aug 10, 2026
@Jansen-w
Jansen-w deleted the fix/disk-buffer-orphan-safety branch August 10, 2026 19:42
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 10, 2026
@Jansen-w
Jansen-w restored the fix/disk-buffer-orphan-safety branch August 10, 2026 19:43
@Jansen-w Jansen-w reopened this Aug 10, 2026
@Jansen-w
Jansen-w force-pushed the fix/disk-buffer-orphan-safety branch 4 times, most recently from a6a2bc4 to b7df047 Compare August 12, 2026 16:58
@Jansen-w
Jansen-w force-pushed the fix/disk-buffer-orphan-safety branch from fd18659 to 7b9f6e0 Compare August 27, 2026 22:02
@Jansen-w
Jansen-w marked this pull request as ready for review August 27, 2026 22:22
@Jansen-w
Jansen-w requested a review from a team as a code owner August 27, 2026 22:22
@vectordotdev vectordotdev unlocked this conversation Sep 2, 2026

@graphcareful graphcareful left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the overall idea but I think the implementation itself can be simplified

Comment thread src/config/validation.rs Outdated
Comment thread src/config/validation.rs Outdated
Comment thread lib/vector-buffers/src/variants/disk_v2/mod.rs Outdated
Comment thread lib/vector-buffers/src/topology/channel/sender.rs Outdated
Comment thread lib/vector-buffers/src/variants/disk_v2/mod.rs Outdated
Comment thread src/config/validation.rs Outdated
Comment thread src/config/validation.rs Outdated
Comment thread src/config/validation.rs Outdated
Comment thread src/config/validation.rs Outdated
Comment thread src/config/validation.rs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2163401395

ℹ️ 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".

Comment thread src/topology/orphaned_disk_buffers.rs Outdated
Comment thread src/topology/running.rs Outdated
Comment thread changelog.d/disk_buffer_orphan_safety.enhancement.md Outdated

@bruceg bruceg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two optional follow-ups below: the removal warn currently goes silent in the case I think we care about most, and stop() still does not wait on the handles we now keep. I would not hold merge for either.

Comment thread src/topology/running.rs Outdated
Comment thread src/topology/running.rs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3301482025

ℹ️ 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".

Comment thread src/topology/running.rs Outdated
Comment thread src/topology/orphaned_disk_buffers.rs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c3648a88cd

ℹ️ 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".

Comment thread src/topology/running.rs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cf02daa2c6

ℹ️ 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".

Comment thread src/topology/running.rs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5619bb4c95

ℹ️ 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".

Comment thread src/topology/running.rs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 78a4ddfce4

ℹ️ 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".

Comment thread src/topology/running.rs

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 061e707aac

ℹ️ 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".

Comment thread src/topology/orphaned_disk_buffers.rs
Comment thread lib/vector-buffers/src/variants/disk_v2/mod.rs Outdated
@Jansen-w
Jansen-w requested a review from graphcareful October 14, 2026 19:35
Comment thread lib/vector-buffers/src/topology/channel/sender.rs Outdated
Comment on lines +27 to +29
pub(super) struct OrphanedDiskBufferScanner {
sender: watch::Sender<Option<ScanRequest>>,
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice +1 much simpler

Comment thread src/topology/orphaned_disk_buffers.rs

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fce10c15dd

ℹ️ 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".

Comment thread src/topology/orphaned_disk_buffers.rs Outdated
Comment thread src/topology/running.rs Outdated
} else {
"Removing disk-buffered sink with remaining accounted data; reload will wait while its current instance finishes processing."
};
warn!(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Should this one be a warning? Maybe some of these new messages can be replaced by info! instead as no data is being lost nor does it require human intervention

Comment thread src/topology/running.rs

@thomasqueirozb thomasqueirozb Oct 15, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These new warnings can be accompanied by new metrics too and we could move some of this code into new internal events.

Once this is done we can improve the changelog to explain what "provides lifecycle visibility" means with those metrics

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 798fc425a6

ℹ️ 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".

Comment thread lib/vector-buffers/src/variants/disk_v2/writer.rs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bf3c163958

ℹ️ 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".

Comment thread lib/vector-common/src/internal_event/metric_name.rs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 43cc0595c8

ℹ️ 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".

Comment thread src/topology/running.rs
List each lifecycle counter event in the changelog with when it fires
and what it means. Explain that unavailable buffer usage means a disk
buffer writer was busy. Remove a semicolon from the unreferenced buffer
warning and pass the usage snapshot through directly when emitting the
replacement event.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ 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".

Comment thread src/topology/running.rs
Comment on lines +715 to +719
let usage = self
.inputs
.get(*key)
.expect("changed sink input must exist")
.disk_usage_snapshot();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Sample the disk buffer that owns the reported path

When a disk-backed ordinary sink shares a runtime key with a memory enrichment-table sink, full startup builds the table sink last (src/topology/builder.rs:629-649), so self.inputs[key] is the table's memory sender while sink_buffer(&self.config, key) above selects the ordinary disk config. If the ordinary sink is then changed to memory, this samples Some(0) from the memory sender and emits a replacement_unreferenced warning claiming no bytes were observed even when the reported old disk directory has persisted backlog; the post-reload scan also temporarily excludes that previous path (src/topology/running.rs:354-356). Keep active-buffer ownership metadata (or sample the selected disk buffer itself) so the usage belongs to buffer_dirs.

Useful? React with 👍 / 👎.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain:topology Anything related to Vector's topology code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants