Repository navigation
Description
Problem
test/distributed/cases/pessimistic_transaction/vector/vector_hnsw_delete_insert.sql intermittently fails in multi-CN BVT. It waits up to 120 seconds for a warmed query CN to see an HNSW generation published by the asynchronous index worker. The default cross-CN freshness check runs roughly every 10 minutes, so the test's deadline does not match the current cache contract. Two waits can each consume 120 seconds and still report the old nearest neighbor.
Example: PESSIMISTIC BVT job, head 92a538e9e1de38d2a393c9eaf6af5f3146244d0b: after DELETE id=100 and INSERT id=2001, both wait_serve checks time out; the first nearest-neighbor query expects 2001 but returns 777.
Local reproduction and proposed direction
On macOS arm64 at the CI head, with matching rebuilt usearch native artifacts and 1 Log / 1 TN / 2 independent CN processes, warm the old HNSW model on both CNs. After the first delete/insert and a changed metadata checksum, one CN returned the updated 2001 while the other returned 777 for six consecutive seconds. After setting the existing mo_ctl('cn', 'SetVectorIndexFreshnessInterval', '1s'), both returned 2001 in about 4 seconds. A second delete/insert converged to 2002 on both CNs in about 3 seconds. The original graph checks returned 1000/1000/99 for the first cut and 1000/1000/498 for the second on both CNs. EXPLAIN showed Vector Index Scan on hv; CN logs showed stale marking and generation reload.
This local experiment used direct CN connections and autocommit; it did not execute the complete CI fixture, its explicit transaction, or the Linux/x86 proxy topology. The 4/3-second observations are not strict timing guarantees. The initial local run accidentally linked older native libraries and produced an invalid 901-row result; all evidence above comes from the subsequent matching, provenance-verified native rebuild.
Use the existing accelerated periodic freshness control in a test-owned isolated environment, as the fulltext2 BVT already does. Preserve the real periodic freshness check and actual HNSW result assertions; manual cache eviction is not a substitute. Check that the control reached every CN, and restore the prior/default setting even on failure or timeout. The control changes all CNs and shared vector/fulltext caches, so scope it to a serial/isolated fixture or provide reliable cleanup. Avoid holding a transaction snapshot that can obscure the expected generation; retain any separately needed transaction/proxy coverage with explicit semantics.
Acceptance criteria
- The regression exercises a warmed HNSW cache, two delete/insert cuts, durable publication and eventual serving-side convergence while retaining the original nearest-neighbor, cardinality, distinctness and reachability assertions.
- It exercises the real HNSW plan and periodic refresh; no forced eviction, forced full scan, weakened expected result, or unconditional long sleep masks the behavior.
- On the multi-process, multi-CN Linux BVT topology, demonstrate bounded completion with the shortened test-only cadence and verify behavior for failure/partial fan-out and cleanup. Restore the setting on every terminal path and avoid cross-test interference.
- Preserve the separate production freshness question in [Bug]: multi-CN HNSW query CN serves stale model after async generation update #27632; the test-only setting does not change or prove the production default convergence time.
Related: #27632 tracks cross-CN stale HNSW model behavior; #27629 is the older, closed async-BVT symptom. This issue is scoped to making the current delete/insert regression reliably and quickly testable.
Activity
XuPeng-SH commentedon Oct 27, 2026
fixed by #31457