Skip to content

adapter/statsclient: refresh symlinks + expose epoch and symlink targets#369

Draft
otroan wants to merge 3 commits into
FDio:masterfrom
otroan:ole/stats-symlink-refresh
Draft

adapter/statsclient: refresh symlinks + expose epoch and symlink targets#369
otroan wants to merge 3 commits into
FDio:masterfrom
otroan:ole/stats-symlink-refresh

Conversation

@otroan

@otroan otroan commented Jun 9, 2026

Copy link
Copy Markdown

Draft — opened for visibility/discussion of the approach.

Three changes to support a PrepareDir-once + UpdateDir-per-tick stats collection loop without re-resolving the whole directory each epoch:

  1. UpdateDir now re-resolves symlink entries (updateStatOnIndex via CopyEntryData), so symlink data stays fresh per tick.
  2. StatEntry gains SymlinkTarget/SymlinkItem, populated from the v2 segment (GetSymlinkIndexes on the internal statSegment interface; v1 returns 0,0).
  3. (*StatsClient).Epoch() exposes the current directory epoch.

Adds statseg_symlink_test.go covering symlink refresh and target metadata.

Motivation: a downstream collector reads thousands of /err/<node>/<reason> symlinks; resolving the directory every tick is too expensive. These primitives let a consumer prepare once and cheaply refresh.

🤖 Generated with Claude Code

otroan and others added 3 commits June 8, 2026 11:44
Three changes to support per-tick stats collection without re-resolving the
whole directory each epoch:

1. UpdateDir now re-resolves symlink entries (updateStatOnIndex via
   CopyEntryData) so a PrepareDir-once + UpdateDir-per-tick loop keeps
   symlink data fresh.
2. StatEntry gains SymlinkTarget/SymlinkItem, populated from the v2 segment
   (GetSymlinkIndexes on the internal statSegment interface; v1 returns 0,0).
3. (*StatsClient).Epoch() exposes the current directory epoch.

Adds statseg_symlink_test.go covering symlink refresh and target metadata.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add TestStatClientSymlinkRefresh to the live-VPP integration suite, exercising
the adapter changes end-to-end against a running VPP:

- StatEntry.SymlinkTarget/SymlinkItem are populated and each symlink resolves
  to a real (non-symlink) backing directory entry.
- StatsClient.Epoch() returns the current epoch and reflects a directory-layout
  change (creating an interface bumps it).
- UpdateDir refreshes a prepared dir under an unchanged epoch (re-resolving
  symlink entries), and returns ErrStatsDirStale for a dir prepared under a
  stale epoch.

A loopback is created up front so per-interface symlink entries (/interfaces/*
aliasing into /if/*) are present. Complements the statseg_symlink_test.go unit
test, which covers the v1/v2 (target,item) bit-unpacking directly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

1 participant