Cluster peers can be marked as owed a config backfill, and synced tables can be listed by id #330

Closed
opened 2026-11-05 20:48:50 -05:00 by claude · 1 comment
Owner

Part of epic #59.

  • Kind: feature
  • Area: storage
  • Priority: medium (blocks the join backfill)
  • Milestone: Post-release fixes
  • Agent: storage-coder
  • Depends on: none
  • Decisions: none

Why

A join backfill must survive a restart and must not be undone by the heartbeat, which rewrites every peer row each round. It also needs an id snapshot that does not skip rows when rows are deleted during the pass.

What changes

New ClusterPeerConfigBackfillEntity and its repository (EF and MongoDB), IRepository.ListIdsAsync, migration AddClusterPeerConfigBackfill for each of the four relational providers, the MongoDB index, removal on peer delete, and exclusion from backups. See the work package detail below (59-1).

Acceptance

  • dotnet test src/dotnet/tests/Ninlil.Dns.Data.Integration.Tests passes the new ListIdsAsync_*, ClusterPeerConfigBackfill_* and RemovingAClusterNode_RemovesItsBackfillRequest tests on every engine.
  • Delete_OfAPeerWithAPendingBackfill_RemovesTheRequest passes in src/dotnet/tests/Ninlil.Web.Tests. The Backup catalogue test passes.
  • dotnet test Ninlil.slnx -p:NinlilSkipAngularBuild=true passes.
  • Every item in Before you finish that applies is done.

Source

ClusterHeartbeatBackgroundService.cs:132-135, ClusterController.cs:153-155, ClusterSyncTombstoneEntity.cs:13-19, the #59 design §1.1, §2.

Work package detail

  • Goal: persist owed backfills and give every synced repository an id-only snapshot read.

  • Files:

    • Ninlil.Dns.Data.Abstractions/Entity/ClusterPeerConfigBackfillEntity.cs (new, EntityBase): Guid ClusterNodeId, DateTimeOffset RequestedAtUtc, int AttemptCount, DateTimeOffset? LastAttemptAtUtc, string LastError (max 1000).
    • Repository/IClusterPeerConfigBackfillRepository.cs (new): FindByClusterNodeIdAsync(Guid, ct), ListPendingClusterNodeIdsAsync(ct).
    • IRepository<TEntity>: add Task<IReadOnlyList<Guid>> ListIdsAsync(Expression<Func<TEntity,bool>> predicate = null, CancellationToken stoppingToken = default), implemented in the EF and MongoDB base repositories as a projection, never by loading entities.
    • IClusterSyncTombstoneRepository: inherits ListIdsAsync; nothing else is needed.
    • EF: Configuration/ClusterPeerConfigBackfillConfiguration.cs (unique index on ClusterNodeId, FK to ClusterNode with cascade delete), NinlilDnsContext, the repository, and its DI registration.
    • Migrations AddClusterPeerConfigBackfill × Sqlite, PostgreSql, MySql, SqlServer, then the namespace script.
    • MongoDB: the repository, class map, a unique index in MongoIndexCatalog, and DI registration. No MongoSchemaSteps entry: a new collection is not misread by an older build. Removing a peer must also remove its request; add that call to ClusterController.Delete (ClusterController.cs:153-155, same unit of work), because MongoDB has no cascade.
    • Ninlil.Dns.Server.Backup/Catalog/BackupEntityCatalog.cs: leave the new entity out of backups, like tombstones (sync bookkeeping).
  • Constraints: follow ClusterNodeConfiguration for DateTimeOffset columns. Do not hand-edit generated migrations.

  • Acceptance (fail first): in src/dotnet/tests/Ninlil.Dns.Data.Integration.Tests (every engine; the container classes carry RequiresDocker):

    • ListIdsAsync_WithAPredicate_ReturnsOnlyTheMatchingIds
    • ListIdsAsync_OnAnEmptyTable_ReturnsNoIds
    • ClusterPeerConfigBackfill_SecondRowForTheSameNode_IsRejected
    • ListPendingClusterNodeIdsAsync_ReturnsEveryRequestedPeer
    • RemovingAClusterNode_RemovesItsBackfillRequest (relational, cascade)

    In src/dotnet/tests/Ninlil.Web.Tests: Delete_OfAPeerWithAPendingBackfill_RemovesTheRequest. In src/dotnet/tests/Ninlil.Dns.Server.Backup.Tests: the catalogue completeness test fails until the entity is classified.

  • Non-goals: any runner logic.

  • Gate:

    • dotnet test src/dotnet/tests/Ninlil.Dns.Data.Integration.Tests
    • dotnet test src/dotnet/tests/Ninlil.Dns.Data.Tests
    • dotnet test src/dotnet/tests/Ninlil.Dns.Server.Backup.Tests
    • dotnet test src/dotnet/tests/Ninlil.Web.Tests
    • IRepository is a shared abstraction, so also dotnet test Ninlil.slnx -p:NinlilSkipAngularBuild=true.
Part of epic #59. - **Kind:** feature - **Area:** storage - **Priority:** medium (blocks the join backfill) - **Milestone:** Post-release fixes - **Agent:** storage-coder - **Depends on:** none - **Decisions:** none ### Why A join backfill must survive a restart and must not be undone by the heartbeat, which rewrites every peer row each round. It also needs an id snapshot that does not skip rows when rows are deleted during the pass. ### What changes New `ClusterPeerConfigBackfillEntity` and its repository (EF and MongoDB), `IRepository.ListIdsAsync`, migration `AddClusterPeerConfigBackfill` for each of the four relational providers, the MongoDB index, removal on peer delete, and exclusion from backups. See the work package detail below (59-1). ### Acceptance - [ ] `dotnet test src/dotnet/tests/Ninlil.Dns.Data.Integration.Tests` passes the new `ListIdsAsync_*`, `ClusterPeerConfigBackfill_*` and `RemovingAClusterNode_RemovesItsBackfillRequest` tests on every engine. - [ ] `Delete_OfAPeerWithAPendingBackfill_RemovesTheRequest` passes in `src/dotnet/tests/Ninlil.Web.Tests`. The Backup catalogue test passes. - [ ] `dotnet test Ninlil.slnx -p:NinlilSkipAngularBuild=true` passes. - [ ] Every item in [Before you finish](https://git.lantea.one/lantea-one/ninlil/src/branch/main/AGENTS.md#before-you-finish) that applies is done. ### Source `ClusterHeartbeatBackgroundService.cs:132-135`, `ClusterController.cs:153-155`, `ClusterSyncTombstoneEntity.cs:13-19`, the #59 design §1.1, §2. ### Work package detail - **Goal:** persist owed backfills and give every synced repository an id-only snapshot read. - **Files:** - `Ninlil.Dns.Data.Abstractions/Entity/ClusterPeerConfigBackfillEntity.cs` (new, `EntityBase`): `Guid ClusterNodeId`, `DateTimeOffset RequestedAtUtc`, `int AttemptCount`, `DateTimeOffset? LastAttemptAtUtc`, `string LastError` (max 1000). - `Repository/IClusterPeerConfigBackfillRepository.cs` (new): `FindByClusterNodeIdAsync(Guid, ct)`, `ListPendingClusterNodeIdsAsync(ct)`. - `IRepository<TEntity>`: add `Task<IReadOnlyList<Guid>> ListIdsAsync(Expression<Func<TEntity,bool>> predicate = null, CancellationToken stoppingToken = default)`, implemented in the EF and MongoDB base repositories as a projection, never by loading entities. - `IClusterSyncTombstoneRepository`: inherits `ListIdsAsync`; nothing else is needed. - EF: `Configuration/ClusterPeerConfigBackfillConfiguration.cs` (unique index on `ClusterNodeId`, FK to `ClusterNode` with cascade delete), `NinlilDnsContext`, the repository, and its DI registration. - Migrations `AddClusterPeerConfigBackfill` × Sqlite, PostgreSql, MySql, SqlServer, then the namespace script. - MongoDB: the repository, class map, a unique index in `MongoIndexCatalog`, and DI registration. No `MongoSchemaSteps` entry: a new collection is not misread by an older build. Removing a peer must also remove its request; add that call to `ClusterController.Delete` (`ClusterController.cs:153-155`, same unit of work), because MongoDB has no cascade. - `Ninlil.Dns.Server.Backup/Catalog/BackupEntityCatalog.cs`: leave the new entity out of backups, like tombstones (sync bookkeeping). - **Constraints:** follow `ClusterNodeConfiguration` for `DateTimeOffset` columns. Do not hand-edit generated migrations. - **Acceptance (fail first):** in `src/dotnet/tests/Ninlil.Dns.Data.Integration.Tests` (every engine; the container classes carry `RequiresDocker`): - `ListIdsAsync_WithAPredicate_ReturnsOnlyTheMatchingIds` - `ListIdsAsync_OnAnEmptyTable_ReturnsNoIds` - `ClusterPeerConfigBackfill_SecondRowForTheSameNode_IsRejected` - `ListPendingClusterNodeIdsAsync_ReturnsEveryRequestedPeer` - `RemovingAClusterNode_RemovesItsBackfillRequest` (relational, cascade) In `src/dotnet/tests/Ninlil.Web.Tests`: `Delete_OfAPeerWithAPendingBackfill_RemovesTheRequest`. In `src/dotnet/tests/Ninlil.Dns.Server.Backup.Tests`: the catalogue completeness test fails until the entity is classified. - **Non-goals:** any runner logic. - **Gate:** - `dotnet test src/dotnet/tests/Ninlil.Dns.Data.Integration.Tests` - `dotnet test src/dotnet/tests/Ninlil.Dns.Data.Tests` - `dotnet test src/dotnet/tests/Ninlil.Dns.Server.Backup.Tests` - `dotnet test src/dotnet/tests/Ninlil.Web.Tests` - `IRepository` is a shared abstraction, so also `dotnet test Ninlil.slnx -p:NinlilSkipAngularBuild=true`.
Author
Owner

Done on feature/59-cluster-join-backfill (ebb5888e, 2e416050, 4624e56d, 7ab82ff5); verified (full solution green incl. Docker integration on all engines). Closes when the epic branch merges into develop.

Done on `feature/59-cluster-join-backfill` (ebb5888e, 2e416050, 4624e56d, 7ab82ff5); verified (full solution green incl. Docker integration on all engines). Closes when the epic branch merges into develop.
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.

Reference
lantea-one/ninlil#330
No description provided.