R2-01: Cluster, Host & Failover round-2 fixes (T1,T3-doc,T4-T11; stacked on r2-plan02) #12

Closed
dohertj2 wants to merge 9 commits from r2-plan01 into r2-plan02
Showing only changes of commit c2707fdcf8 - Show all commits
@@ -9,9 +9,11 @@ namespace ZB.MOM.WW.ScadaBridge.HealthMonitoring;
/// Periodically builds a SiteHealthReport for the central cluster itself /// Periodically builds a SiteHealthReport for the central cluster itself
/// (siteId = <see cref="CentralSiteId"/>) and feeds it into the local /// (siteId = <see cref="CentralSiteId"/>) and feeds it into the local
/// CentralHealthAggregator so the UI can render central as another card /// CentralHealthAggregator so the UI can render central as another card
/// on /monitoring/health. Only the cluster leader (Primary) generates /// on /monitoring/health. Only the active node (Primary = the **oldest Up
/// reports — the standby's aggregator catches up on failover when it /// member**, i.e. the singleton host — <c>IClusterNodeProvider.SelfIsPrimary</c>,
/// becomes Primary and starts its own loop. /// never Akka cluster leadership) generates reports; the standby's aggregator
/// catches up on failover when it becomes the oldest and its loop starts
/// reporting.
/// </summary> /// </summary>
public class CentralHealthReportLoop : BackgroundService public class CentralHealthReportLoop : BackgroundService
{ {
@@ -41,8 +43,9 @@ public class CentralHealthReportLoop : BackgroundService
private readonly HealthMonitoringOptions _options; private readonly HealthMonitoringOptions _options;
private readonly ILogger<CentralHealthReportLoop> _logger; private readonly ILogger<CentralHealthReportLoop> _logger;
// Seeded with Unix-ms so reports from a newly-elected central leader // Seeded with Unix-ms so reports from a node that has newly become active
// always sort after reports from any prior leader for siteId="central". // (oldest Up member) always sort after reports from any previously-active
// node for siteId="central".
// The clock is read through the injected TimeProvider so the seeding is // The clock is read through the injected TimeProvider so the seeding is
// deterministically testable. // deterministically testable.
private long _sequenceNumber; private long _sequenceNumber;