mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 02:27:26 +01:00
phase49: add returned replica executor preflight
This commit is contained in:
1 parent
819ca344ee
commit
264aa010fe
11 files changed
+526
-83
No files matched your search
@@ -1165,6 +1165,7 @@ func TestOpsReturnedReplicaFromBundleSurfacesAcrossReportExplainDashboard(t *tes
|
||||
}
|
||||
for _, want := range []string{
|
||||
"managed_volume_returned_replica=pvc-returned replica=r1 state=fenced reason=returned_replica_frontend_fenced",
|
||||
"managed_volume_executor_preflight=authority.reintegrate_returned_replica target=r1 decision=ready reason=preconditions_satisfied mode=dry_run executor=authority_recovery_executor mutation_allowed=false required_lsn=4241 durable_lsn=4241",
|
||||
"managed_volume_action=authority.reintegrate_returned_replica mode=dry_run side_effect=authority_mutating executor=authority_recovery_executor decision=allowed",
|
||||
} {
|
||||
if !strings.Contains(string(summary), want) {
|
||||
@@ -1223,6 +1224,7 @@ func TestOpsReturnedReplicaFromBundleSurfacesAcrossReportExplainDashboard(t *tes
|
||||
}
|
||||
for _, want := range []string{
|
||||
"managed_volume_returned_replica=pvc-returned replica=r1 state=fenced reason=returned_replica_frontend_fenced",
|
||||
"managed_volume_executor_preflight authority.reintegrate_returned_replica target=r1 decision=ready reason=preconditions_satisfied mode=dry_run executor=authority_recovery_executor mutation_allowed=false required_lsn=4241 durable_lsn=4241",
|
||||
"managed_volume_action authority.reintegrate_returned_replica mode=dry_run",
|
||||
} {
|
||||
if !strings.Contains(stdout.String(), want) {
|
||||
|
||||
@@ -317,6 +317,18 @@ func RenderManagedVolumeProjectionText(projection ManagedVolumeProjection) strin
|
||||
returned.RequiredFrontierKnown,
|
||||
returned.RequiredFrontierLSN)
|
||||
}
|
||||
for _, preflight := range ReturnedReplicaExecutorPreflights(projection) {
|
||||
fmt.Fprintf(&b, "managed_volume_executor_preflight %s target=%s decision=%s reason=%s mode=%s executor=%s mutation_allowed=%t required_lsn=%d durable_lsn=%d\n",
|
||||
emptyAsDash(preflight.ActionType),
|
||||
emptyAsDash(preflight.ReplicaID),
|
||||
emptyAsDash(preflight.Decision),
|
||||
emptyAsDash(preflight.Reason),
|
||||
emptyAsDash(preflight.Mode),
|
||||
emptyAsDash(preflight.OwnerExecutor),
|
||||
preflight.MutationAllowed,
|
||||
preflight.RequiredFrontierLSN,
|
||||
preflight.DurableFrontierLSN)
|
||||
}
|
||||
for _, condition := range projection.Conditions {
|
||||
fmt.Fprintf(&b, "managed_volume_condition %s status=%s reason=%s severity=%s",
|
||||
emptyAsDash(condition.Type),
|
||||
|
||||
@@ -172,6 +172,18 @@ func renderManagedProjectionSummary(b *strings.Builder, managed ManagedVolumePro
|
||||
returned.RequiredFrontierKnown,
|
||||
returned.RequiredFrontierLSN)
|
||||
}
|
||||
for _, preflight := range ReturnedReplicaExecutorPreflights(managed) {
|
||||
fmt.Fprintf(b, "managed_volume_executor_preflight=%s target=%s decision=%s reason=%s mode=%s executor=%s mutation_allowed=%t required_lsn=%d durable_lsn=%d\n",
|
||||
emptyAsDash(preflight.ActionType),
|
||||
emptyAsDash(preflight.ReplicaID),
|
||||
emptyAsDash(preflight.Decision),
|
||||
emptyAsDash(preflight.Reason),
|
||||
emptyAsDash(preflight.Mode),
|
||||
emptyAsDash(preflight.OwnerExecutor),
|
||||
preflight.MutationAllowed,
|
||||
preflight.RequiredFrontierLSN,
|
||||
preflight.DurableFrontierLSN)
|
||||
}
|
||||
for _, action := range managed.Actions {
|
||||
fmt.Fprintf(b, "managed_volume_action=%s mode=%s side_effect=%s executor=%s decision=%s",
|
||||
emptyAsDash(action.Type),
|
||||
|
||||
@@ -118,6 +118,7 @@ func TestObservationReportSummary_IncludesReturnedReplicaProjection(t *testing.T
|
||||
"managed_volume=pvc-returned status=recovering",
|
||||
"managed_volume_returned_replica=pvc-returned replica=r1 state=fenced reason=returned_replica_frontend_fenced",
|
||||
"frontend_fenced=true ack_eligible=false durable_frontier_known=true durable_lsn=52",
|
||||
"managed_volume_executor_preflight=authority.reintegrate_returned_replica target=r1 decision=ready reason=preconditions_satisfied mode=dry_run executor=authority_recovery_executor mutation_allowed=false required_lsn=52 durable_lsn=52",
|
||||
"managed_volume_action=authority.reintegrate_returned_replica mode=dry_run side_effect=authority_mutating executor=authority_recovery_executor decision=allowed",
|
||||
} {
|
||||
if !strings.Contains(summary, want) {
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
package ops
|
||||
|
||||
const (
|
||||
ReturnedReplicaExecutorPreflightReady = "ready"
|
||||
ReturnedReplicaExecutorPreflightHold = "hold"
|
||||
|
||||
ReturnedReplicaExecutorPreflightReasonSatisfied = "preconditions_satisfied"
|
||||
ReturnedReplicaExecutorPreflightReasonActionNotAllowed = "action_not_allowed"
|
||||
ReturnedReplicaExecutorPreflightReasonAmbiguousReplica = "ambiguous_returned_replica"
|
||||
ReturnedReplicaExecutorPreflightReasonNoReturnedReplica = "no_returned_replica"
|
||||
ReturnedReplicaExecutorPreflightReasonFrontendNotFenced = "returned_replica_frontend_not_fenced"
|
||||
ReturnedReplicaExecutorPreflightReasonAckEligible = "returned_replica_ack_eligible"
|
||||
ReturnedReplicaExecutorPreflightReasonMissingFrontier = "required_frontier_missing"
|
||||
ReturnedReplicaExecutorPreflightReasonDurableMissing = "durable_frontier_missing"
|
||||
ReturnedReplicaExecutorPreflightReasonFrontierBehind = "returned_replica_frontier_behind"
|
||||
ReturnedReplicaExecutorPreflightReasonWrongExecutor = "wrong_owner_executor"
|
||||
ReturnedReplicaExecutorPreflightReasonUnsupportedMode = "unsupported_action_mode"
|
||||
ReturnedReplicaExecutorPreflightReasonUnsupportedMutation = "unexpected_mutation_permission"
|
||||
)
|
||||
|
||||
// ReturnedReplicaExecutorPreflight is the non-mutating handoff contract for a
|
||||
// future authority executor. It deliberately does not perform reintegration; it
|
||||
// records whether the already-published returned-replica facts are sufficient
|
||||
// to let a later bounded executor consider the action.
|
||||
type ReturnedReplicaExecutorPreflight struct {
|
||||
ActionType string `json:"action_type"`
|
||||
VolumeID string `json:"volume_id,omitempty"`
|
||||
ReplicaID string `json:"replica_id,omitempty"`
|
||||
Decision string `json:"decision"`
|
||||
Reason string `json:"reason"`
|
||||
Mode string `json:"mode"`
|
||||
SideEffectClass string `json:"side_effect_class"`
|
||||
OwnerExecutor string `json:"owner_executor"`
|
||||
MutationAllowed bool `json:"mutation_allowed"`
|
||||
FrontendFenced bool `json:"frontend_fenced"`
|
||||
AckEligible bool `json:"ack_eligible"`
|
||||
DurableFrontierKnown bool `json:"durable_frontier_known"`
|
||||
DurableFrontierLSN uint64 `json:"durable_frontier_lsn,omitempty"`
|
||||
RequiredFrontierKnown bool `json:"required_frontier_known"`
|
||||
RequiredFrontierLSN uint64 `json:"required_frontier_lsn,omitempty"`
|
||||
EvidenceRequired string `json:"evidence_required,omitempty"`
|
||||
EvidenceRefs []string `json:"evidence_refs,omitempty"`
|
||||
ForbiddenMutationClass []string `json:"forbidden_mutation_class,omitempty"`
|
||||
}
|
||||
|
||||
func ReturnedReplicaExecutorPreflights(projection ManagedVolumeProjection) []ReturnedReplicaExecutorPreflight {
|
||||
action := returnedReplicaReintegrateAction(projection.Actions)
|
||||
if len(projection.ReplicaReintegrations) == 0 && action == nil {
|
||||
return nil
|
||||
}
|
||||
preflight := ReturnedReplicaExecutorPreflight{
|
||||
ActionType: ManagedVolumeActionReintegrateReturned,
|
||||
VolumeID: projection.VolumeID,
|
||||
Decision: ReturnedReplicaExecutorPreflightHold,
|
||||
Reason: ReturnedReplicaExecutorPreflightReasonActionNotAllowed,
|
||||
Mode: ManagedVolumeActionModeDryRun,
|
||||
SideEffectClass: ManagedVolumeSideEffectAuthorityMutating,
|
||||
OwnerExecutor: "authority_recovery_executor",
|
||||
MutationAllowed: false,
|
||||
EvidenceRequired: "returned_replica_reintegration_evidence",
|
||||
ForbiddenMutationClass: []string{"ack_eligibility", "frontend_publication", "rebuild_traffic", "failback"},
|
||||
}
|
||||
if action == nil {
|
||||
if returned, reason := returnedReplicaForExecutorPreflight(projection.ReplicaReintegrations, ""); reason == "" {
|
||||
populateReturnedReplicaPreflight(&preflight, returned)
|
||||
preflight.Reason = returnedReplicaPreflightHoldReason(returned)
|
||||
}
|
||||
return []ReturnedReplicaExecutorPreflight{preflight}
|
||||
}
|
||||
preflight.Mode = action.Mode
|
||||
preflight.SideEffectClass = action.SideEffectClass
|
||||
preflight.OwnerExecutor = action.OwnerExecutor
|
||||
preflight.EvidenceRequired = action.EvidenceRequired
|
||||
preflight.EvidenceRefs = append([]string(nil), action.EvidenceRefs...)
|
||||
if action.Decision != ManagedVolumeActionDecisionAllowed {
|
||||
preflight.Reason = defaultString(action.DecisionReason, ReturnedReplicaExecutorPreflightReasonActionNotAllowed)
|
||||
return []ReturnedReplicaExecutorPreflight{preflight}
|
||||
}
|
||||
if action.Mode != ManagedVolumeActionModeDryRun {
|
||||
preflight.Reason = ReturnedReplicaExecutorPreflightReasonUnsupportedMode
|
||||
return []ReturnedReplicaExecutorPreflight{preflight}
|
||||
}
|
||||
if action.SideEffectClass != ManagedVolumeSideEffectAuthorityMutating || action.OwnerExecutor != "authority_recovery_executor" {
|
||||
preflight.Reason = ReturnedReplicaExecutorPreflightReasonWrongExecutor
|
||||
return []ReturnedReplicaExecutorPreflight{preflight}
|
||||
}
|
||||
|
||||
returned, reason := returnedReplicaForExecutorPreflight(projection.ReplicaReintegrations, action.Target)
|
||||
if reason != "" {
|
||||
preflight.Reason = reason
|
||||
return []ReturnedReplicaExecutorPreflight{preflight}
|
||||
}
|
||||
populateReturnedReplicaPreflight(&preflight, returned)
|
||||
if len(preflight.EvidenceRefs) == 0 {
|
||||
preflight.EvidenceRefs = append([]string(nil), returned.EvidenceRefs...)
|
||||
}
|
||||
if !returned.FrontendFenced || returned.FrontendPrimaryReady {
|
||||
preflight.Reason = ReturnedReplicaExecutorPreflightReasonFrontendNotFenced
|
||||
return []ReturnedReplicaExecutorPreflight{preflight}
|
||||
}
|
||||
if returned.AckEligible {
|
||||
preflight.Reason = ReturnedReplicaExecutorPreflightReasonAckEligible
|
||||
return []ReturnedReplicaExecutorPreflight{preflight}
|
||||
}
|
||||
if !returned.RequiredFrontierKnown {
|
||||
preflight.Reason = ReturnedReplicaExecutorPreflightReasonMissingFrontier
|
||||
return []ReturnedReplicaExecutorPreflight{preflight}
|
||||
}
|
||||
if !returned.DurableFrontierKnown {
|
||||
preflight.Reason = ReturnedReplicaExecutorPreflightReasonDurableMissing
|
||||
return []ReturnedReplicaExecutorPreflight{preflight}
|
||||
}
|
||||
if returned.DurableFrontierLSN < returned.RequiredFrontierLSN {
|
||||
preflight.Reason = ReturnedReplicaExecutorPreflightReasonFrontierBehind
|
||||
return []ReturnedReplicaExecutorPreflight{preflight}
|
||||
}
|
||||
preflight.Decision = ReturnedReplicaExecutorPreflightReady
|
||||
preflight.Reason = ReturnedReplicaExecutorPreflightReasonSatisfied
|
||||
return []ReturnedReplicaExecutorPreflight{preflight}
|
||||
}
|
||||
|
||||
func populateReturnedReplicaPreflight(preflight *ReturnedReplicaExecutorPreflight, returned ReturnedReplicaProjection) {
|
||||
preflight.ReplicaID = returned.ReplicaID
|
||||
preflight.FrontendFenced = returned.FrontendFenced
|
||||
preflight.AckEligible = returned.AckEligible
|
||||
preflight.DurableFrontierKnown = returned.DurableFrontierKnown
|
||||
preflight.DurableFrontierLSN = returned.DurableFrontierLSN
|
||||
preflight.RequiredFrontierKnown = returned.RequiredFrontierKnown
|
||||
preflight.RequiredFrontierLSN = returned.RequiredFrontierLSN
|
||||
}
|
||||
|
||||
func returnedReplicaPreflightHoldReason(returned ReturnedReplicaProjection) string {
|
||||
if !returned.FrontendFenced || returned.FrontendPrimaryReady {
|
||||
return ReturnedReplicaExecutorPreflightReasonFrontendNotFenced
|
||||
}
|
||||
if returned.AckEligible {
|
||||
return ReturnedReplicaExecutorPreflightReasonAckEligible
|
||||
}
|
||||
if !returned.RequiredFrontierKnown {
|
||||
return ReturnedReplicaExecutorPreflightReasonMissingFrontier
|
||||
}
|
||||
if !returned.DurableFrontierKnown {
|
||||
return ReturnedReplicaExecutorPreflightReasonDurableMissing
|
||||
}
|
||||
if returned.DurableFrontierLSN < returned.RequiredFrontierLSN {
|
||||
return ReturnedReplicaExecutorPreflightReasonFrontierBehind
|
||||
}
|
||||
return ReturnedReplicaExecutorPreflightReasonActionNotAllowed
|
||||
}
|
||||
|
||||
func returnedReplicaReintegrateAction(actions []ManagedVolumeAction) *ManagedVolumeAction {
|
||||
for i := range actions {
|
||||
if actions[i].Type == ManagedVolumeActionReintegrateReturned {
|
||||
return &actions[i]
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func returnedReplicaForExecutorPreflight(returned []ReturnedReplicaProjection, target string) (ReturnedReplicaProjection, string) {
|
||||
if len(returned) == 0 {
|
||||
return ReturnedReplicaProjection{}, ReturnedReplicaExecutorPreflightReasonNoReturnedReplica
|
||||
}
|
||||
var matches []ReturnedReplicaProjection
|
||||
for _, candidate := range returned {
|
||||
if target == "" || candidate.ReplicaID == target {
|
||||
matches = append(matches, candidate)
|
||||
}
|
||||
}
|
||||
if len(matches) == 0 {
|
||||
return ReturnedReplicaProjection{}, ReturnedReplicaExecutorPreflightReasonNoReturnedReplica
|
||||
}
|
||||
if len(matches) > 1 {
|
||||
return ReturnedReplicaProjection{}, ReturnedReplicaExecutorPreflightReasonAmbiguousReplica
|
||||
}
|
||||
return matches[0], ""
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
package ops
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestReturnedReplicaExecutorPreflight_ReadyFromFencedFrontier(t *testing.T) {
|
||||
projection := returnedReplicaPreflightProjection(t, func(*ManagedVolumeFacts) {})
|
||||
|
||||
preflights := ReturnedReplicaExecutorPreflights(projection)
|
||||
if len(preflights) != 1 {
|
||||
t.Fatalf("preflights=%+v", preflights)
|
||||
}
|
||||
preflight := preflights[0]
|
||||
if preflight.Decision != ReturnedReplicaExecutorPreflightReady || preflight.Reason != ReturnedReplicaExecutorPreflightReasonSatisfied {
|
||||
t.Fatalf("preflight=%+v", preflight)
|
||||
}
|
||||
if preflight.ReplicaID != "r1" || preflight.MutationAllowed {
|
||||
t.Fatalf("preflight must target r1 without mutation permission: %+v", preflight)
|
||||
}
|
||||
if preflight.RequiredFrontierLSN != 52 || preflight.DurableFrontierLSN != 52 {
|
||||
t.Fatalf("frontiers=%+v", preflight)
|
||||
}
|
||||
}
|
||||
|
||||
func TestReturnedReplicaExecutorPreflight_HoldsWhenActionRejected(t *testing.T) {
|
||||
projection := returnedReplicaPreflightProjection(t, func(facts *ManagedVolumeFacts) {
|
||||
facts.Authority.RequiredFrontierKnown = false
|
||||
})
|
||||
|
||||
preflight := onlyReturnedReplicaPreflight(t, projection)
|
||||
if preflight.Decision != ReturnedReplicaExecutorPreflightHold || preflight.Reason != ManagedVolumeActionRejectMissingFacts {
|
||||
t.Fatalf("preflight=%+v", preflight)
|
||||
}
|
||||
if preflight.MutationAllowed {
|
||||
t.Fatalf("hold must stay non-mutating: %+v", preflight)
|
||||
}
|
||||
}
|
||||
|
||||
func TestReturnedReplicaExecutorPreflight_HoldsUnsafeFrontend(t *testing.T) {
|
||||
projection := returnedReplicaPreflightProjection(t, func(facts *ManagedVolumeFacts) {
|
||||
facts.Replicas[0].FrontendPrimaryReady = true
|
||||
})
|
||||
|
||||
preflight := onlyReturnedReplicaPreflight(t, projection)
|
||||
if preflight.Decision != ReturnedReplicaExecutorPreflightHold || preflight.Reason != ReturnedReplicaExecutorPreflightReasonFrontendNotFenced {
|
||||
t.Fatalf("preflight=%+v", preflight)
|
||||
}
|
||||
}
|
||||
|
||||
func TestReturnedReplicaExecutorPreflight_HoldsFrontierBehind(t *testing.T) {
|
||||
projection := returnedReplicaPreflightProjection(t, func(facts *ManagedVolumeFacts) {
|
||||
facts.Replicas[0].DurableFrontierLSN = 51
|
||||
})
|
||||
|
||||
preflight := onlyReturnedReplicaPreflight(t, projection)
|
||||
if preflight.Decision != ReturnedReplicaExecutorPreflightHold || preflight.Reason != ReturnedReplicaExecutorPreflightReasonFrontierBehind {
|
||||
t.Fatalf("preflight=%+v", preflight)
|
||||
}
|
||||
}
|
||||
|
||||
func TestReturnedReplicaExecutorPreflight_HoldsAmbiguousReturnedReplicas(t *testing.T) {
|
||||
projection := returnedReplicaPreflightProjection(t, func(facts *ManagedVolumeFacts) {
|
||||
facts.Authority.PreviousPrimary = ""
|
||||
facts.Replicas = append(facts.Replicas, ReplicaFact{
|
||||
ReplicaID: "r3",
|
||||
Observed: true,
|
||||
Role: "stale",
|
||||
DurableFrontierKnown: true,
|
||||
DurableFrontierLSN: 52,
|
||||
FrontendPrimaryReady: false,
|
||||
StalePrimaryFenced: true,
|
||||
})
|
||||
})
|
||||
for i := range projection.Actions {
|
||||
if projection.Actions[i].Type == ManagedVolumeActionReintegrateReturned {
|
||||
projection.Actions[i].Target = ""
|
||||
}
|
||||
}
|
||||
|
||||
preflight := onlyReturnedReplicaPreflight(t, projection)
|
||||
if preflight.Decision != ReturnedReplicaExecutorPreflightHold || preflight.Reason != ReturnedReplicaExecutorPreflightReasonAmbiguousReplica {
|
||||
t.Fatalf("preflight=%+v", preflight)
|
||||
}
|
||||
}
|
||||
|
||||
func returnedReplicaPreflightProjection(t *testing.T, mutate func(*ManagedVolumeFacts)) ManagedVolumeProjection {
|
||||
t.Helper()
|
||||
facts := ManagedVolumeFacts{
|
||||
VolumeID: "pvc-returned",
|
||||
PVC: &PVCFact{Phase: "Bound"},
|
||||
Authority: &AuthorityFact{
|
||||
PrimaryReplica: "r2",
|
||||
PreviousPrimary: "r1",
|
||||
RequiredFrontierKnown: true,
|
||||
RequiredFrontierLSN: 52,
|
||||
},
|
||||
Replicas: []ReplicaFact{{
|
||||
ReplicaID: "r1",
|
||||
Observed: true,
|
||||
Role: "previous_primary",
|
||||
DurableFrontierKnown: true,
|
||||
DurableFrontierLSN: 52,
|
||||
FrontendPrimaryReady: false,
|
||||
StalePrimaryFenced: true,
|
||||
}, {
|
||||
ReplicaID: "r2",
|
||||
Observed: true,
|
||||
Role: "primary",
|
||||
DurableFrontierKnown: true,
|
||||
DurableFrontierLSN: 52,
|
||||
}},
|
||||
EvidenceRefs: []string{"returned-replica-summary.txt"},
|
||||
}
|
||||
mutate(&facts)
|
||||
return ProjectManagedVolume(facts)
|
||||
}
|
||||
|
||||
func onlyReturnedReplicaPreflight(t *testing.T, projection ManagedVolumeProjection) ReturnedReplicaExecutorPreflight {
|
||||
t.Helper()
|
||||
preflights := ReturnedReplicaExecutorPreflights(projection)
|
||||
if len(preflights) != 1 {
|
||||
t.Fatalf("preflights=%+v", preflights)
|
||||
}
|
||||
return preflights[0]
|
||||
}
|
||||
@@ -146,7 +146,13 @@ Recommended order from here:
|
||||
evidence proving r1 remains fenced, r2 remains the primary, and the returned
|
||||
replica covers the required frontier before any future executor mutates
|
||||
authority or storage state.
|
||||
6. Add backup/restore and NVMe ANA parity after they can reuse the same action
|
||||
6. Phase 49: returned-replica executor preflight. **Closed 2026-06-20, local PASS**
|
||||
(`internal/docs/finished-plans/phase49_finishedplan_returned_replica_executor_preflight.md`).
|
||||
The returned-replica dry-run action now has a typed preflight that is ready
|
||||
only when the target is unique, frontend/ACK fenced, and durable frontier
|
||||
evidence covers the required frontier. It remains non-mutating and does not
|
||||
claim automatic reintegration, rebuild, failback, or frontend publication.
|
||||
7. Add backup/restore and NVMe ANA parity after they can reuse the same action
|
||||
owner, evidence, and status model rather than creating another isolated
|
||||
control plane.
|
||||
|
||||
@@ -155,7 +161,8 @@ The internal release-train contract is
|
||||
the operation-layer loop for a bounded `SwBlockVolume` protection finalizer.
|
||||
Phase 46 reused this same fact -> judgment -> action -> evidence pattern for
|
||||
returned-replica reintegration before any larger storage feature is enabled.
|
||||
Phase 47 starts the executor-admission bridge without allowing mutation.
|
||||
Phases 47-49 start the executor-admission and preflight bridge without allowing
|
||||
mutation.
|
||||
|
||||
The practical rule is:
|
||||
|
||||
|
||||
@@ -1,123 +1,122 @@
|
||||
# Current Plan: Phase 48 Returned-Replica Live Evidence Close
|
||||
# Current Plan: Phase 49 Returned-Replica Executor Preflight
|
||||
|
||||
Status: complete; QA PASS.
|
||||
Status: complete; local validation PASS.
|
||||
|
||||
Working branch: `phase48-returned-replica-live-evidence`
|
||||
Working branch: `phase49-returned-replica-executor-preflight`
|
||||
|
||||
Decision note: v0.5 release smoke remains intentionally skipped. Do not mark
|
||||
v0.5 released until matching public images are published and the pinned-image
|
||||
smoke is run.
|
||||
Decision note: this phase does not execute reintegration, rebuild, ACK
|
||||
eligibility, failback, or frontend publication. It adds the executable
|
||||
preflight contract a future authority executor must satisfy before any storage
|
||||
or authority mutation can be considered.
|
||||
|
||||
Previous product phase: Phase 47 is closed in
|
||||
`internal/docs/finished-plans/phase47_finishedplan_returned_replica_executor_admission.md`.
|
||||
Previous product phase: Phase 48 is closed in
|
||||
`internal/docs/finished-plans/phase48_finishedplan_returned_replica_live_evidence.md`.
|
||||
|
||||
Finished plan:
|
||||
`internal/docs/finished-plans/phase48_finishedplan_returned_replica_live_evidence.md`.
|
||||
`internal/docs/finished-plans/phase49_finishedplan_returned_replica_executor_preflight.md`.
|
||||
|
||||
## Product Goal
|
||||
|
||||
Close the remaining returned-replica evidence gap before any mutating executor:
|
||||
Turn Phase 48 same-run returned-replica evidence into a precise executor
|
||||
preflight:
|
||||
|
||||
```text
|
||||
real iSCSI returned-replica run
|
||||
-> r2 remains the sole frontend-ready primary
|
||||
-> returned r1 remains frontend/ACK fenced
|
||||
-> r1 durable frontier is observed
|
||||
-> required frontier is derived from the live primary evidence
|
||||
-> report/explain/dashboard can replay the same run as dry-run allowed
|
||||
-> no rebuild/failback/ACK/frontend mutation executes
|
||||
returned replica evidence
|
||||
-> dry-run action admitted
|
||||
-> exactly one target replica
|
||||
-> frontend/ACK fenced
|
||||
-> durable frontier covers required frontier
|
||||
-> preflight=ready, mutation_allowed=false
|
||||
```
|
||||
|
||||
Phase 47 admitted `authority.reintegrate_returned_replica` only as a dry-run
|
||||
action, but the live iSCSI scenario did not emit the managed-volume evidence
|
||||
needed to prove the dry-run action from the same run. Phase 48 makes the live
|
||||
gate produce and validate that evidence.
|
||||
Anything incomplete or unsafe must produce `preflight=hold` with a stable reason.
|
||||
|
||||
## Why This Is Next
|
||||
|
||||
Skipping directly from Phase 47 to a mutating executor would repeat the failure
|
||||
mode we have been removing:
|
||||
Phase 47 admitted `authority.reintegrate_returned_replica` as a dry-run action.
|
||||
Phase 48 proved the live iSCSI scenario can carry the required evidence. The
|
||||
remaining risk before a real executor is ambiguity: a future mutating component
|
||||
should not infer readiness from free-form report lines.
|
||||
|
||||
```text
|
||||
product surface says an action is allowed
|
||||
but the live scenario that drove the storage path did not carry the exact facts
|
||||
```
|
||||
|
||||
The next executor phase must start from same-run live evidence, not a synthetic
|
||||
bundle plus a separate storage smoke.
|
||||
Phase 49 adds a typed preflight layer that makes the handoff explicit while
|
||||
keeping the no-mutation boundary.
|
||||
|
||||
## Scope Contract
|
||||
|
||||
| In | Out |
|
||||
|---|---|
|
||||
| live returned-replica evidence bundle from the iSCSI scenario | automatic failback |
|
||||
| required frontier derived from live durable primary evidence | rebuild traffic |
|
||||
| returned replica durable frontier compared to required frontier | ACK eligibility mutation |
|
||||
| report/operator-snapshot/dashboard/explain replay from same run | frontend publication change |
|
||||
| TestOps assertions for dry-run allowed action from live evidence | release-image publication |
|
||||
| `ReturnedReplicaExecutorPreflight` model | ACK eligibility mutation |
|
||||
| fail-closed decision reasons | frontend publication mutation |
|
||||
| report and explain visibility | rebuild traffic |
|
||||
| unit tests for ready/hold states | automatic failback |
|
||||
| Phase 48 bundle surface regression | CRD schema change |
|
||||
|
||||
## D1: Scenario Evidence Emission
|
||||
## D1: Preflight Model
|
||||
|
||||
Goal: extend `iscsi-returned-replica-chain.yaml` so the live run emits a
|
||||
`product-observation/cluster-evidence.json` bundle after r1 returns.
|
||||
Goal: create a pure `core/ops` preflight contract for
|
||||
`authority.reintegrate_returned_replica`.
|
||||
|
||||
Acceptance:
|
||||
|
||||
```text
|
||||
[x] sw-block binary is built with blockmaster/blockvolume
|
||||
[x] bundle contains r2 as primary/frontend-ready
|
||||
[x] bundle contains returned r1 as frontend-fenced/non-healthy
|
||||
[x] bundle contains required_frontier_known=true
|
||||
[x] required_frontier_lsn comes from live r2 durable status
|
||||
[x] returned r1 durable_lsn >= required_frontier_lsn
|
||||
[x] ready only when the dry-run action is allowed
|
||||
[x] ready only for exactly one returned replica target
|
||||
[x] ready only when frontend_fenced=true and ack_eligible=false
|
||||
[x] ready only when durable_lsn >= required_lsn
|
||||
[x] mutation_allowed=false in all states
|
||||
```
|
||||
|
||||
## D2: Same-Run Report Replay
|
||||
## D2: Fail-Closed Reasons
|
||||
|
||||
Goal: run `sw-block ops report --from-bundle` against the same live scenario
|
||||
artifacts and assert the Phase 47 action decision.
|
||||
Goal: make unsafe or incomplete evidence explain why a future executor must not
|
||||
run.
|
||||
|
||||
Acceptance:
|
||||
|
||||
```text
|
||||
[x] summary shows returned r1 state=fenced reason=returned_replica_frontend_fenced
|
||||
[x] summary shows authority.reintegrate_returned_replica decision=allowed
|
||||
[x] action remains mode=dry_run mutation_allowed=false
|
||||
[x] report is produced from the live run directory, not a synthetic fixture
|
||||
[x] cleanup verifier reports zero residue
|
||||
[x] missing frontier -> hold
|
||||
[x] unsafe frontend -> hold
|
||||
[x] frontier behind -> hold
|
||||
[x] ambiguous returned replica -> hold
|
||||
[x] action rejected -> hold
|
||||
```
|
||||
|
||||
## D3: Product Surface Parity
|
||||
## D3: Product Surface Visibility
|
||||
|
||||
Goal: ensure the live-derived bundle remains consumable by product surfaces.
|
||||
Goal: show the preflight in the surfaces that already carry returned-replica
|
||||
evidence.
|
||||
|
||||
Acceptance:
|
||||
|
||||
```text
|
||||
[x] operator-snapshot carries replica_reintegrations[] for r1
|
||||
[x] operator-snapshot carries the dry-run allowed action
|
||||
[x] dashboard replay returns the same operator-snapshot
|
||||
[x] explain output includes returned-replica state and action decision
|
||||
[x] report summary renders managed_volume_executor_preflight=...
|
||||
[x] ops explain renders managed_volume_executor_preflight ...
|
||||
[x] existing returned-replica bundle test asserts both surfaces
|
||||
[x] operator-snapshot/CRD remain unchanged in this phase
|
||||
```
|
||||
|
||||
Implementation may be either scenario-level assertions or a small wrapper gate
|
||||
that replays the collected bundle after the iSCSI scenario.
|
||||
## D4: Validation
|
||||
|
||||
## D4: Close / Executor Readiness Decision
|
||||
|
||||
Goal: decide whether the next phase is allowed to design a real mutating
|
||||
executor.
|
||||
|
||||
Acceptance:
|
||||
Validation completed:
|
||||
|
||||
```text
|
||||
[x] QA sign-off states same-run live evidence status
|
||||
[x] finished plan records the no-mutation boundary
|
||||
[x] roadmap separates "executor admission" from "executor execution"
|
||||
[x] next phase is explicitly scoped if mutation is proposed
|
||||
[x] go test -count=1 ./core/ops
|
||||
[x] go test -count=1 ./cmd/sw-block -run TestOpsReturnedReplicaFromBundleSurfacesAcrossReportExplainDashboard
|
||||
```
|
||||
|
||||
Only after D4 should a later phase consider a bounded executor for
|
||||
catch-up/rebuild/failback. That later phase must define owner, admission/RBAC,
|
||||
preconditions, terminal evidence, rollback behavior, and multi-volume isolation
|
||||
before enabling any mutation.
|
||||
## Next Phase Candidate
|
||||
|
||||
The next storage-executor phase, if started, must define:
|
||||
|
||||
```text
|
||||
owner executor
|
||||
admission/RBAC boundary
|
||||
exact mutation set
|
||||
terminal evidence after mutation
|
||||
hold/retry behavior
|
||||
multi-volume isolation
|
||||
rollback/fail-closed behavior
|
||||
live QA gate
|
||||
```
|
||||
|
||||
Do not enable a mutating returned-replica executor from Phase 49 alone.
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
# Phase 49 Finished Plan: Returned-Replica Executor Preflight
|
||||
|
||||
Status: complete.
|
||||
|
||||
Branch: `phase49-returned-replica-executor-preflight`
|
||||
|
||||
## Summary
|
||||
|
||||
Phase 49 adds a non-mutating executor preflight for returned-replica
|
||||
reintegration. It converts the Phase 48 evidence and the Phase 47 dry-run action
|
||||
decision into a typed handoff contract for a future authority executor.
|
||||
|
||||
The preflight can say `ready`, but it still reports `mutation_allowed=false`.
|
||||
This is intentional: Phase 49 is the final planning/evidence bridge before a
|
||||
future mutating executor, not the executor itself.
|
||||
|
||||
## What Changed
|
||||
|
||||
- Added `ReturnedReplicaExecutorPreflight` in `core/ops`.
|
||||
- Added fail-closed reasons for:
|
||||
- action not allowed,
|
||||
- ambiguous returned replica,
|
||||
- unsafe frontend,
|
||||
- ACK eligibility already enabled,
|
||||
- missing required frontier,
|
||||
- missing durable frontier,
|
||||
- returned replica frontier behind,
|
||||
- wrong executor/mode/mutation posture.
|
||||
- Rendered preflight lines in:
|
||||
- `sw-block ops report --from-bundle` summary,
|
||||
- `sw-block ops explain volume --from-bundle`.
|
||||
- Kept CRD/operator-snapshot schema unchanged for this phase.
|
||||
|
||||
## Closed Acceptance
|
||||
|
||||
```text
|
||||
ready requires dry-run action decision=allowed
|
||||
ready requires exactly one returned-replica target
|
||||
ready requires frontend_fenced=true
|
||||
ready requires ack_eligible=false
|
||||
ready requires required_frontier_known=true
|
||||
ready requires durable_frontier_known=true
|
||||
ready requires durable_lsn >= required_lsn
|
||||
all decisions keep mutation_allowed=false
|
||||
```
|
||||
|
||||
## Validation
|
||||
|
||||
```text
|
||||
go test -count=1 ./core/ops
|
||||
go test -count=1 ./cmd/sw-block -run TestOpsReturnedReplicaFromBundleSurfacesAcrossReportExplainDashboard
|
||||
```
|
||||
|
||||
Both passed.
|
||||
|
||||
## Non-Claims
|
||||
|
||||
- No ACK eligibility mutation.
|
||||
- No frontend publication change.
|
||||
- No rebuild traffic.
|
||||
- No automatic failback.
|
||||
- No lifecycle-owner or operator-status RBAC expansion.
|
||||
- No release-image claim.
|
||||
|
||||
## Next Step
|
||||
|
||||
A future executor phase may use this preflight as its input contract, but must
|
||||
add its own admission/RBAC boundary, exact mutation set, terminal evidence,
|
||||
multi-volume isolation, and live QA gate before enabling any mutation.
|
||||
@@ -57,8 +57,12 @@ This is the short internal roadmap. Keep it current and readable.
|
||||
evidence refs, cleanup visibility, safe next-step hints, and cross-surface
|
||||
agreement. This remains read-only and does not add mutating operator
|
||||
lifecycle.
|
||||
- Active phase: Phase 37 Live Node Evidence Hardening. Keep it read-only and
|
||||
bounded to live node blockers; do not extend it into mutating lifecycle.
|
||||
- Current development slice: returned-replica reintegration productization has
|
||||
advanced through Phase 49. Phases 46-49 made returned replicas visible in the
|
||||
ManagedVolume model, admitted reintegration only as a dry-run action, proved
|
||||
same-run live evidence from the iSCSI returned-replica scenario, and added a
|
||||
non-mutating executor preflight. Do not claim automatic reintegration,
|
||||
rebuild, failback, ACK eligibility mutation, or frontend publication yet.
|
||||
- Model hardening gate before the next large release: complete the
|
||||
ManagedVolume Operations Model under `internal/docs/protocol/` before
|
||||
expanding operator or broader HA claims. The goal is to prevent Kubernetes,
|
||||
@@ -183,11 +187,16 @@ rebuild, delete safety, or cleanup must start as a separate gated phase.
|
||||
distinct nodes, non-loopback frontends, node-aware publish target selection,
|
||||
authority promotion to a surviving replica, host-path recovery through the
|
||||
documented mechanism, and support-bundle proof of fencing and data integrity.
|
||||
- Later: returned-replica rebuild/reintegration/failback, NVMe ANA Kubernetes
|
||||
multipath parity, stronger committed-frontier reporting, broad distro/host
|
||||
compatibility, and longer soak under failure. NVMe ANA parity should follow
|
||||
the Kubernetes-native status foundation so ANA facts, path states, and
|
||||
protocol-specific reasons project through the same CRD/Condition/Event model.
|
||||
- Current returned-replica status: observed returned replicas are productized
|
||||
through the ManagedVolume surface. A dry-run reintegration action and
|
||||
executor preflight can become ready only with fencing and frontier evidence.
|
||||
The actual authority/storage mutation is still deferred.
|
||||
- Later: returned-replica rebuild/reintegration/failback execution, NVMe ANA
|
||||
Kubernetes multipath parity, stronger committed-frontier reporting, broad
|
||||
distro/host compatibility, and longer soak under failure. NVMe ANA parity
|
||||
should follow the Kubernetes-native status foundation so ANA facts, path
|
||||
states, and protocol-specific reasons project through the same
|
||||
CRD/Condition/Event model.
|
||||
|
||||
### Track E: Protocol / Backend Expansion
|
||||
|
||||
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
# Phase 49 Returned-Replica Executor Preflight QA Sign-off
|
||||
|
||||
Verdict: PASS.
|
||||
|
||||
Scope: local contract and product-surface replay. This phase has no live storage
|
||||
mutation and no Kubernetes RBAC/admission change.
|
||||
|
||||
## Gates
|
||||
|
||||
| Gate | Result | Evidence |
|
||||
|---|---|---|
|
||||
| G1 preflight ready | PASS | fenced returned replica with durable frontier covering required frontier produces `decision=ready reason=preconditions_satisfied` |
|
||||
| G2 fail closed | PASS | missing frontier, unsafe frontend, frontier behind, and ambiguous returned-replica cases hold |
|
||||
| G3 no mutation | PASS | every preflight keeps `mutation_allowed=false` |
|
||||
| G4 report surface | PASS | `summary.txt` includes `managed_volume_executor_preflight=authority.reintegrate_returned_replica ... decision=ready ... mutation_allowed=false` |
|
||||
| G5 explain surface | PASS | `ops explain volume --from-bundle` includes the same preflight line |
|
||||
|
||||
## Commands
|
||||
|
||||
```text
|
||||
go test -count=1 ./core/ops
|
||||
go test -count=1 ./cmd/sw-block -run TestOpsReturnedReplicaFromBundleSurfacesAcrossReportExplainDashboard
|
||||
```
|
||||
|
||||
Both passed.
|
||||
|
||||
## Release Boundary
|
||||
|
||||
Phase 49 is not a release-enabling mutating executor. It is a preflight contract
|
||||
for the next executor phase. Do not claim automatic reintegration, rebuild,
|
||||
failback, ACK eligibility mutation, or frontend publication from this phase.
|
||||
Reference in new issue
Block a user