Enum ExhaustionPolicy
Defines how a component responds when a bounded resource reaches its limit.
public enum ExhaustionPolicy
Fields
Degrade = 4Continue with reduced performance or functionality.
Use when:
- A fallback exists (slower but correct)
- Failure is worse than degradation
- The situation is temporary
Examples: Transaction pool empty → allocate new, compression buffer unavailable → skip compression.
Evict = 3Remove least-recently-used entry, retry.
Use when:
- Entries can be recreated (cache semantics)
- Eviction has bounded cost
- The resource is self-healing
Examples: Page cache (evict clean pages first), chunk accessor MRU cache.
FailFast = 1Throw ResourceExhaustedException immediately.
Use when:
- The caller can handle failure gracefully
- Queueing would make the problem worse
- The resource represents edge capacity (client-facing)
Examples: Transaction creation beyond max, query memory allocation beyond limit.
None = 0No policy — used for intermediate/structural nodes that don't own a bounded resource.
This is the default value (
default(ExhaustionPolicy) == None).Subsystem grouping nodes (e.g., "Storage", "DataEngine") use this sentinel because they don't directly manage capacity — their children do.
Wait = 2Block caller until resource becomes available. Respects
Deadline.Use when:
- The resource will become available soon
- Blocking is acceptable (not on UI thread, has timeout)
- The alternative is worse (losing durability)
Examples: Page latch acquisition, WAL ring buffer space.
Remarks
Exhaustion policies are hardcoded per component based on their semantics — they are not configurable. A cache must be able to evict; a durability buffer must wait; a client-facing limit must fail fast.
Some components use multiple policies in sequence (e.g., PageCache tries Evict first, then Wait if all pages are pinned).