Description of Changes
Before this change, a read could hit the resident-memory limit even when another table had evictable pages. The existing retry could only free memory from the page or blob set being accessed.
On a resident-memory error, ordinary datastore reads now request eviction of eligible committed pages and blobs, then retry once. This covers point lookups, equality and range scans, full-table scans, and reads used for view maintenance.
Iterators retry the same page or row rather than advancing again, so a failed attempt cannot cause a row to be skipped. Eviction runs after the failed access has released its temporary guards. Other errors propagate normally.
The change uses a borrowed eviction context to call the existing committed-state trimmer.
API and ABI breaking changes
None.
Rollback safety impact
n/a
Expected complexity level and risk
3
Retries must read the same row without skipping it, and must release temporary read locks before requesting eviction.
Testing
Manual.
Updated the keynote benchmark to use a 4MiB cache and updated transfer to read and compare a 2MiB string.
Loading the string forces a blob fault that needs 2 MiB of resident memory. The cache already contains account pages, leaving insufficient space.
So before this change:
- The indexed lookup finds the probe row, whose blob has been evicted to disk.
- Loading the blob needs a 2 MiB reservation.
- The blob store tries evicting other blobs, but there are none it can evict to make enough room.
- The accounts table has evictable pages occupying that same memory budget, but the blob store cannot evict those pages.
- The read returns
MemoryLimitExceeded, failing the transfer before any account updates.
After this change:
- The same read initially encounters the same allocation failure.
- Our read-retry handler asks the committed state to evict across tables.
- It evicts account pages, freeing enough memory.
- It retries the same lookup. The blob now fits, its contents are verified, and the transfer proceeds.