Skip to content

fix(anvil): honor max on-disk state limit as inclusive cap#14463

Open
cuiweixie wants to merge 1 commit intofoundry-rs:masterfrom
cuiweixie:fix/anvil-on-disk-history-limit
Open

fix(anvil): honor max on-disk state limit as inclusive cap#14463
cuiweixie wants to merge 1 commit intofoundry-rs:masterfrom
cuiweixie:fix/anvil-on-disk-history-limit

Conversation

@cuiweixie
Copy link
Copy Markdown
Contributor

Summary

InMemoryBlockStates::enforce_limits documents max_on_disk_limit as the maximum number of states kept on disk. The on-disk eviction loop used oldest_on_disk.len() >= max_on_disk_limit, which removed an entry as soon as the count reached the limit, so the cache could hold at most N−1 entries.

Evict only when the length is strictly greater than the limit so up to N states may remain, matching the documented semantics.

Test plan

  • cargo check -p anvil

enforce_limits evicted while oldest_on_disk.len() >= max_on_disk_limit,\nso the queue never reached the configured maximum (effective cap was\nN-1). Only purge when the count is strictly greater than the limit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant