Expand description
Resident access to HNSW indexes that eviction can drop from memory.
Eviction writes an index’s checkpoint to storage and removes it from
hnsw_indices. Every insert, search and delete reaches its index through
this module, which loads a stored index back before handing it out:
- [
lock_resident] locks the index map with the index loaded when storage holds one. - [
lock_resident_or_create] does the same, then creates an empty index only when neither memory nor storage holds one. Creating one over an evicted index would hide every vector it held.
A load awaits storage, so eviction can run between the load and the lock.
The eviction mark (VectorState::evicted) catches that: an index absent
from memory and still marked is loaded again before the lock is returned.