A node that joins a cluster receives the inviter's synced settings and entities within one heartbeat #333
Labels
No labels
agent
api-regen
agent
architect
agent
coder
agent
console-coder
agent
docs-writer
agent
mechanic
agent
protocol-coder
agent
storage-coder
area/api
area/ci
area/console
area/dhcp
area/dns
area/docs
area/packaging
area/process
area/storage
area/windows
kind
bug
kind
chore
kind
docs
kind
epic
kind
feature
kind
performance
kind
security
kind
test
priority
high
priority
low
priority
medium
resolution
duplicate
resolution
not-a-bug
resolution
wontfix
status
blocked
status
in-progress
status
needs-decision
status
needs-design
status
ready
theme
ad-samba-dns
theme
alternatives-benchmark
theme
console-toolchain
theme
later
theme
parity-devices
theme
parity-query
theme
post-release-fixes
theme
tracker-setup
theme
valkey
theme
windows-installer
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
Depends on
#59 Epic: A node that joins a cluster receives every synced setting and entity at once
lantea-one/ninlil
Reference
lantea-one/ninlil#333
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part of epic #59.
Why
Cluster sync pushes changes only as they happen, so a late joiner holds nothing until each item is written again (
ClusterConfigSyncBroadcaster.cs:21-27).What changes
ClusterConfigBackfillRunnerruns the pass described in design §2.HandleJoinCompleteAsyncrecords the request for a new peer.SendToPeerAsync.Acceptance
Backfill_AfterNodeBJoinsNodeA_GivesNodeBEverySyncedSettingAndEntityOfNodeAfails while the pass sends nothing, then passes. The same holds for the other fiveClusterJoinBackfillTestsinsrc/dotnet/tests/Ninlil.Web.Tests.dotnet test src/dotnet/tests/Ninlil.Dns.Server.Cluster.Tests,dotnet test src/dotnet/tests/Ninlil.Dns.Server.ClusterSync.Testsanddotnet test src/dotnet/tests/Ninlil.Web.Testspass, andOpenApiSnapshotTestspasses with no snapshot change.Source
ClusterJoinService.cs:227-311,ClusterHeartbeatBackgroundService.cs:99-193,ClusterChannelController.cs:115-153,ClusterTsigAuthenticationHandler.cs:88-121,bughunt-plan.md:524.Work package detail
Ninlil.Dns.Server.Cluster/Backfill/IClusterConfigBackfillRunner.csandClusterConfigBackfillRunner.cs(singleton):bool TryStart(Guid clusterNodeId)returns false while a pass to that peer runs.IEnumerable<IClusterConfigSyncSource>in a new scope, groups byBackfillStage, sends each stage with at most 4 deliveries in flight (SemaphoreSlim), and records completion or failure as in §2. It logs one Information line at start and at the end (item count, skipped count), or a Warning with the first error.Channel/ClusterConfigSyncBroadcaster.cs: addpublic Task<bool> SendToPeerAsync(ClusterNodeEntity peer, ClusterConfigSyncEnvelope envelope, CancellationToken), refactored fromDeliverToOneAsync(:92-141). It returns true on 2xx.Join/ClusterJoinService.cs: inHandleJoinCompleteAsync, for a new peer only (:280-308), add aClusterPeerConfigBackfillEntityin the same save.JoinAsyncadds none (OD-1 = a).Heartbeat/ClusterHeartbeatBackgroundService.cs:ProbeOneAsyncreports success. After the round's save (:135), callTryStartfor each peer whose probe succeeded and is inListPendingClusterNodeIdsAsync.Http/ClusterPeerHttpClientFactory.cs: makeCreateClientvirtualas a test seam, with a comment saying why.Extension/ServiceCollectionClusterExtension.cs.:15-28(the limitation now names the join backfill), join service, heartbeat.src/dotnet/tests/Ninlil.Web.Tests, new hostlessClusterJoinBackfillTests: nodes A and B each have their own SQLite database, settings file andEphemeralDataProtectionProvider; a loopback sender hands envelopes to B's real appliers, asClusterChannelController.ConfigSyncdoes). Write the tests first against a runner whose pass sends nothing, so they fail:Backfill_AfterNodeBJoinsNodeA_GivesNodeBEverySyncedSettingAndEntityOfNodeA. Seed A with a role, a user with TOTP, a local list with entries, a subscribed list, an ACL rule, a global rewrite and a scoped one, a forwarder, writes to all five sections including the RabbitMQ password and the reverse-proxy secret, and one deleted rewrite. Assert that B has every item, has no scoped rewrite, has no subscribed-list entries, holds a tombstone for the deleted rewrite, and holds secrets that B's key ring opens while A's ciphertext never appears in any payload.Backfill_ToANodeThatHoldsANewerCopy_KeepsTheNewerCopyBackfill_RunTwice_LeavesNodeBUnchangedBackfill_ToANodeWithItsOwnBootstrapAdmin_KeepsBothAccountsAndFlagsTheCollision(asserts OD-2 = a)Backfill_ToARejoiningNodeThatHoldsARowNodeADeleted_RemovesTheRowBackfill_InterruptedAfterHalfTheEnvelopes_CompletesOnTheNextPasssrc/dotnet/tests/Ninlil.Dns.Server.Cluster.Tests:HandleJoinCompleteAsync_ForANewPeer_RecordsABackfillRequestHandleJoinCompleteAsync_ForARepeatedCallback_AddsNoSecondRequestJoinAsync_OnTheJoiningNode_RecordsNoRequestForTheInviterHeartbeatRound_ForAPendingPeerWhoseProbeSucceeds_StartsOneBackfill(stub handler through theCreateClientseam, fake runner)HeartbeatRound_ForAPendingPeerWhoseProbeFails_StartsNoneTryStart_WhileAPassToThatPeerRuns_ReturnsFalsePass_WhenEveryDeliverySucceeds_RemovesTheRequestPass_WhenADeliveryFails_KeepsTheRequestAndRecordsTheErrorPass_WhenARequestArrivesDuringThePass_KeepsTheRequestPass_SendsEachStageBeforeTheNextPass_NeverHasMoreThanFourDeliveriesInFlightPass_ToTwoPeersAtOnce_SendsEachTheFullSetdotnet test src/dotnet/tests/Ninlil.Dns.Server.Cluster.Testsdotnet test src/dotnet/tests/Ninlil.Dns.Server.ClusterSync.Testsdotnet test src/dotnet/tests/Ninlil.Web.Tests(OpenApiSnapshotTestsmust stay green with no snapshot change)Ghost referenced this issue2026-11-05 20:48:53 -05:00
Ghost referenced this issue2026-11-05 20:49:02 -05:00
Added from the #330 verification: on MongoDB a backup restore wipes cluster peers explicitly, but the backfill request table is excluded from backups and has no cascade, so requests for wiped peers stay behind (and an older build's peer delete leaves one too). The runner here must ignore and delete a request whose peer row no longer exists, or the restore wipe must clear the request table; pick one and test it on MongoDB.
Done on
feature/59-cluster-join-backfill(4fb48a7c,b848aa4a,bec7911f,76cc9121); verified (whole solution with Docker; two-node test red with the send stubbed, green with it). Fix round: atomic conditional delete/update of the request on every engine, runner stops and awaits passes at shutdown, test loopback uses the MVC JSON options. Closes when the epic merges into develop.Ghost referenced this issue2026-11-06 01:41:02 -05:00