adapter/statsclient: refresh symlinks + expose epoch and symlink targets#369
Draft
otroan wants to merge 3 commits into
Draft
adapter/statsclient: refresh symlinks + expose epoch and symlink targets#369otroan wants to merge 3 commits into
otroan wants to merge 3 commits into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
UpdateDirnow re-resolves symlink entries (updateStatOnIndexviaCopyEntryData), so symlink data stays fresh per tick.StatEntrygainsSymlinkTarget/SymlinkItem, populated from the v2 segment (GetSymlinkIndexeson the internalstatSegmentinterface; v1 returns 0,0).(*StatsClient).Epoch()exposes the current directory epoch.Adds
statseg_symlink_test.gocovering 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