-
Notifications
You must be signed in to change notification settings - Fork 584
ApiListener#RelayMessageOne(): log🪵 to which Endpoint messages are relayed #10393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
<< parentZone->GetName() << "' to Endpoint '" << currentZoneMaster->GetName() << "' now"; | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If that if condition is triggered, the endpoint is going to be skipped, so why log here something that says otherwise?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the parent endpoint targetEndpoint is skipped. But the node is still "Relaying messages for parent Zone" via currentZoneMaster which I clearly say here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
via currentZoneMaster which I clearly say here.
It's far from clear, there's not even a single comment that explains it. We've spent literally hours discussing this in person, so I don't know what else you want me to say. So, since this PR is based on @lippserd's request from #10389 (review), I'll describe 1 what it does for you and see if that's what you asked for, but to me it clearly doesn't reflect what the actual code does.
Footnotes
-
Suppose you have two endpoints (S1 and S2) in a
satellite
HA zone, and amaster
zone with endpoints (M1 and M2) as parents. In such a HA setup, only one of the endpoints from either zone is allowed to communicate with the respective parent/child zone at a time. Now let's say thatM1
andS1
are responsible for message exchange between these zones, i.e. onlyS1
is responsible for forwarding the messages to the parent (master) zone andM1
is responsible for accepting them and sending back other messages from/to thesatellite
zone. So each timeS2
wants to send messages toM1
andM2
endpoints (it's target zone being set to themaster
zone) it will trigger this if condition and with this PR it would also log something like...Relaying messages for parent zone 'master' to endpoint 'S1'
even though it's skipping the endpoints (M1
andM2
). Well, hopefully messages intended for the parent zone will be sent to the partner endpoint (S1) at some point, but whether and when they will be sent as this log claims is not known at all, because this log is based on the assumption that when this condition is triggered, the message might even have been sent already or will possibly be sent toS1
. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's not even a single comment that explains it.
Technically, yes.
It's far from clear,
But, to my defense, there's the log message itself using names from clearly named distinct variables.
it clearly doesn't reflect what the actual code does.
It absolutely reflects it! Please see my test in OP and/or, at your option, run own tests with M1/M2/S1/S2. Shut down any combination of nodes and I forecast you: the actual log message will be correct.
I'm aware it's not 100% perfect. But I need you to understand there's only one ApiListener#RelayMessageOne() call per message if latter is intended for the parent zone. So (if I don't wanna hope in that one function call whether another one will/has happen(ed),) I have to use the opportunity of this one call while inside. And luckily I have everything I need! I know for sure whether the message is for the parent zone and whether it's send directly (log message 2) or indirectly (log message 1). It's just fine and, as requested, I log every time the routing changes from logger PoV.
721f57d
to
0b32ea8
Compare
…ayed if they're for our parent Zone.
0b32ea8
to
fd6a9a9
Compare
if they're for our parent Zone.
ref/NC/820479
Requested in #10389, but useful independent of it.
Tests
Config
Starting point
sat's member akzl4 relays stuff to its zone-master akzl3 which relays it to the parent akzl1.
Let's break something... 😈
If we stop akzl1...
... akzl3 switches its parent from akzl1 to akzl2.
Let's break something... 😈 II
If we also stop akzl3...
... akzl4 switches from zone-master akzl3 to parent akzl2.
OK, the downtime is over... 👿
Likewise, whichever preferred nodes come back online...
... they're used again! 👍