Metadata manager pr5 (#1930)
# Metadata Manager PR5 Summary This is the tip of the stack, so the change is described against main. Replaces the agent's inline metadata-exchange path with an internal, agent-owned nixlMDManager that owns a worker thread and routes each call to a pluggable, self-contained backend (P2P, ETCD, or TCPStore). The public nixlAgent metadata API is unchanged: callers still use the same sendLocalMD, sendLocalPartialMD, fetchRemoteMD, and invalidateLocalMD calls with nixl_opt_args_t. On main, P2P and ETCD metadata exchange is implemented inline in nixlAgent on top of a shared comm-worker thread, with the socket and etcd helpers living in nixl_listener.cpp, and there is no TCPStore transport. This change factors all of that behavior behind a nixlMetadataBackend contract, moves the worker thread into the manager, deletes nixl_listener.cpp, and adds a TCPStore backend. Observable behavior of the existing P2P and ETCD paths is preserved. ## What? Adds the internal manager/backend layer for metadata exchange and three self-contained backends (P2P, ETCD, TCPStore), and removes the inline metadata path and the shared comm worker. The manager is owned by nixlAgentData and is not part of the installed public API. TCPStore is a new centralized-store option alongside ETCD. ## Why? On main the metadata transport is entangled with the agent and a shared comm thread, so each transport's details live inside nixlAgent and nixl_listener.cpp. This creates a clean boundary: the manager owns scheduling and threading, each backend owns its transport and I/O, and adding a new backend is one class behind the contract with no agent-side or public-API changes. ## How? Manager - nixlMDManager is owned by nixlAgentData and is the single path for all metadata exchange (the env opt-in and the inline fallback are gone). It owns one worker thread and routes each call by precedence: a peer address selects P2P, otherwise the configured name-addressed store backend. Backends - nixlMetadataBackend defines the transport boundary. Three implementations: P2P owns its sockets and listener, ETCD owns its nixlEtcdClient, and TCPStore owns an in-house c10d client (no libtorch). Each backend is self-contained and runs its blocking I/O on the worker; serviceEvents() drives the watch / accept / read loops for backends that need them. Contract - the prepare* methods run on the caller thread: they validate and serialize, return a synchronous status, and hand back the transport work as a nixlWorkerTask. The task and serviceEvents() run on the manager's worker thread. needsWorker() gates whether the worker runs for a given backend. Cutover - nixl_listener.cpp (the comm-worker loop plus the socket and etcd helpers) is deleted. Its loop moves into the manager's worker, the socket helpers move into the P2P backend, and the nixlEtcdClient moves into the ETCD backend. nixlAgentData drops its comm-thread members and instead implements nixlMetadataContext (getLocalMD / getLocalPartialMD / loadRemoteMD / getName / getConfig / invalidateRemoteMD / submitTask) for the backends. Scope - No public API change. Existing P2P and ETCD behavior is preserved, and all transport I/O now runs on the manager's worker instead of the agent comm thread. TCPStore is new and behaves like the other centralized store: fetchRemoteMD returns immediately and the caller polls checkRemoteMD, so fetch semantics are uniform across P2P, ETCD, and TCPStore. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a centralized agent metadata manager that unifies peer-to-peer metadata exchange with centralized backends (ETCD and TCPStore). * Supports full and partial local metadata publishing, remote metadata fetch, and remote metadata invalidation. * **Bug Fixes** * Reworked metadata routing and lifecycle to provide more consistent startup/shutdown behavior and reliable remote invalidation/removal semantics. * **Tests** * Added/expanded GTest coverage for manager routing, P2P visibility, and ETCD/TCPStore publish/fetch/invalidate behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Asaf Schwartz <aschwartz@nvidia.com> Co-authored-by: Colin Hirsch <chirsch@nvidia.com>
A
aschwartz12 committed
2ff0105f98a41624b1bc8259fe1697e00efa1c13
Parent: 6e35da5
Committed by GitHub <noreply@github.com>
on 8/17/2026, 9:20:07 AM