Skip to content

fix(stats): read the device only on demand and keep TRIM and lock counts honest - #58

Merged
mattmattox merged 1 commit into
mainfrom
claude/api-stats-followups
Nov 10, 2026
Merged

mattmattox merged 1 commit into
mainfrom
claude/api-stats-followups

Conversation

@mattmattox

Copy link
Copy Markdown
Contributor

Shepherd's non-blocking review items from #55.

  • Device sampling is now demand-driven. An idle mount (-api is on by default) no longer scans the bitmap every 15s; at 16 TiB × 64 nodes that was ~2200 reads/s. After a quiet period, the first capacity or cluster request returns the old data and starts a read.
  • pending_locks now means "found the lock taken and retrying".
  • Behaviour change: on image files, TRIM now reports trim_enabled: false and counts nothing as discarded. Before, ENOTTY counted as success. The integration test asserts this.
  • The two API integration tests are now high, with Docker/VM TODOs.

Testing on .68 (same tree): race unit tests for stats/lock/trim/api, lint 0 issues, TestAPIStatsReportLiveValues and TestAPIServesHealthOnLoopback pass.

🤖 Generated with Claude Code

…nts honest

Review follow-ups for #55:
- The sampler reads the block bitmap and node registry only while requests
  read capacity or cluster data; an idle mount no longer scans the bitmap
  every 15 seconds. The first request after a quiet period starts a read.
- pending_locks counts only Acquire calls whose first attempt found the
  lock taken, not every uncontended acquire in flight.
- TRIM no longer counts EOPNOTSUPP/ENOTTY ranges as discarded. The device
  is marked unsupported and trim_enabled reports false. A flush the bitmap
  guard refuses now counts as an error.
- Rename the cache stats variable that shadowed the stats package.
- The two API integration tests are high priority with Docker/VM TODOs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mattmattox
mattmattox merged commit e82db9f into main Nov 10, 2026
10 checks passed
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