fix(8.0): drive query-cap off MemAvailable + floor auto-detected caps
The auto-detected query-limit cap was computed from os.freemem() (MemFree), which excludes reclaimable page cache. On hosts that memory-map large index files the cache holding those pages dominates RAM, so MemFree collapses to a sliver and the cap cratered to its floor on perfectly healthy machines, rejecting legitimate find() calls. - getAvailableMemory() now prefers /proc/meminfo MemAvailable (counts reclaimable cache), falling back to os.freemem() off-Linux, then a 2 GB constant where no OS module is available. - Auto-detected caps (container + free-memory tiers) are floored at MIN_AUTO_QUERY_LIMIT (10_000); a transient low reading can never throttle queries to a near-useless ceiling. Consumer-supplied maxQueryLimit / reservedQueryMemory bypass the floor — an explicit caller knows their box. Also scrubs two stale comments referencing the removed cloud storage adapters and the retired mmap-vector backend: 8.0's native vector provider persists its own .dkann file via getBinaryBlobPath, so the old rootDirectory hook does not apply on this line. Tests: memoryLimits 26/26 (4 new floor regressions), unit 1398/1398, find-limits + db-mvcc + api-parameter-validation 37/37.
This commit is contained in:
parent
c605b34f98
commit
b26d3d42b3
3 changed files with 117 additions and 17 deletions
|
|
@ -770,10 +770,11 @@ export class Brainy<T = any> implements BrainyInterface<T> {
|
|||
|
||||
// Wire the connections codec (2.4.0 #3). When the graph:compression
|
||||
// provider is registered AND the metadata index exposes a stable
|
||||
// idMapper, inject a codec that encodes HNSW connections as
|
||||
// delta-varint blobs at save time and decodes on load. The blob
|
||||
// primitive itself works on every brainy 7.25.0 adapter, so unlike the
|
||||
// mmap-vector backend this layer engages even on cloud adapters.
|
||||
// idMapper, inject a codec that encodes JS HNSW connections as
|
||||
// delta-varint blobs at save time and decodes on load. It rides the
|
||||
// storage adapter's generic binary-blob primitive (both the filesystem
|
||||
// and memory adapters implement it), so it is independent of any native
|
||||
// vector provider's single-file on-disk format.
|
||||
this.wireConnectionsCodec()
|
||||
|
||||
// 8.0 generational MVCC: if crash recovery rolled back an uncommitted
|
||||
|
|
@ -10533,9 +10534,11 @@ export class Brainy<T = any> implements BrainyInterface<T> {
|
|||
* metadata index exposes a stable idMapper. Failures are non-fatal: HNSW
|
||||
* keeps working via the legacy JSON-array path.
|
||||
*
|
||||
* Unlike the mmap-vector backend, this layer does NOT require a real local
|
||||
* path — the binary-blob primitive saves the compressed bytes through the
|
||||
* storage adapter directly, so the codec is engaged on cloud adapters too.
|
||||
* This layer does NOT require a real local path — the binary-blob primitive
|
||||
* saves the compressed bytes through the storage adapter directly, so the
|
||||
* codec works on the memory adapter as well as filesystem. (A native vector
|
||||
* provider, by contrast, persists its own single `.dkann` file and has no
|
||||
* per-node connection lists, so it is skipped — see the feature-detect below.)
|
||||
* Format convergence is lazy: pre-2.4.0 nodes load via the legacy path,
|
||||
* then the next dirty save writes the compressed form (and the legacy
|
||||
* field of saveVectorIndexData becomes empty), so all reads converge over time
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue