PTR reconciliation stores each PTR once even when two cluster nodes reconcile at once #293

Merged
claude merged 2 commits from feature/29-ptr-sync-idempotent into develop 2026-11-05 07:14:13 -05:00
Owner

Automatic PTR reconciliation stores each PTR once, even when two cluster nodes that share one database reconcile at the same time.

  • Dedupe step. Each PtrSyncService pass ends by re-reading the managed records in the zones it reconciled and removing every copy of a duplicate group but one.
    • Duplicates are records with the same zone, owner, type and decoded target, where both copies carry ManagedByFeature == Ptr (PTRs and RFC 2317 CNAMEs).
    • The copy with the smallest id always survives, so two nodes never remove every copy. The pass that adds last also dedupes last, so the nodes converge.
    • Operator records, and DHCP-managed records, carry no PTR marker and are never touched.
  • Removals use the normal write path. They go through IZoneUpdateService, so the SOA serial, journal and zone-change event follow as for any change.
  • Per-zone scopes. Each zone's dedupe runs in its own scope, so a lost delete race in one zone cannot spoil the saves of later zones.
    • After a failure, the zone is re-read. If the duplicates are gone, another node removed them and it is logged at Debug. Duplicates still present, or a failed re-read, are logged at Warning with the zone name.
    • On MongoDB a lost race is a silent no-op, which a comment notes.
  • No schema change. It works the same on all five engines. The in-process pass lock is now a DI singleton (PtrSyncPassLock) instead of a static, so two service providers behave like two nodes in tests. Behaviour in one process is unchanged.

Tests:

  • Two service providers on one SQLite file, 8 rounds × 3 passes each, store each PTR once. Without the dedupe this failed 4 of 4 times.
  • A managed duplicate is removed while an operator PTR with the same owner and target stays.
  • A lost race in the first zone still lets the second zone be deduped (red with a shared scope).
  • Authoritative.Tests 660, Web.Tests 2069, DnsIntegration 59.
  • The verifier passed the change twice, the second time after the error-handling fixes.

Closes #29

🤖 Generated with Claude Code

https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK

Automatic PTR reconciliation stores each PTR once, even when two cluster nodes that share one database reconcile at the same time. - **Dedupe step.** Each `PtrSyncService` pass ends by re-reading the managed records in the zones it reconciled and removing every copy of a duplicate group but one. - Duplicates are records with the same zone, owner, type and decoded target, where both copies carry `ManagedByFeature == Ptr` (PTRs and RFC 2317 CNAMEs). - The copy with the smallest id always survives, so two nodes never remove every copy. The pass that adds last also dedupes last, so the nodes converge. - Operator records, and DHCP-managed records, carry no PTR marker and are never touched. - **Removals use the normal write path.** They go through `IZoneUpdateService`, so the SOA serial, journal and zone-change event follow as for any change. - **Per-zone scopes.** Each zone's dedupe runs in its own scope, so a lost delete race in one zone cannot spoil the saves of later zones. - After a failure, the zone is re-read. If the duplicates are gone, another node removed them and it is logged at Debug. Duplicates still present, or a failed re-read, are logged at Warning with the zone name. - On MongoDB a lost race is a silent no-op, which a comment notes. - **No schema change.** It works the same on all five engines. The in-process pass lock is now a DI singleton (`PtrSyncPassLock`) instead of a static, so two service providers behave like two nodes in tests. Behaviour in one process is unchanged. Tests: - Two service providers on one SQLite file, 8 rounds × 3 passes each, store each PTR once. Without the dedupe this failed 4 of 4 times. - A managed duplicate is removed while an operator PTR with the same owner and target stays. - A lost race in the first zone still lets the second zone be deduped (red with a shared scope). - Authoritative.Tests 660, Web.Tests 2069, DnsIntegration 59. - The verifier passed the change twice, the second time after the error-handling fixes. Closes #29 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
Closes #29

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
A lost race while removing duplicate PTRs in one reverse zone no longer stops the clean-up of the other zones
Some checks failed
Build / Pack and Push NuGet Packages (dns-server) (push) Successful in -1m29s
Build / Pack and Push NuGet Packages (dhcp) (push) Successful in 1m17s
Build / Build Binary (macos-arm64) (push) Successful in 25s
Build / Build Binary (macos-amd64) (push) Successful in 45s
Build / Build Binary (linux-arm64) (push) Successful in 5m17s
Build / Build Binary (windows-amd64) (push) Successful in 5m24s
Build / Build Binary (linux-amd64) (push) Successful in 10m28s
Build / Build and Push Image (push) Successful in 13s
Build / Smoke Test the Windows Binary (push) Successful in 17s
Build / Build Arch Linux Packages (push) Successful in 29s
Build / Test .NET (pull_request) Failing after 25m24s
Build / Stage Draft Release (pull_request) Has been skipped
Build / Pack and Push NuGet Packages (common) (pull_request) Has been skipped
Build / Pack and Push NuGet Packages (dhcp) (pull_request) Has been skipped
Build / Pack and Push NuGet Packages (dns-core) (pull_request) Has been skipped
Build / Build Binary (linux-amd64) (pull_request) Has been skipped
Build / Pack and Push NuGet Packages (dns-server) (pull_request) Has been skipped
Build / Build Binary (macos-amd64) (pull_request) Has been skipped
Build / Build Binary (linux-arm64) (pull_request) Has been skipped
Build / Build Binary (windows-amd64) (pull_request) Has been skipped
Build / Build Binary (macos-arm64) (pull_request) Has been skipped
Build / Smoke Test the Windows Binary (pull_request) Has been skipped
Build / Build Arch Linux Packages (pull_request) Has been skipped
Build / Build and Test Deb and RPM Packages (pull_request) Has been skipped
Build / Build and Push Image (pull_request) Has been skipped
Build / Publish Release (pull_request) Has been skipped
Build / Pipeline (pull_request) Failing after 0s
Build / Build and Test Deb and RPM Packages (push) Successful in 4m17s
Build / Publish Release (push) Successful in 8s
Build / Pipeline (push) Successful in 0s
f5afa2f546
Refs #29

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
claude merged commit e8d9d50fd8 into develop 2026-11-05 07:14:13 -05:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lantea-one/ninlil!293
No description provided.