Skip to content

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Al2Klimov
Copy link
Member

@Al2Klimov Al2Klimov commented Mar 27, 2025

if they're for our parent Zone.

ref/NC/820479

Requested in #10389, but useful independent of it.

Tests

Config

object Endpoint "akzl1" {
  host = "10.27.1.87"
}

object Endpoint "akzl2" {
  host = "10.27.1.90"
}

object Endpoint "akzl3" {
  host = "10.27.3.6"
}

object Endpoint "akzl4" {
  host = "10.27.0.129"
}

object Zone "master" {
  endpoints = [ "akzl1", "akzl2" ]
}

object Zone "sat" {
  parent = "master"
  endpoints = [ "akzl3", "akzl4" ]
}

include <itl>

object CheckerComponent "checker" { }

object ApiListener "api" {
  accept_config = true
  accept_commands = true
}

object ApiUser "root" {
  password = "123456"
  permissions = [ "*" ]
}

object Host "master" {
  check_command = "dummy"
  zone = "master"
}

object Host "sat" {
  check_command = "dummy"
  zone = "sat"
}

for (i in range(1000)) {
  apply Service i {
    check_command = "dummy"
    assign where true
  }
}

Starting point

Bildschirmfoto 2025-03-27 um 12 32 56

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...

Bildschirmfoto 2025-03-27 um 12 35 31

... akzl3 switches its parent from akzl1 to akzl2.

Let's break something... 😈 II

If we also stop akzl3...

Bildschirmfoto 2025-03-27 um 12 36 28

... akzl4 switches from zone-master akzl3 to parent akzl2.

OK, the downtime is over... 👿

Likewise, whichever preferred nodes come back online...

Bildschirmfoto 2025-03-27 um 12 37 01

... they're used again! 👍

Bildschirmfoto 2025-03-27 um 12 37 21

@Al2Klimov Al2Klimov added area/distributed Distributed monitoring (master, satellites, clients) area/log Logging related ref/NC labels Mar 27, 2025
@Al2Klimov Al2Klimov requested a review from lippserd March 27, 2025 11:53
@cla-bot cla-bot bot added the cla/signed label Mar 27, 2025
<< parentZone->GetName() << "' to Endpoint '" << currentZoneMaster->GetName() << "' now";
}
}

Copy link
Member

@yhabteab yhabteab Apr 2, 2025

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?

Copy link
Member Author

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.

Copy link
Member

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

  1. Suppose you have two endpoints (S1 and S2) in a satellite HA zone, and a master 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 that M1 and S1 are responsible for message exchange between these zones, i.e. only S1 is responsible for forwarding the messages to the parent (master) zone and M1 is responsible for accepting them and sending back other messages from/to the satellite zone. So each time S2 wants to send messages to M1 and M2 endpoints (it's target zone being set to the master 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 and M2). 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 to S1.

Copy link
Member Author

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.

@Al2Klimov Al2Klimov force-pushed the zone-endpoint-log branch from 721f57d to 0b32ea8 Compare April 3, 2025 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/distributed Distributed monitoring (master, satellites, clients) area/log Logging related cla/signed ref/NC
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants