Commit Graph
4 Commits
Author SHA1 Message Date
pingqiuandClaude Opus 5.5 d7377311f2 hostlimit: fetch test ownership and the waiting-path control
- The fetch child keeps its release (and so the slot's file) reachable
  while it lives, with forced collections before it reports HELD.
- The ended-waits test registers every release at once, and its second
  half frees the other slot only once each fetch is already waiting, so
  the waiting path's success is what is checked.
- The competing fetches derive from a cancellable context, and cleanup
  joins them within a bound.
- Comments: one fetch polls per limiter (blockvolume makes one per
  process); a configuration check in progress can add its bounded guard
  wait after the context ends.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 12:32:20 -08:00
pingqiuandClaude Opus 5.5 ea127a0181 hostlimit: fetch waits are non-blocking, checked and bounded
- A limiter's first fetch checks the host configuration under
  configuration.lock, publishing it when absent (configGuard, now shared
  with cut admission): a fetch-only process with other flags gets ErrConfig.
- No blocking lock: with every slot held, one fetch per process polls
  every slot each 20 ms (the others wait for its turn, within their
  context). An ended wait leaves no lock request, descriptor or goroutine;
  lockBlocking is removed.
- The waiting is unordered and bounded by the caller's context alone; the
  docs say so instead of promising a kernel queue.
- A slot taken when the context has already ended is given back, with the
  context's error.
- INV-HOST-FETCH-CAP-001, M7 and the v1.1 note state the contract.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 12:20:40 -08:00
pingqiuandClaude Opus 5.5 5a57e8564d hostlimit, storage: chunk fetches are capped per host
- hostlimit: Config.FetchSlots (default 64, files fetch-0..N-1 in the pool).
  HoldFetch takes a free slot without waiting, from the key's hash slot;
  with every slot held it blocks on its hash slot (the kernel queues the
  waiters) and tries the other slots every 20 ms, using whichever lock comes
  first and releasing the other; its context bounds the wait, and a lock got
  after that is released at once. lockBlocking on Unix and Windows.
- storage: BudgetFetch; fillOnce holds one slot across its remote read only
  (a read miss and a hydrate-all fill alike); a context error on the wait is
  the hydration path's pending, as before.
- blockvolume: --host-limit-fetch-slots. Invariants: INV-HOST-FETCH-CAP-001;
  M7 states it. v1.1 notes carry it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 11:52:37 -08:00
pingqiuandClaude Opus 5.5 9391166b25 hostlimit, storage: red tests, a per-host cap on chunk fetches
Seams: Config.FetchSlots (default 64), fetchSlot (a key's hash slot),
Limiter.HoldFetch (no cap yet) and storage.BudgetFetch.

- TestHoldFetchCapHoldsAcrossProcesses: with every slot held by other
  processes, a fetch waits until one is released, then takes it. Fails here.
- TestHoldFetchAWaiterThatGivesUpLeavesNoSlotHeld: a waiter past its context
  returns the context's error, and a slot it gets after is released at once.
  Fails here.
- TestHoldFetchTakesAnotherSlotThatFreesFirst: a waiter behind a slow holder
  of its own hash slot takes another slot within one retry interval of its
  release. Fails here.
- TestHoldFetchTakesAFreeSlotAtOnce: a fetch with a free slot does not wait
  (holds here, must keep holding).
- TestChunkFetchHoldsAHostSlotAroundItsRemoteRead: a chunk fetch holds one
  slot exactly across its remote read. Fails here: none is held.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 11:43:59 -08:00