|
@@ -642,6 +642,8 @@ docker run -d --name svapi-dev -p 8080:8080 -e SMARTBOTIC_VECTORAPI_KEY=dev svap
|
|
|
**`estimated` ROSE +18 MB AGAINST A ~40 MiB PRICE, AND THE EXPLANATION IS NOT ANY OF THE THREE I OFFERED - THE 1,970 VECTORS WERE ALREADY IN MEMORY AND HAD BEEN ALL ALONG, SO ADOPT ADDED NOTHING FOR THEM.** I sent upstream three candidate readings (the vector branch did not fire / `storeVector` does not increment on this path / `estimated` is a per-doc heuristic) and named the first as the one to rule out first because it was the only one where vectors would still be LMDB-only. They answered from their code with a fourth that rules out all three: **eviction never touches `coll.vectors`, and the snapshot writes a collection's VECTOR section independently of its documents** - so when the old writer dropped an evicted document's body, the vector stayed in memory, every later snapshot carried it, and every boot loaded it back through the uncounted `loadVector`. At adopt, `storeVector` found the entry already there and added `new - old` = 16,416 - 16,416 = **0**.
|
|
**`estimated` ROSE +18 MB AGAINST A ~40 MiB PRICE, AND THE EXPLANATION IS NOT ANY OF THE THREE I OFFERED - THE 1,970 VECTORS WERE ALREADY IN MEMORY AND HAD BEEN ALL ALONG, SO ADOPT ADDED NOTHING FOR THEM.** I sent upstream three candidate readings (the vector branch did not fire / `storeVector` does not increment on this path / `estimated` is a per-doc heuristic) and named the first as the one to rule out first because it was the only one where vectors would still be LMDB-only. They answered from their code with a fourth that rules out all three: **eviction never touches `coll.vectors`, and the snapshot writes a collection's VECTOR section independently of its documents** - so when the old writer dropped an evicted document's body, the vector stayed in memory, every later snapshot carried it, and every boot loaded it back through the uncounted `loadVector`. At adopt, `storeVector` found the entry already there and added `new - old` = 16,416 - 16,416 = **0**.
|
|
|
**So the ~31 MiB "permanent cost" was never real, and the price of adopt was the bodies alone.** `estimated` is a sum of per-row estimates rather than an average-based heuristic - my reading (3) was half right - and `estimateDocumentSize` sizes the PARSED TREE at roughly 2x the JSON bytes, which turns 8.8 MiB of sampled bodies into ~18 MB and matches the observation exactly. Their earlier "expect `estimated` to fall ~31 MiB after the next restart" is void with it: **expect no step there**, and do not read its absence as something having gone wrong.
|
|
**So the ~31 MiB "permanent cost" was never real, and the price of adopt was the bodies alone.** `estimated` is a sum of per-row estimates rather than an average-based heuristic - my reading (3) was half right - and `estimateDocumentSize` sizes the PARSED TREE at roughly 2x the JSON bytes, which turns 8.8 MiB of sampled bodies into ~18 MB and matches the observation exactly. Their earlier "expect `estimated` to fall ~31 MiB after the next restart" is void with it: **expect no step there**, and do not read its absence as something having gone wrong.
|
|
|
**The useful consequence is that a VECTOR OUTLIVES ITS OWN DOCUMENT BODY IN MEMORY, which widens the headroom defect rather than narrowing it.** Vectors are uncounted at boot, are never freed by eviction, and survive the eviction of the row they belong to - so prod's ~615 MiB of resident vectors is not merely missing from `237 MB estimated (46%, pressure=normal)`, it is missing in a way no amount of eviction can reduce. The lesson for next time is about the shape of the question, not the number: **three readings offered with one named as "rule this out first" still missed the answer, because all three assumed the adopt path was what put the vectors there.** The premise under all of them went unstated and therefore unchecked, and only the owner of that code could see it.
|
|
**The useful consequence is that a VECTOR OUTLIVES ITS OWN DOCUMENT BODY IN MEMORY, which widens the headroom defect rather than narrowing it.** Vectors are uncounted at boot, are never freed by eviction, and survive the eviction of the row they belong to - so prod's ~615 MiB of resident vectors is not merely missing from `237 MB estimated (46%, pressure=normal)`, it is missing in a way no amount of eviction can reduce. The lesson for next time is about the shape of the question, not the number: **three readings offered with one named as "rule this out first" still missed the answer, because all three assumed the adopt path was what put the vectors there.** The premise under all of them went unstated and therefore unchecked, and only the owner of that code could see it.
|
|
|
|
|
+ **SCOPED TO 2.21.1 AND EARLIER, WHICH IS WHAT PROD RUNS TODAY: DATABASE 2.21.2 MAKES EVICTION RELEASE A DOCUMENT'S VECTOR TOO, AND COUNTS VECTORS WHEREVER THEY ENTER MEMORY INCLUDING BOOT.** The claim above was accurate when measured and the mechanism it describes is why 2.21.2 exists, so it is labelled rather than rewritten. From 2.21.2 an eviction releases body AND vector - but **only while the LMDB mirror is healthy with zero drift**, a reload reads the vector back from LMDB, and eviction candidates are sized body plus vector. The snapshot writer changes with it, for the vector section only: it writes resident vectors plus released ones read back from LMDB, a batch at a time under the collection lock, where it used to iterate the live map with NO lock. Format stays v4 in both directions. **The one-way edge on a rollback: a vector deleted while a 2.21.2 snapshot is being written becomes a zero-length entry, which a 2.21.2 loader skips and a 2.21.1 loader stores as an EMPTY vector that scores nothing** - findable by id, retrievable by no search, which is exactly the unsearchable-junk-row failure this file already records. So the door is still two-way for reading and is NOT clean for vectors, and a downgrade wants a search-based read-back rather than a count.
|
|
|
|
|
+ **AND THE ACCOUNTING CHANGE IS A STEP THAT MUST BE PLANNED BEFORE THE FIRST BOOT, BECAUSE THE HONEST NUMBER BREACHES A BUDGET THE DISHONEST ONE FITTED.** Prod's `storage.memory.max_memory_mb` is **512** with soft 70 / hard 85 / emergency 95, and the live line reads `272 MB estimated (53%, pressure=normal)` - counting bodies only. Measured rather than assumed, all five vector collections on prod are dim 4096 (`justice-pa:facts` 121, `justice-pa:summaries` 66, `novitax:kb_chunks` 13014, `novitax:kb_fact_answers` 13093, `novitax:kb_facts` 13093), so 39,387 rows x 16,416 B = **647 MB** of vectors join the estimate and it becomes ~919 MB, i.e. **179% of 512 - past the 95% emergency line, where writes answer RESOURCE_EXHAUSTED until eviction has drained.** Nothing about the box changes; only the measurement does, which is the point worth keeping: **a budget that was never counting the largest thing in the store was never a budget, and the release that starts counting it is the release that appears to break it.**
|
|
|
**RSS IS DELIBERATELY NOT QUOTED AS THE COST: 1232 MB was a 19-hour-old process and 1595 MB is a fresh boot**, so that difference is the restart. `VmHWM` moving 1,771,136 -> 1,780,676 kB is the only clean statement available and says the boot peak barely changed. Box-wide swap in use FELL, 646 MB to 259 MB.
|
|
**RSS IS DELIBERATELY NOT QUOTED AS THE COST: 1232 MB was a 19-hour-old process and 1595 MB is a fresh boot**, so that difference is the restart. `VmHWM` moving 1,771,136 -> 1,780,676 kB is the only clean statement available and says the boot peak barely changed. Box-wide swap in use FELL, 646 MB to 259 MB.
|
|
|
**Provenance survives adoption, and it had to be checked rather than assumed:** `justice-pa:facts/01a116ef1b2edf735dd281c3f564` reads back at `_version` 2 with `_created_by` still `fn:justice-pa/compress`, control a neighbouring id that never existed still `not found`. An adoption that took the insert path would have re-created rows at version 1 with a fresh creator - which is exactly the pre-2.20.2 ghost-clobber behaviour, and novitax now depends on `_created_by` as their only after-the-fact attribution channel.
|
|
**Provenance survives adoption, and it had to be checked rather than assumed:** `justice-pa:facts/01a116ef1b2edf735dd281c3f564` reads back at `_version` 2 with `_created_by` still `fn:justice-pa/compress`, control a neighbouring id that never existed still `not found`. An adoption that took the insert path would have re-created rows at version 1 with a fresh creator - which is exactly the pre-2.20.2 ghost-clobber behaviour, and novitax now depends on `_created_by` as their only after-the-fact attribution channel.
|
|
|
**WHAT IS STILL OWED, WITH ITS TRIGGER: the POINT of adopt is that the next SNAPSHOT carries these rows, and that is provable only at the next boot reporting `disk_only: 0`.** Verified today is "adopted into memory", not "carried by a snapshot", and the two must not be conflated in a later reading of this entry.
|
|
**WHAT IS STILL OWED, WITH ITS TRIGGER: the POINT of adopt is that the next SNAPSHOT carries these rows, and that is provable only at the next boot reporting `disk_only: 0`.** Verified today is "adopted into memory", not "carried by a snapshot", and the two must not be conflated in a later reading of this entry.
|