Skip to content

feat: clean API shutdown, /health states and shared CLI exit codes - #97

Merged
mattmattox merged 9 commits into
mainfrom
claude/api-shutdown-cli-consistency
Nov 13, 2026
Merged

mattmattox merged 9 commits into
mainfrom
claude/api-shutdown-cli-consistency

Conversation

@mattmattox

Copy link
Copy Markdown
Contributor

Behaviour changes:

  • goclusterfs-mount -debug now prints the [DEBUG] lines, which are off by default. go-fuse tracing moved to -fuse-debug.
  • Exit codes: mount now exits 8 on failure and 16 on usage (was 1). gfsctl health exits 1 when degraded (was 0) and 4 when unhealthy (was 1). fsck exits 16 on a bad flag (was 2).
  • /health was always ok. It now reports 200 degraded or 503 unhealthy.

Not covered: the API starts after the mount's own journal replay, so a mount that is still starting refuses connections. A busy unmount on SIGTERM keeps the mount running without its API.

🤖 Generated with Claude Code

API shutdown: the server counts every request, closes its listener on Stop,
gives requests in flight ShutdownTimeout to finish, then cancels their
contexts and closes their connections, and returns only after every handler
and the serve goroutine have ended. Mount stops the API before the unmount on
SIGINT/SIGTERM and closes the filesystem only after the unmount, in one
place; a busy unmount no longer leaves a closed filesystem mounted.

/health: device (last I/O failed: unhealthy), journal (corrupt: unhealthy,
recovering: degraded), recovery (replaying a crashed peer: degraded) and
broadcast (send failing or no multicast and no peers: degraded). Degraded
answers 200, unhealthy 503. gfsctl health decodes the 503 body.

CLIs: goclusterfs-mount, goclusterfs-fsck and gfsctl share exit codes
(0 ok, 8 failure, 16 usage; fsck adds 1 and 4, gfsctl health 1 and 4),
error messages say what to do next, and -debug prints [DEBUG] lines in all
three. Mount's [DEBUG] lines are now off by default; go-fuse tracing moved
to -fuse-debug. fsck no longer exits 2 on a bad flag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mattmattox
mattmattox force-pushed the claude/api-shutdown-cli-consistency branch from 1a58851 to 85829bc Compare November 13, 2026 20:16
mattmattox and others added 8 commits November 13, 2026 14:36
… match

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…li-consistency

# Conflicts:
#	internal/goclusterfs/fs.go
…li-consistency

# Conflicts:
#	docs/API-CONFIG.md
#	docs/OPERATIONS.md
…li-consistency

# Conflicts:
#	tests/test-manifest.yaml
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…li-consistency

# Conflicts:
#	internal/cache/broadcast/transport.go
#	internal/node/registry.go
#	internal/storage/device.go
#	internal/storage/device_test.go
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mattmattox
mattmattox merged commit a6e7260 into main Nov 13, 2026
19 checks passed
mattmattox added a commit that referenced this pull request Nov 13, 2026
Deletes the internal/api errcheck rule and fixes the two findings in
#97's lifecycle_test.go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mattmattox added a commit that referenced this pull request Nov 13, 2026
#97's test still used the old AddPeer(uuid, addr) form.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mattmattox added a commit that referenced this pull request Nov 13, 2026
…116)

- sfb logs container lock release failures as dir and inode do, and a
  container block it cannot free on rollback is now named in the error.
  SFB allocation is disabled, so this only matters for old images.
- fileops discards close errors explicitly: it opens only read-only
  descriptors and gets every result from Fstat or Fsetxattr first.
- Test setup in fileops and cache checks or discards errors explicitly.

errcheck now covers internal/sfb and internal/fileops. internal/cache
waits for cache/broadcast/transport.go, which #97 is editing.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
mattmattox added a commit that referenced this pull request Nov 13, 2026
…ges (#119)

* fix(cache): bound every cache and broadcast table, with flags and gauges

The broadcast peer table kept one entry per sender UUID and never dropped
one, so every remount and every forged heartbeat grew it. Peers are now
kept by address and, like the per-sender sequence tracking, capped at
-broadcast-max-peers (256), dropping the node heard from longest ago.

The inode, extent and negative caches were LRUs of fixed size, but their
Go maps kept the room of evicted keys: the extent cache took 5.8 MB when
full and 10.9 MB after 40 times its size went through it. Each shard now
rebuilds its map after evicting as many entries as it holds.

-cache-inodes, -cache-extents and -cache-negative set the cache sizes,
and /metrics reports each limit plus the broadcast table sizes.

The create-collision readback no longer waits through read errors other
than a missing file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(broadcast): add the peer in problem_test by address

#97's test still used the old AddPeer(uuid, addr) form.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <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