relay: move LF forwarder ownership to the publisher exec, off the registry - #522
relay: move LF forwarder ownership to the publisher exec, off the registry#522afrind wants to merge 1 commit into
Conversation
9bc3b55 to
3ef013e
Compare
832a337 to
a537cd2
Compare
afrind
left a comment
There was a problem hiding this comment.
@afrind made 7 comments.
Reviewable status: 0 of 6 files reviewed, 4 unresolved discussions.
src/MoqxRelay.h line 490 at r1 (raw file):
// Subsequent-subscriber seed (set only when !ownsRelayChain): the live publisher // forwarder's largest/extensions, read on the publisher exec. std::optional<moxygen::AbsoluteLocation> seedLargest;
I don't like "seed" here
src/MoqxRelay.cpp line 651 at r1 (raw file):
// Null handle => previous publisher already terminated and onPublishDone() tore it down; skip. if (evicted.handle && mode() == Mode::LocalForwarder) { // The old forwarder lives on its own exec (registry no longer holds it); unsubscribe and
We don't need comments explaining what we no longer do. Also "its own exec" "its publisher's exec"
src/MoqxRelay.cpp line 660 at r1 (raw file):
auto oldFwd = displacedLocalFwd; if (!oldFwd) { auto* localReg = tlForwarders_.get();
Add a one line comment explaining this case in a bit more detail. You can remove "using the displaced ref (same-exec) or tlForwarders_ (cross-exec)." above, in favor of a bit more detail here.
src/MoqxRelay.cpp line 885 at r1 (raw file):
} if (!forwarder) { return false;
Does this case warrant an error log?
src/MoqxRelay.cpp line 919 at r1 (raw file):
publisherExec, [pf = std::move(publisherFwd), ex = subscriberExec, re = relayExec]() noexcept { // lock on the pub exec: resolves the exact wired forwarder or null if it is gone.
You can add another line to help explain why it can be gone
src/MoqxRelay.cpp line 2163 at r1 (raw file):
} else { // Subsequent subscriber, first on this iothread: seed from the live publisher // forwarder so the OK carries the established largest, not this fresh forwarder's
Remove ", not this fresh forwarder's
// unseeded value a client reads as a track restart.
"
src/MoqxRelay.cpp line 2748 at r1 (raw file):
.sourceAddress = sourceAddr, }; // LF mode clears the registry forwarder (owned by tlForwarders_); stats unavailable here.
FYI - this breaks some components of the /state endpoint that were never really safe in MT mode anyways. We can file an issue to circle back and fix
…istry In LocalForwarder mode the publisher forwarder is owned by tlForwarders_ on the publisher exec; clear the registry's ref once that ownership transfers. Callers resolve the forwarder by FullTrackName from the publisher exec rather than holding a registry ref, and duplicate-publisher eviction drains the old forwarder on its own exec (via the displaced same-exec ref or tlForwarders_).
a537cd2 to
ca3da49
Compare
In LocalForwarder mode the publisher forwarder is owned by tlForwarders_ on the publisher exec; clear the registry's ref once that ownership transfers. Callers resolve the forwarder by FullTrackName from the publisher exec rather than holding a registry ref, and duplicate-publisher eviction drains the old forwarder on its own exec (via the displaced same-exec ref or tlForwarders_).
This change is