You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After an HNSW generation is updated through asynchronous CDC on one CN, another CN that has already loaded the previous generation can continue serving the stale in-memory model. The metadata checksum changes and the CDC consumer processes the complete delta, but the query CN does not converge to the new generation within the BVT deadline.
Actual Behavior
In test/distributed/cases/pessimistic_transaction/vector/vector_hnsw_async.sql:
The first 10,000-row f32 generation is built.
A query on the query CN loads the first generation into the HNSW model cache.
A second 10,000-row CDC load is processed asynchronously. The consumer processes the 8,192-row and 1,808-row fragments and publishes a changed metadata checksum.
The query CN continues returning an old-generation nearest neighbor, for example 2638, instead of the delta endpoint 19999 for the full 120-second wait window.
The old test implementation explicitly documented the multi-CN limitation: the model is cached in memory and may not be refreshed after CDC synchronization if a query has already loaded it.
Expected Behavior
When a newer HNSW generation becomes visible through the shared metadata/index storage, every CN must either:
invalidate or replace its cached older generation before serving the next indexed query; or
reject/defer the stale cache and load the published generation within a bounded convergence interval.
A query issued after generation publication must be able to return rows introduced by that generation, including 19999 in the reproduction above.
Impact
This is a correctness issue for distributed ANN queries, not only a performance or recall fluctuation. A CN can return results from an older data snapshot after the index update has been published, causing newly inserted rows to be invisible and nearest-neighbor results to be wrong until cache refresh or CN restart.
For exact-result checks, force a full scan with BY RANK WITH OPTION mode=force where supported.
Restarting or routing to a CN without the old cache may clear the symptom, but is not an acceptable production workaround.
Suggested Investigation
Make the HNSW cache key include the published metadata generation/checksum and compare it on every indexed query.
Trace cache ownership and invalidation across CN-local consumers, model loaders, and query execution.
Ensure old model handles cannot remain reachable after a newer generation is published.
Add a native multi-CN integration test that warms the query CN cache, publishes CDC on another CN, and verifies the query CN observes the new generation.
Acceptance Criteria
A warmed query CN observes the new HNSW generation after CDC publication on a different CN.
The test passes repeatedly with two or more CNs and with parallel 8,192/1,808-row delta fragments.
No stale result is returned after the bounded convergence/readiness signal.
Cache replacement is generation-safe: no stale handle, double-close, leak, or unbounded model retention.
Is there an existing issue for the same bug?
Branch Name
main
Commit ID
5bc051a
Other Environment Information
Summary
After an HNSW generation is updated through asynchronous CDC on one CN, another CN that has already loaded the previous generation can continue serving the stale in-memory model. The metadata checksum changes and the CDC consumer processes the complete delta, but the query CN does not converge to the new generation within the BVT deadline.
Actual Behavior
In
test/distributed/cases/pessimistic_transaction/vector/vector_hnsw_async.sql:2638, instead of the delta endpoint19999for the full 120-second wait window.Evidence:
The old test implementation explicitly documented the multi-CN limitation: the model is cached in memory and may not be refreshed after CDC synchronization if a query has already loaded it.
Expected Behavior
When a newer HNSW generation becomes visible through the shared metadata/index storage, every CN must either:
A query issued after generation publication must be able to return rows introduced by that generation, including
19999in the reproduction above.Impact
This is a correctness issue for distributed ANN queries, not only a performance or recall fluctuation. A CN can return results from an older data snapshot after the index update has been published, causing newly inserted rows to be invisible and nearest-neighbor results to be wrong until cache refresh or CN restart.
Current Workaround
BY RANK WITH OPTION mode=forcewhere supported.Suggested Investigation
Acceptance Criteria