Repository navigation
fix: scope discovery informer known objects to each mesh - #1638
Conversation
robocanic
left a comment
There was a problem hiding this comment.
I traced the relist through DeltaFIFO.KnownObjects and the discovery store adapter. Filtering both ListKeys and GetByKey by exact mesh identity keeps another registry’s metadata out of replacement tombstones, while a missing key in the same mesh can still generate a delete. The regression tests cover both registry orderings and same-mesh stale deletion. I found no blocking issue in this change. The discovery package passed in Actions; the failing metric dashboard assertion is addressed separately in #1642.
…k-service-catalog
|
把 informer 用于对账的已知对象限定在当前 mesh,修复方向是对的。建议在 这个改动可以放在 discovery 层: keys, err := s.ResourceStore.IndexKeys(index.ByMeshIndex, s.mesh)
if err == nil {
return keys
}
// 记录索引查询错误,回退到现有的按 mesh 精确过滤的扫描逻辑。内存后端已经能通过索引直接返回 key。GORM 也能把查询范围缩小到当前 mesh,不过现有的 建议保留扫描作为出错时的回退路径。 |
A relist only needs the keys of the informer's mesh, but ListKeys scanned every mesh, which SQL stores load and decode in full. Read the keys from the mesh index, or, for the GORM store, from the indexed mesh column of its rows, since the index table can briefly miss rows while a replica rebuilds it. A failed lookup falls back to the scan, since an empty result would skip deleting stale objects.
|
done |
|



Please provide a description of this PR:
Discovery informers list resources for one mesh, but use a resource store shared across meshes. During a list replacement, an informer can therefore treat another mesh's resources as deleted. For example, a Nacos refresh can remove ZooKeeper service metadata from the Admin catalog even though the ZooKeeper nodes still exist.
Scope each discovery informer's known-object view to its mesh. Both ListKeys and GetByKey use exact mesh identity, while stale-resource deletion and watch updates/deletions within the same mesh remain unchanged. The change stays within discovery and does not modify the shared controller.
Tests cover both cross-mesh ordering directions, mesh names containing slashes, stale-resource deletion, watch updates/deletions, and relisting. The regression fails on the original implementation and passes with this change. Targeted tests, race tests, vet, and lint for the changed package pass.
Real Nacos/ZooKeeper checks passed after two independent Admin restarts using this patch. Service lists, details, methods, and non-IDL invocation remained available.
The adapter scans the existing per-kind List view. It does not change the store's existing list-error handling contract.
To help us figure out who should review this PR, please put an X in all the areas that this PR affects.
Please check any characteristics that apply to this pull request.