|
| 1 | +# ADR-128: Bounded explicit whole-partition physical packing orchestration |
| 2 | + |
| 3 | +Status: Accepted design; implementation and qualification gates remain open. |
| 4 | +Owners: KL071 / Client ClusterRouting and Integration ClusterRouting. |
| 5 | +Related: ADR-016, ADR-106, REQ-MOVE-001/003/005/007. |
| 6 | + |
| 7 | +## Decision |
| 8 | + |
| 9 | +Compose an explicitly supplied ordered set of existing PartitionMoveRequest operations in the authenticated .NET SDK. The SDK convenience API MoveWholePartitionsAsync returns IAsyncEnumerable<Result<PartitionMoveResult>> using the existing ManagedCode.Communication result contract. It introduces no route, public wire payload, serializer alias/field, operation enum, persisted plan record or separate dispatcher. Every actual request uses existing MovePartitionAsync, server-owned connection execution, fresh persisted administrator authorization, original native CQRS phase progress and the existing node-local RF3 movement authority. |
| 10 | + |
| 11 | +Physical split/merge means moving complete existing atomic partitions between already registered physical groups. It never splits a hot atomic partition or changes logical scope, creates a physical group, transfers Control authority, or grants all-shard atomicity. The caller retains original ordered requests; settled per-partition receipts are the only durable recovery authority. |
| 12 | + |
| 13 | +## Admission, bounds and lifetime |
| 14 | + |
| 15 | +The convenience method snapshots all inputs before any request. Admit 1..64 requests, distinct nonempty stable MoveIds, distinct complete PartitionRefs, one nonempty destination, original Transfer/Resume modes and nonnegative original placement CAS. Preserve Revision0 for the real unassigned fallback. Reject malformed/duplicate/oversized local plans before transport. SDK preflight cannot replace native server authorization, owner registration, byte budgets, CAS, current lineage or admission. |
| 16 | + |
| 17 | +The explicit64 bound is a local memory/in-flight policy: at most64 retained original request references,64 GUID identities and64 complete PartitionRef references. Execution has exactly one awaited existing parent request in flight and no task queue, producer, channel or retained result history. Every individual request keeps the existing actual server byte/work/deadline limits. This cardinality is independent of DatabaseLimits.MaxBatchMutations. Larger caller-selected inventories require explicit bounded sequences of original requests. |
| 18 | + |
| 19 | +Yield each actual original terminal result once in order. Continue only after native successful Retired; yield failure or non-Retired success unchanged then stop. There is no batch result or invented aggregate error. Partial success remains visible. Re-enumerating the original ordered snapshot uses the SAME original MoveIds, destination and CAS: existing native parent reconciliation returns original settled receipts and advances only unfinished moves. Never generate retry IDs, reset phase expiry, reinterpret refusal, or redispatch an uncertain phase through another transport. |
| 20 | + |
| 21 | +The supplied caller token and enumerator cancellation govern the entire SDK enumeration. Await the current original HTTP/native CQRS lifecycle; after cancellation or disposal no next request starts. The caller owns the borrowed SDK client. Server and existing test fixtures own and join their original operation/stream/native node resources; this composition adds no parallel lifetime. |
| 22 | + |
| 23 | +## Complete-flow acceptance |
| 24 | + |
| 25 | +REQ-KL071-PLAN-001 / AC-KL071-PLAN-001: real registered two-RF3 topology and two distinct all-model atomic partitions. Reject65 and duplicate inputs before effects; mutate the caller list after API creation and prove the actual original snapshot remains authoritative for enumeration. |
| 26 | + |
| 27 | +REQ-KL071-PLAN-002 / AC-KL071-PLAN-002: settle the first complete A-to-B transfer, cancel the original enumeration before the second request, prove the second original row revision/owner/epoch and all linked models unchanged while the global directory records only the first legitimate publication, then join six owners/all18 native locks. Cold original per-partition records show Retired first and absent second parent. Reopen and run the SAME plan: exact first receipt replay, actual second transfer, literal native installed receipt/owner/CAS/epoch, published row revision from the original global directory plus the ordered publication ordinal, and final global directory revision and all original SDK/official MCP/Q1 command receipts. |
| 28 | + |
| 29 | +REQ-KL071-PLAN-003 / AC-KL071-PLAN-003: real first same-ID/changed-CAS Conflict is yielded unchanged and stops before the second entry. Replay both original terminal results across full six-owner cold reopen without raw image/counter/body/index changes; no old effect is redispatched. |
| 30 | + |
| 31 | +REQ-KL071-PLAN-005 / AC-KL071-PLAN-005: within the same original complete operation, settle the first original request and await early enumerator disposal; re-enumerate the SAME plan with the API token absent and a linked original enumerator token, then cancel before the second request. Require the exact cancellation token and byte-equal original first terminal receipts across early disposal, enumerator cancellation and the original API-token cancellation/snapshot control. The existing second-partition absent native parent, unchanged placement/models, six-owner cold reopening and full resume/merge/healthy continuation prove no second dispatch. Keep the original case declaration and deadline. |
| 32 | + |
| 33 | +REQ-KL071-PLAN-004 / AC-KL071-PLAN-004: read actual current per-partition placements, execute a reverse B-to-A plan with fresh stable IDs and actual CAS, require literal current ownership/install receipts and full all-model state. Write distinct healthy literal documents under actual current owner epochs, prove real SDK/official MCP/Q1 receipts and documents, then full native cold-image equality on replay. Preserve existing ParentDeadline12m and all actual runtime cleanup bounds. |
| 34 | + |
| 35 | +Supporting automated case: PhysicalShardPartitionMovementRf3Tests.OrderedWholePartitionsResumeOriginalReceiptsAfterPartialCancellationThenMergeCold. Helpers reuse actual existing registration, all-model seeds, native per-partition terminal oracles, complete raw cuts and Aspire-owned kill/restart/cleanup. No fake host or substitute grain. This supports KL071; every persisted-phase crash, endurance, fault and exact-source Linux qualification remains mandatory and open until original evidence is joined. |
| 36 | + |
| 37 | +```mermaid |
| 38 | +flowchart TD |
| 39 | + Input[Original ordered whole-partition requests] --> Admission[Snapshot and bounded preflight] |
| 40 | + Admission --> Parent[Existing authenticated native parent] |
| 41 | + Parent --> Result[Actual per-partition terminal] |
| 42 | + Result -->|Retired| Next[Next original request] |
| 43 | + Next --> Parent |
| 44 | + Result -->|Failure or other phase| Stop[Yield unchanged and stop] |
| 45 | + Parent -->|Caller cancellation| Join[Join original request and start no next] |
| 46 | + Join --> Cold[Actual six-owner cold reopen] |
| 47 | + Cold --> Replay[Same IDs and CAS through original native parent] |
| 48 | + Replay --> Parent |
| 49 | +``` |
| 50 | + |
| 51 | +No compilation, runtime, Linux, durability or throughput claim follows from this design. Rollback removes only this SDK facade, its owned admission/helpers/test and requirement mapping; all original single-partition movement contracts remain. |
0 commit comments