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

Closed
opened 2026-10-31 12:41:52 -04:00 by claude · 0 comments
Owner
  • Draft: REL-20
  • Priority: low (only clusters sharing one database with automatic PTRs)
  • Agent: coder
  • Depends on: none
  • Decisions: none

Why

PtrSyncService serialises passes with a static SemaphoreSlim, which covers one process. Two
nodes sharing one database can still both add the same PTRs. Records have no natural unique key,
so a unique index is not the fix (d-design.md:1209).

What changes

Make a pass idempotent across processes: for example re-read and delete duplicates of the managed
PTR set at the end of each pass inside one transaction, or take a database-side lock where the
engine has one (relational advisory/app lock, a lease document on MongoDB). Choose and justify;
no schema change unless a lease row needs one (then one migration per relational provider plus
MongoDB, AGENTS.md "Storage").

Acceptance

  • A test that runs two PtrSyncService instances on separate service providers against one
    SQLite file concurrently (8 rounds x 3 passes) stores each PTR once; red first.
  • Data.Integration tests for the other engines if storage code changes.

Source

d-design.md:1209,1219.

- **Draft:** REL-20 - **Priority:** low (only clusters sharing one database with automatic PTRs) - **Agent:** coder - **Depends on:** none - **Decisions:** none ### Why `PtrSyncService` serialises passes with a static `SemaphoreSlim`, which covers one process. Two nodes sharing one database can still both add the same PTRs. Records have no natural unique key, so a unique index is not the fix (`d-design.md:1209`). ### What changes Make a pass idempotent across processes: for example re-read and delete duplicates of the managed PTR set at the end of each pass inside one transaction, or take a database-side lock where the engine has one (relational advisory/app lock, a lease document on MongoDB). Choose and justify; no schema change unless a lease row needs one (then one migration per relational provider plus MongoDB, AGENTS.md "Storage"). ### Acceptance - [ ] A test that runs two `PtrSyncService` instances on separate service providers against one SQLite file concurrently (8 rounds x 3 passes) stores each PTR once; red first. - [ ] Data.Integration tests for the other engines if storage code changes. ### Source `d-design.md:1209,1219`.
Sign in to join this conversation.
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#29
No description provided.