[manager/meta] support V6D and subscriber reporting for multi-engine instances - #306
Open
lucky-zzz wants to merge 1 commit into
Open
[manager/meta] support V6D and subscriber reporting for multi-engine instances#306lucky-zzz wants to merge 1 commit into
lucky-zzz wants to merge 1 commit into
Conversation
lucky-zzz
requested review from
MMeecatfish,
Tyndalllll,
charpty,
oldsharp and
wangxiyu191
as code owners
August 25, 2026 11:42
There was a problem hiding this comment.
Review Summary
Overall assessment: Solid, well-scoped change. The rank-suffix reporter identity, the shared-L2 → active-L1P5 projection, and the physical-vs-logical split for Vineyard peers are all implemented cleanly and covered by a comprehensive test. I don't see correctness bugs; the observations below are minor.
Lifetime / pointer safety
HostCacheLocationInfo::logical_hostsis a rawconst std::vector<std::string> *, but it points intoEventVisibilitySnapshot::logical_hosts_by_reporter, which lives inside theevent_snapshotsshared_ptr captured by the checker lambda. SinceVisitHostSpecsForOneKeyuseslocation_infoonly within the same callback invocation, the pointer is valid for its entire use. ✓reporter_hostis astd::string_viewinto the snapshot's location-id buffer; the snapshot is held alive by the same shared_ptr capture. ✓
ParseReporterIdentity
- The rejection rules (empty rank, leading zero, duplicate
@, non-digit, trailing chars) are all covered by the test cases@,@-1,@rank,@00,@0@1. - Using
uint64_tfor rank matches the rest of the codebase and avoids surprises for very large ranks. - One tiny nit: in the caller at
cache_manager.cc:2705,ReporterIdentityView reporter_identity;is default-initialized and then passed by reference; since its value isn't used downstream ofReportEvent, consider dropping the local and passing an anonymous temporary, or at least marking it(void)to make the "validation-only" intent obvious to readers.
Projection logic (cache_manager.cc:4667-4702)
- Building
ranked_hosts_by_basefrom L1P5 and then fillinglogical_hosts_by_reporterper storage type is correct. The L2-only projection condition (parsed && storage_type == L2 && !identity.engine_rank.has_value()) matches the design: only a shared, unranked L2 reporter fans out to every active ranked engine. - The sort + unique on
ranked_hostsis defensive;ranked_hosts_by_baseis built by iterating each reporter once, so duplicates aren't expected in normal operation. Fine as-is. - Style nit: in
for (auto &[base, ranked_hosts] : ranked_hosts_by_base) { (void)base; ... }, the binding could beconst auto &[base, ranked_hosts](and drop the(void)base) since neither is mutated, or just useauto &[_, ranked_hosts]if the toolchain supports C++26 structured bindings with_. Same for the(void)state;silencers.
Visitor signature change (meta_searcher.cc)
- Adding a fourth
physical_reporterargument and keyingvineyard_host_specsbyphysical_reporteris the correct move: a shared L2 reporter projected onto N logical ranks must still yield exactly one Vineyard P2P peer, not N. The new comment atmeta_searcher.cc:626-628explains this well. - For non-event-report locations, the caller passes
std::string_view(host)twice (logical and physical), which preserves prior behavior. ✓ - All four existing callers (
BuildHostsForOneKey,BuildCandidatePresenceForOneKey,BuildHostSpecNamesForOneKey,PrefixMatchWithMambaByHostWithoutP2P) are updated;VisitHostSpecsForOneKeyis a file-local template so no out-of-TU breakage is possible. ✓
Tests
- Three cases (ordinary / multi-engine independent / multi-engine shared) plus invalid-reporter coverage and a rank-lifecycle sequence. The
GetCacheLocationsByBackendassertion in Case 3 is the right check that the data-access path does not get rewritten by the query-only projection — good regression guard. - One optional gap: no test exercises L1P5 shared (unranked) with ranked L2. That configuration isn't part of the design (the asymmetry is intentional: L1P5 = subscriber identity, L2 = shared Vineyard), so this is more of a "nice to have" negative test to lock in that no projection happens in the reverse direction.
Non-blocking observations
host_ip_portis reused as both a location-id component and a reporter identity. The@character is accepted bySnapshotUriUtils::IsValidLocationIdComponent(otherwise the parse wouldn't see ranked input), worth a quick mental check that no downstream URI/snapshot builder chokes on it. The test URIs useevent_report://host:port/memwithout@, so the location URIs themselves stay clean.- The PR description says "111 passed, 1 skipped"; consider running the integration test suite too (
//integration_test/...) if not already done, sincemeta_searcher.ccis exercised by cross-module scenarios.
No blocking issues; feel free to merge once the (optional) nits are considered.
🤖 Generated by Qoder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary: support ranked reporter identities for multi-engine instances; project shared V6D cache locations onto active engine reporters while preserving the physical Vineyard peer; cover normal, non-shared V6D, and shared V6D reporting scenarios. Test: bazel test //kv_cache_manager/... (111 passed, 1 skipped).