mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 18:47:20 +01:00
docs: align holder identity sites with AUTHORITY ruling
This commit is contained in:
1 parent
b1e973761a
commit
62d7f31912
5 files changed
+7
-7
No files matched your search
@@ -66,7 +66,7 @@ func (h *Host) workspaceEndpointsAvailable(b lifecycle.WorkspaceBinding) error {
|
||||
}
|
||||
|
||||
// workspaceSourceHost resolves explicit holder membership for
|
||||
// INV-ASSIGNMENT-HOLDER-IDENTITY-001; endpoints never select a server.
|
||||
// INV-AUTH-HOLDER-IDENTITY-001; endpoints never select a server.
|
||||
func (h *Host) workspaceSourceHost(volume, replica string, epoch uint64) string {
|
||||
if state := h.Publisher().WorkspaceState(volume); state != nil {
|
||||
for _, r := range state.Moves {
|
||||
@@ -82,7 +82,7 @@ func (h *Host) workspaceSourceHost(volume, replica string, epoch uint64) string
|
||||
}
|
||||
|
||||
// placementSourceHost uses committed membership, never endpoint inference
|
||||
// (INV-ASSIGNMENT-HOLDER-IDENTITY-001, INV-WS-RENEW-NONBLOCKING-001).
|
||||
// (INV-AUTH-HOLDER-IDENTITY-001, INV-WS-RENEW-NONBLOCKING-001).
|
||||
func (h *Host) placementSourceHost(volume, replica string) string {
|
||||
if h.lifecycle != nil {
|
||||
if p, ok := h.lifecycle.Placements.GetPlacementSnapshot(volume); ok {
|
||||
|
||||
@@ -90,7 +90,7 @@ func (s *services) RenewWorkspaceLease(ctx context.Context, q *control.Workspace
|
||||
if err := s.workspaceVolumeForRenewal(q.GetVolumeId()); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// INV-ASSIGNMENT-HOLDER-IDENTITY-001: a replica id can move between servers.
|
||||
// INV-AUTH-HOLDER-IDENTITY-001: a replica id can move between servers.
|
||||
line, ok := s.host.Publisher().PublishedAuthorityLine(q.GetVolumeId())
|
||||
server := line.IssuedHost
|
||||
if server == "" {
|
||||
|
||||
@@ -2,7 +2,7 @@ package volume
|
||||
|
||||
import control "github.com/seaweedfs/seaweed-block/core/rpc/control"
|
||||
|
||||
// assignmentNamesSelf implements INV-ASSIGNMENT-HOLDER-IDENTITY-001. Missing server identity is
|
||||
// assignmentNamesSelf implements INV-AUTH-HOLDER-IDENTITY-001. Missing server identity is
|
||||
// refused; endpoints qualify identity only when the master carries them.
|
||||
func (h *Host) assignmentNamesSelf(f *control.AssignmentFact) bool {
|
||||
return f.GetServerId() != "" && f.GetServerId() == h.cfg.ServerID &&
|
||||
|
||||
@@ -235,7 +235,7 @@ func (h *Host) recordOtherLine(f *control.AssignmentFact) {
|
||||
// is the canonical safe deep-copy for proto messages.
|
||||
cp := proto.Clone(f).(*control.AssignmentFact)
|
||||
h.otherMu.Lock()
|
||||
// A stale replay must not erase the newer foreign-holder fence (INV-ASSIGNMENT-HOLDER-IDENTITY-001).
|
||||
// A stale replay must not erase the newer foreign-holder fence (INV-AUTH-HOLDER-IDENTITY-001).
|
||||
if old := h.lastOther; old != nil && (cp.Epoch < old.Epoch || cp.Epoch == old.Epoch && cp.EndpointVersion < old.EndpointVersion) {
|
||||
h.otherMu.Unlock()
|
||||
return
|
||||
@@ -808,7 +808,7 @@ func (h *Host) streamOnce(ctx context.Context) error {
|
||||
// OnAssignment could flip the projection Healthy before peers were
|
||||
// installed, admitting local-only writes with zero fan-out.
|
||||
func (h *Host) applyFact(fact *control.AssignmentFact) {
|
||||
// INV-ASSIGNMENT-HOLDER-IDENTITY-001: matching r1 and loopback endpoints do not identify a host.
|
||||
// INV-AUTH-HOLDER-IDENTITY-001: matching r1 and loopback endpoints do not identify a host.
|
||||
if fact.ReplicaId == h.cfg.ReplicaID && !h.assignmentNamesSelf(fact) {
|
||||
h.wd.notPrimary()
|
||||
h.recordOtherLine(fact)
|
||||
|
||||
@@ -574,7 +574,7 @@ Notes:
|
||||
|
||||
| ID | Statement | Machine / transition | Enforced in | Test | TLA+ property | Status |
|
||||
|---|---|---|---|---|---|---|
|
||||
| `INV-ASSIGNMENT-HOLDER-IDENTITY-001` | A volume adopts an assignment only when it names this process's server id and replica id (and, when carried, its own data and control endpoints); any other primary fact is another holder's line: recorded, fenced, never adopted. The master refuses workspace lease first grants, renewals and re-grants with a missing server id or one that differs from the assigned holder. | AUTHORITY: primary assignment and workspace lease identity | `core/host/volume/host.go` `applyFact`, `IsSuperseded`, `recordOtherLine`; `assignment_holder.go` `assignmentNamesSelf`; `core/host/master/services.go` `SubscribeAssignments`; `workspace_service.go` `RenewWorkspaceLease` | `TestAssignmentHolderIdentityRestartedOldProcess`, `TestAssignmentHolderIdentityMatchingServerStillAdopts`, `TestAssignmentHolderIdentityFencesPreviouslyHealthySameReplica`, `TestAssignmentHolderIdentityRefusesCarriedEndpointMismatch` (`core/host/volume/assignment_holder_test.go`); `TestWorkspaceLeaseGuardCarriesHolderServerIdentity` (`core/host/volume/workspace_holder_identity_test.go`); `TestWorkspaceLeaseRequiresHolderServerForGrantRenewAndRegrant` (`core/host/master/workspace_holder_identity_test.go`); `TestWorkspaceRPCCleanMovePreservesReplicaIdentity` (`core/host/master/workspace_service_test.go`) | — (unit and RPC identity boundary) | ACTIVE |
|
||||
| `INV-AUTH-HOLDER-IDENTITY-001` | A holder is the pair (server id, replica id): every site that decides holdership (adopting a fact, lease first grant, renew, re-grant, HEAD claim, superseded exit) compares both; a missing server id is refused, never guessed. | AUTHORITY: holder identity | `core/host/volume/host.go` `applyFact`, `IsSuperseded`, `recordOtherLine`; `assignment_holder.go` `assignmentNamesSelf`; `core/host/master/services.go` `SubscribeAssignments`; `workspace_service.go` `RenewWorkspaceLease`; `cmd/blockvolume/chunk_remote.go` `chunkHolder`; `core/storage/chunk_restore.go` `ClaimChunkHead`; superseded exit covered by #409 | `TestAssignmentHolderIdentityRestartedOldProcess`, `TestAssignmentHolderIdentityMatchingServerStillAdopts`, `TestAssignmentHolderIdentityFencesPreviouslyHealthySameReplica`, `TestAssignmentHolderIdentityRefusesCarriedEndpointMismatch` (`core/host/volume/assignment_holder_test.go`); `TestWorkspaceLeaseGuardCarriesHolderServerIdentity` (`core/host/volume/workspace_holder_identity_test.go`); `TestWorkspaceLeaseRequiresHolderServerForGrantRenewAndRegrant` (`core/host/master/workspace_holder_identity_test.go`); `TestWorkspaceRPCCleanMovePreservesReplicaIdentity` (`core/host/master/workspace_service_test.go`); HEAD claim: `TestChunkHolderIsServerAndReplica` (`cmd/blockvolume/chunk_remote_test.go`), `TestWALStoreChunk_SameReplicaOnAnotherServerIsFenced` (`core/frontend/durable/provider_chunk_holder_test.go`); superseded exit: covered by #409 (server-id/replica-id pair, never replica alone) | — (unit and RPC identity boundary) | ACTIVE |
|
||||
| `INV-AUTH-EPOCH-MINT-001` | Only the publisher mints epochs; a reassignment takes the per-volume maximum epoch plus one, also after a restart. | M2 Bound → Reassigned | `core/authority/authority.go` `applyWithWorkspaceMove`, `maxPublishedEpochForVolume` | `TestG8_0_Publisher_ReassignAdvancesPerVolumeEpochAcrossReplicaSlots` (`core/authority/g8_0_authority_failover_test.go`); `TestDurableAuthority_PublisherAdvancesFromReloaded` (`core/authority/authority_restart_test.go`); `TestG9F2_AssignmentRequestShapeHasNoEpochOrEndpointVersion` (`core/host/master/authority_request_bridge_test.go`) | `ControlPlane` `UniqueEpoch` | ACTIVE |
|
||||
| `INV-AUTH-PERSIST-BEFORE-PUBLISH-001` | With an authority store configured, an assignment is written to the store before memory or any subscriber sees it, and a failed write does not publish it: see M2 any → (store write first). | M2 any → (store write first) | `core/authority/authority.go` `applyWithWorkspaceMove` | `TestDurableAuthority_PutFailureRollsBackInMemoryState` (`core/authority/authority_restart_test.go`) | `ControlPlane` `UniqueEpoch` | ACTIVE |
|
||||
| `INV-AUTH-MOVE-JOURNAL-001` | A workspace move's epoch is issued only after its journal record is durable, and one move request id gets exactly one epoch, also across restarts. | M2 MoveReserved → MoveIssued | `core/authority/workspace.go` `prepareWorkspaceMoveLocked`, `MoveWorkspace`, `sameWorkspaceRequest` | `TestWorkspaceMoveCannotIssueEpochWithoutJournal`, `TestWorkspaceCrashAfterJournalBeforeEpochResumesSameGrant` (`core/authority/workspace_test.go`); `TestWorkspaceReplayedIssueStartsGranteeLease` (`core/authority/workspace_unclaimed_grant_test.go`) | `ControlPlane` `Idempotent`, `JournalComplete` | ACTIVE |
|
||||
|
||||
Reference in new issue
Block a user