Skip to content

feat(bigtable): sweep stale accelerator daemon tempdirs at startup - #16

Open
mutianf wants to merge 2 commits into
accel-14-user-agent-and-stress-selfmanagefrom
accel-15-stale-tempdir-sweep
Open

feat(bigtable): sweep stale accelerator daemon tempdirs at startup#16
mutianf wants to merge 2 commits into
accel-14-user-agent-and-stress-selfmanagefrom
accel-15-stale-tempdir-sweep

Conversation

@mutianf

@mutianf mutianf commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Top of the accelerator stacked-PR chain (on top of accel-14).

What

At AcceleratorDaemon.start(), before minting a new tempdir, sweep leftover
bt-accel-* tempdirs from daemons that crashed without running close().

Why

A daemon killed without a clean shutdown (SIGKILL, OOM, host reboot) leaves its
tempdir — socket, identity.json, daemon.log — behind in $TMPDIR. Over a
long-lived host these accumulate. The sweep reclaims them at the next client
startup.

How it decides a dir is stale

Keyed off the daemon.log marker inside each bt-accel-* dir (not just the dir
prefix), a dir is removed only when all hold:

  • it has a daemon.log (so it's really one of ours, mid-lifecycle),
  • the log's mtime is older than 60s (avoid racing a daemon still starting up),
  • its sock is not connectable (a live daemon owns it — never touch it).

Best-effort: any OSError on a given dir skips it silently.

Tests

TestSweepStaleTempdirs (5 tests): removes a stale dir, keeps a young dir,
ignores a dir without the log marker, keeps a dir with a live socket, and
confirms start() invokes the sweep. Full accelerator unit suite green.

@mutianf
mutianf force-pushed the accel-14-user-agent-and-stress-selfmanage branch from 7d34ca7 to 280aef6 Compare August 12, 2026 14:07
@mutianf
mutianf force-pushed the accel-15-stale-tempdir-sweep branch from cd69e5e to e030425 Compare August 12, 2026 14:07
@mutianf
mutianf force-pushed the accel-14-user-agent-and-stress-selfmanage branch from 280aef6 to 650d65e Compare August 12, 2026 18:56
@mutianf
mutianf force-pushed the accel-15-stale-tempdir-sweep branch from e030425 to a282495 Compare August 12, 2026 18:56
@mutianf
mutianf force-pushed the accel-14-user-agent-and-stress-selfmanage branch from 650d65e to 41099ef Compare August 12, 2026 19:04
@mutianf
mutianf force-pushed the accel-15-stale-tempdir-sweep branch from a282495 to ac414ce Compare August 12, 2026 19:04
Change-Id: Ib373fb96c7f93160a118b5cebeaa4b1328f26886
… avoid contract-acceptable retry-straggler race

Change-Id: Ifb8d19946e0e53e4b61610094d79df2d0672eae0
@mutianf
mutianf force-pushed the accel-14-user-agent-and-stress-selfmanage branch from 41099ef to 4a98c76 Compare August 14, 2026 21:02
@mutianf
mutianf force-pushed the accel-15-stale-tempdir-sweep branch from ac414ce to 3ef4b2b Compare August 14, 2026 21:02
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