robocanic commented on PR #1638:
URL: https://github.com/apache/dubbo-admin/pull/1638#issuecomment-7073503329

   Scoping the informer's known objects to its mesh looks right. Could we use 
the existing mesh index in `meshScopedStore.ListKeys()`? The current 
implementation calls `s.List()` on every relist. With MySQL or PostgreSQL, that 
reads and deserializes every resource of this kind across all meshes just to 
collect keys for one mesh.
   
   The change can stay in discovery:
   
   ```go
   keys, err := s.ResourceStore.IndexKeys(index.ByMeshIndex, s.mesh)
   if err == nil {
       return keys
   }
   // Log the lookup error and fall back to the existing exact-mesh scan.
   ```
   
   The memory store already returns keys directly from this index. GORM would 
limit the lookup to entries for the requested mesh, though its current 
`IndexKeys` implementation still loads the matching objects to extract their 
keys. A keys-only SQL query could be a separate optimization.
   
   I'd keep the current scan as the error fallback because `ListKeys()` cannot 
return an error. Returning an empty slice on an index failure would skip 
stale-object cleanup for that relist. A successful lookup with zero matches can 
return immediately.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to