mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-06 02:57:37 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
50059133d4 | ||
|
|
514e7b8a54 | ||
|
|
ca6cf4eacb | ||
|
|
bca02f467d | ||
|
|
4c2db0e423 | ||
|
|
1c260e2c7b | ||
|
|
af38a640d1 | ||
|
|
183aee800c | ||
|
|
b85a870c03 | ||
|
|
5ed8a644dc | ||
|
|
f6e4f59d79 | ||
|
|
aeae2b5f7b | ||
|
|
476001be77 | ||
|
|
64529e87c8 | ||
|
|
c380e49e23 | ||
|
|
fe262f7e28 | ||
|
|
9fea81e88a | ||
|
|
a0e484dba1 | ||
|
|
0687c4d5b2 | ||
|
|
6635e3b378 | ||
|
|
d975b7a874 | ||
|
|
205e40cf54 | ||
|
|
290049b1bf | ||
|
|
92d75b099b | ||
|
|
98b3104ad5 | ||
|
|
860602beaa | ||
|
|
e2849ba53d | ||
|
|
3b6f67e51a |
No files matched your search
@@ -327,12 +327,28 @@ func (c *TopologyController) processSupportedVolumeLocked(
|
||||
c.outcome[vol.VolumeID] = "no ask: " + reason
|
||||
return
|
||||
}
|
||||
// Same-ask dedupe: if the identical ask is already the current
|
||||
// desired, do not re-enqueue. Without this guard, repeated
|
||||
// identical supported feeds would mint a new Reassign epoch
|
||||
// each iteration — authority churn.
|
||||
// Same-ask dedupe: while the identical ask is pending (queued, or
|
||||
// taken by the publisher and still being applied), do not
|
||||
// re-enqueue. Without this guard, repeated identical supported
|
||||
// feeds would mint a new Reassign epoch each iteration —
|
||||
// authority churn. An identical ask that is no longer pending
|
||||
// ended without a publication (lost): enqueue it again, keeping
|
||||
// its DesiredAt so a repeatedly lost ask still reports Stuck.
|
||||
if prev, ok := c.desired[vol.VolumeID]; ok && sameAsk(prev.Ask, ask) {
|
||||
c.outcome[vol.VolumeID] = fmt.Sprintf("already desired since %s: %s %s (%s)", prev.DesiredAt.UTC().Format(time.RFC3339Nano), ask.Intent, ask.ReplicaID, prev.Reason)
|
||||
since := prev.DesiredAt.UTC().Format(time.RFC3339Nano)
|
||||
if c.queue.pending(vol.VolumeID) {
|
||||
c.outcome[vol.VolumeID] = fmt.Sprintf("already desired since %s: %s %s (%s)", since, ask.Intent, ask.ReplicaID, prev.Reason)
|
||||
return
|
||||
}
|
||||
// Not pending also after the publisher published it since the line
|
||||
// was read: lost only while the line is still the one decided against.
|
||||
if line, ok := c.reader.VolumeAuthorityLine(vol.VolumeID); ok != hasLine || line != currentLine {
|
||||
c.outcome[vol.VolumeID] = fmt.Sprintf("no ask: the line moved to %s@%d while deciding against %s@%d", line.ReplicaID, line.Epoch, currentLine.ReplicaID, currentLine.Epoch)
|
||||
return
|
||||
}
|
||||
c.queue.enqueue(ask)
|
||||
c.outcome[vol.VolumeID] = fmt.Sprintf("enqueued again %s %s (%s): desired since %s, its last ask ended without a publication", ask.Intent, ask.ReplicaID, prev.Reason, since)
|
||||
applyProjectedMove(projectedLoad, vol, currentLine, hasLine, ask)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -550,13 +566,14 @@ func (c *TopologyController) decideVolume(
|
||||
return AssignmentAsk{}, "the current primary is acceptable; rebalance target " + target.ReplicaID + " has no planned-move evidence", false
|
||||
}
|
||||
return AssignmentAsk{
|
||||
VolumeID: vol.VolumeID,
|
||||
ReplicaID: target.ReplicaID,
|
||||
DataAddr: target.DataAddr,
|
||||
CtrlAddr: target.CtrlAddr,
|
||||
Intent: IntentReassign,
|
||||
Evidence: plannedEvidence(target.PromotionEvidence),
|
||||
Incarnation: target.Incarnation,
|
||||
VolumeID: vol.VolumeID,
|
||||
ReplicaID: target.ReplicaID,
|
||||
DataAddr: target.DataAddr,
|
||||
CtrlAddr: target.CtrlAddr,
|
||||
Intent: IntentReassign,
|
||||
Evidence: plannedEvidence(target.PromotionEvidence),
|
||||
Incarnation: target.Incarnation,
|
||||
ExpectCurrent: expectedLineOf(currentLine),
|
||||
}, "rebalance", true
|
||||
}
|
||||
return AssignmentAsk{}, "the current primary is acceptable", false
|
||||
@@ -583,13 +600,14 @@ func (c *TopologyController) decideVolume(
|
||||
// its target (one decider): no evidence, no promotion.
|
||||
if best.PromotionEvidence.Kind == adapter.PrimaryKindPromotion {
|
||||
return AssignmentAsk{
|
||||
VolumeID: vol.VolumeID,
|
||||
ReplicaID: best.ReplicaID,
|
||||
DataAddr: best.DataAddr,
|
||||
CtrlAddr: best.CtrlAddr,
|
||||
Intent: IntentReassign,
|
||||
Evidence: best.PromotionEvidence,
|
||||
Incarnation: best.Incarnation,
|
||||
VolumeID: vol.VolumeID,
|
||||
ReplicaID: best.ReplicaID,
|
||||
DataAddr: best.DataAddr,
|
||||
CtrlAddr: best.CtrlAddr,
|
||||
Intent: IntentReassign,
|
||||
Evidence: best.PromotionEvidence,
|
||||
Incarnation: best.Incarnation,
|
||||
ExpectCurrent: expectedLineOf(currentLine),
|
||||
}, "failover", true
|
||||
}
|
||||
why = "failover target " + best.ReplicaID + " has no promotion evidence"
|
||||
@@ -623,10 +641,17 @@ func refreshAsk(volumeID string, current ReplicaCandidate, line AuthorityBasis)
|
||||
CtrlAddr: current.CtrlAddr,
|
||||
Intent: IntentRefreshEndpoint,
|
||||
Incarnation: current.Incarnation,
|
||||
ExpectCurrent: &ExpectedLine{ReplicaID: line.ReplicaID, Epoch: line.Epoch, DataAddr: line.DataAddr, CtrlAddr: line.CtrlAddr},
|
||||
ExpectCurrent: expectedLineOf(line),
|
||||
}
|
||||
}
|
||||
|
||||
// expectedLineOf conditions an ask on the line it was decided against: a
|
||||
// publication that lands while the ask waits in the queue (an operator's
|
||||
// failback) refuses it instead of being overwritten.
|
||||
func expectedLineOf(line AuthorityBasis) *ExpectedLine {
|
||||
return &ExpectedLine{ReplicaID: line.ReplicaID, Epoch: line.Epoch, DataAddr: line.DataAddr, CtrlAddr: line.CtrlAddr}
|
||||
}
|
||||
|
||||
func volumeIncludesReplica(vol VolumeTopologySnapshot, replicaID string) bool {
|
||||
for _, slot := range vol.Slots {
|
||||
if slot.ReplicaID == replicaID {
|
||||
|
||||
@@ -0,0 +1,252 @@
|
||||
package authority
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"strings"
|
||||
"testing"
|
||||
"testing/synctest"
|
||||
"time"
|
||||
|
||||
"github.com/seaweedfs/seaweed-block/core/adapter"
|
||||
)
|
||||
|
||||
// The same-ask dedupe holds a desired Reassign only while that ask is
|
||||
// pending: queued, or taken by the publisher and still being applied. An
|
||||
// ask the publisher took and ended without publishing (its apply refused
|
||||
// it) is lost, and the next intake of the same state enqueues it again.
|
||||
// Holding the lost ask as "already desired" would keep the volume on its
|
||||
// old primary for good.
|
||||
func TestALostReassignIsEnqueuedAgainOnTheNextIntake(t *testing.T) {
|
||||
synctest.Test(t, func(t *testing.T) {
|
||||
reader := newFakeBasisReader()
|
||||
line := AuthorityBasis{Assigned: true, ReplicaID: "r1", Epoch: 1, EndpointVersion: 1, DataAddr: "d1", CtrlAddr: "c1"}
|
||||
reader.Set("v1", "r1", line)
|
||||
ctrl := NewTopologyController(TopologyControllerConfig{}, reader)
|
||||
r1 := candidate("r1", "s1", "d1", "c1", 10)
|
||||
r1.Reachable = false
|
||||
snap := ClusterSnapshot{
|
||||
CollectedRevision: 2,
|
||||
Servers: []ServerObservation{
|
||||
{ServerID: "s1", Reachable: true, Eligible: true},
|
||||
{ServerID: "s2", Reachable: true, Eligible: true},
|
||||
{ServerID: "s3", Reachable: true, Eligible: true},
|
||||
},
|
||||
Volumes: []VolumeTopologySnapshot{clusterVolume("v1", line, r1, candidate("r2", "s2", "d2", "c2", 20), candidate("r3", "s3", "d3", "c3", 10))},
|
||||
}
|
||||
submit := func() {
|
||||
t.Helper()
|
||||
if err := ctrl.SubmitClusterSnapshot(snap); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
submit()
|
||||
if ask := nextAskOrFail(t, ctrl); ask.Intent != IntentReassign || ask.ReplicaID != "r2" {
|
||||
t.Fatalf("first intake: %+v, want Reassign r2", ask)
|
||||
}
|
||||
|
||||
// The publisher holds the ask (applying it): the same state again is
|
||||
// deduplicated, nothing is queued twice.
|
||||
submit()
|
||||
if out := ctrl.LastOutcome("v1"); !strings.HasPrefix(out, "already desired since ") {
|
||||
t.Fatalf("while the ask is being applied: outcome %q, want already desired", out)
|
||||
}
|
||||
|
||||
// The apply ended without a publication (the line is still r1@1) and
|
||||
// the publisher waits for its next ask: the ask is lost.
|
||||
next := make(chan AssignmentAsk, 1)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
|
||||
defer cancel()
|
||||
go func() {
|
||||
if ask, err := ctrl.Next(ctx); err == nil {
|
||||
next <- ask
|
||||
}
|
||||
}()
|
||||
synctest.Wait() // the publisher is back in Next, holding nothing
|
||||
submit()
|
||||
select {
|
||||
case ask := <-next:
|
||||
if ask.Intent != IntentReassign || ask.ReplicaID != "r2" {
|
||||
t.Fatalf("after the loss: %+v, want Reassign r2 again", ask)
|
||||
}
|
||||
case <-ctx.Done():
|
||||
t.Fatalf("a lost Reassign was never enqueued again; the controller's outcome: %q", ctrl.LastOutcome("v1"))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// A Reassign lost again and again keeps its first DesiredAt across every
|
||||
// re-enqueue, so it still becomes Stuck once the retry window passes from
|
||||
// that first desire: a retry that re-anchored DesiredAt would never report
|
||||
// the volume stuck however long its asks keep failing.
|
||||
func TestARepeatedlyLostReassignKeepsItsDesiredAtAndBecomesStuck(t *testing.T) {
|
||||
const window = 10 * time.Second
|
||||
reader := newFakeBasisReader()
|
||||
line := AuthorityBasis{Assigned: true, ReplicaID: "r1", Epoch: 1, EndpointVersion: 1, DataAddr: "d1", CtrlAddr: "c1"}
|
||||
reader.Set("v1", "r1", line)
|
||||
ctrl := NewTopologyController(TopologyControllerConfig{RetryWindow: window}, reader)
|
||||
clk := newFakeClock(time.Date(2026, 12, 5, 9, 0, 0, 0, time.UTC))
|
||||
ctrl.SetNowForTest(clk.Now)
|
||||
r1 := candidate("r1", "s1", "d1", "c1", 10)
|
||||
r1.Reachable = false
|
||||
snap := ClusterSnapshot{
|
||||
CollectedRevision: 2,
|
||||
Servers: []ServerObservation{
|
||||
{ServerID: "s1", Reachable: true, Eligible: true},
|
||||
{ServerID: "s2", Reachable: true, Eligible: true},
|
||||
{ServerID: "s3", Reachable: true, Eligible: true},
|
||||
},
|
||||
Volumes: []VolumeTopologySnapshot{clusterVolume("v1", line, r1, candidate("r2", "s2", "d2", "c2", 20), candidate("r3", "s3", "d3", "c3", 10))},
|
||||
}
|
||||
first := clk.Now()
|
||||
ended, cancel := context.WithCancel(context.Background())
|
||||
cancel() // the publisher's next call after an apply that published nothing
|
||||
for cycle := 0; cycle < 4; cycle++ {
|
||||
if err := ctrl.SubmitClusterSnapshot(snap); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if cycle > 0 && !strings.HasPrefix(ctrl.LastOutcome("v1"), "enqueued again Reassign r2") {
|
||||
t.Fatalf("cycle %d: outcome %q, want the lost ask enqueued again", cycle, ctrl.LastOutcome("v1"))
|
||||
}
|
||||
if d, ok := ctrl.DesiredFor("v1"); !ok || !d.DesiredAt.Equal(first) {
|
||||
t.Fatalf("cycle %d at +%v: desired %+v (ok=%v), want DesiredAt kept at the first desire %v", cycle, clk.Now().Sub(first), d, ok, first)
|
||||
}
|
||||
if ask := nextAskOrFail(t, ctrl); ask.Intent != IntentReassign || ask.ReplicaID != "r2" {
|
||||
t.Fatalf("cycle %d: took %+v, want Reassign r2", cycle, ask)
|
||||
}
|
||||
_, _ = ctrl.Next(ended) // the apply ended without a publication: the ask is lost
|
||||
clk.Advance(4 * time.Second)
|
||||
}
|
||||
// +16 s since the first desire, past the 10 s window: the latest intake
|
||||
// (+12 s) found the desire unconfirmed past the window.
|
||||
ev, stuck := ctrl.LastConvergenceStuck("v1")
|
||||
if !stuck {
|
||||
t.Fatalf("a Reassign lost on every apply for %v is not reported stuck (window %v)", clk.Now().Sub(first), window)
|
||||
}
|
||||
if !ev.DesiredAt.Equal(first) || ev.Ask.ReplicaID != "r2" {
|
||||
t.Fatalf("stuck evidence %+v, want the first desire (%v) of Reassign r2", ev, first)
|
||||
}
|
||||
}
|
||||
|
||||
// publishOnRead runs publish once, right after the controller's skip+1-th
|
||||
// line read: the publisher applies its ask between the read an intake decides
|
||||
// against and that intake's dedupe.
|
||||
type publishOnRead struct {
|
||||
*fakeBasisReader
|
||||
skip int
|
||||
publish func()
|
||||
}
|
||||
|
||||
func (r *publishOnRead) VolumeAuthorityLine(volumeID string) (AuthorityBasis, bool) {
|
||||
line, ok := r.fakeBasisReader.VolumeAuthorityLine(volumeID)
|
||||
if r.publish != nil {
|
||||
if r.skip > 0 {
|
||||
r.skip--
|
||||
} else {
|
||||
p := r.publish
|
||||
r.publish = nil
|
||||
p()
|
||||
}
|
||||
}
|
||||
return line, ok
|
||||
}
|
||||
|
||||
// An ask the publisher publishes, and then asks past, while an intake is
|
||||
// deciding against the line read before that publication is not lost: the
|
||||
// intake must not enqueue it again, or a planned move would be minted twice.
|
||||
func TestAnAskPublishedDuringTheIntakeIsNotEnqueuedAgain(t *testing.T) {
|
||||
reader := newFakeBasisReader()
|
||||
line := AuthorityBasis{Assigned: true, ReplicaID: "r1", Epoch: 1, EndpointVersion: 1, DataAddr: "d1", CtrlAddr: "c1"}
|
||||
reader.Set("v1", "r1", line)
|
||||
publishing := &publishOnRead{fakeBasisReader: reader}
|
||||
ctrl := NewTopologyController(TopologyControllerConfig{}, publishing)
|
||||
r1 := candidate("r1", "s1", "d1", "c1", 10)
|
||||
r1.Reachable = false
|
||||
snap := ClusterSnapshot{
|
||||
CollectedRevision: 2,
|
||||
Servers: []ServerObservation{
|
||||
{ServerID: "s1", Reachable: true, Eligible: true},
|
||||
{ServerID: "s2", Reachable: true, Eligible: true},
|
||||
{ServerID: "s3", Reachable: true, Eligible: true},
|
||||
},
|
||||
Volumes: []VolumeTopologySnapshot{clusterVolume("v1", line, r1, candidate("r2", "s2", "d2", "c2", 20), candidate("r3", "s3", "d3", "c3", 10))},
|
||||
}
|
||||
if err := ctrl.SubmitClusterSnapshot(snap); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if ask := nextAskOrFail(t, ctrl); ask.Intent != IntentReassign || ask.ReplicaID != "r2" {
|
||||
t.Fatalf("first intake: %+v, want Reassign r2", ask)
|
||||
}
|
||||
ended, cancel := context.WithCancel(context.Background())
|
||||
cancel()
|
||||
publishing.skip = 1 // the intake's load count reads the line first
|
||||
publishing.publish = func() {
|
||||
reader.Set("v1", "r2", AuthorityBasis{Assigned: true, ReplicaID: "r2", Epoch: 2, EndpointVersion: 1, DataAddr: "d2", CtrlAddr: "c2"})
|
||||
_, _ = ctrl.Next(ended) // published: the publisher is back for its next ask
|
||||
}
|
||||
if err := ctrl.SubmitClusterSnapshot(snap); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if out := ctrl.LastOutcome("v1"); strings.HasPrefix(out, "enqueued again") {
|
||||
t.Fatalf("an ask published during the intake was enqueued again: %q", out)
|
||||
}
|
||||
expectNoNext(t, ctrl)
|
||||
}
|
||||
|
||||
// A controller Reassign waits in the queue until the publisher takes it. A
|
||||
// publication that lands meanwhile outside the queue (an operator's failback)
|
||||
// is not overwritten by the ask decided against the older line, whether the
|
||||
// ask is a first one or a lost one enqueued again.
|
||||
func TestAQueuedReassignDoesNotOverwriteALaterPublication(t *testing.T) {
|
||||
for _, lost := range []bool{false, true} {
|
||||
holder := &basisReaderHolder{}
|
||||
ctrl := NewTopologyController(TopologyControllerConfig{}, holder)
|
||||
pub := NewPublisher(ctrl)
|
||||
holder.set(pub)
|
||||
if err := pub.apply(AssignmentAsk{VolumeID: "v1", ReplicaID: "r1", DataAddr: "d1", CtrlAddr: "c1", Intent: IntentBind}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
line, _ := pub.VolumeAuthorityLine("v1")
|
||||
r1 := candidate("r1", "s1", "d1", "c1", 10)
|
||||
r1.Reachable = false
|
||||
snap := ClusterSnapshot{
|
||||
CollectedRevision: 2,
|
||||
Servers: []ServerObservation{
|
||||
{ServerID: "s1", Reachable: true, Eligible: true},
|
||||
{ServerID: "s2", Reachable: true, Eligible: true},
|
||||
{ServerID: "s3", Reachable: true, Eligible: true},
|
||||
},
|
||||
Volumes: []VolumeTopologySnapshot{clusterVolume("v1", line, r1, candidate("r2", "s2", "d2", "c2", 20), candidate("r3", "s3", "d3", "c3", 10))},
|
||||
}
|
||||
if err := ctrl.SubmitClusterSnapshot(snap); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if lost {
|
||||
nextAskOrFail(t, ctrl)
|
||||
ended, cancel := context.WithCancel(context.Background())
|
||||
cancel()
|
||||
_, _ = ctrl.Next(ended) // the apply ended without a publication
|
||||
if err := ctrl.SubmitClusterSnapshot(snap); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if out := ctrl.LastOutcome("v1"); !strings.HasPrefix(out, "enqueued again Reassign r2") {
|
||||
t.Fatalf("outcome %q, want the lost ask enqueued again", out)
|
||||
}
|
||||
}
|
||||
if err := pub.apply(AssignmentAsk{VolumeID: "v1", ReplicaID: "r3", DataAddr: "d3", CtrlAddr: "c3", Intent: IntentReassign,
|
||||
Evidence: adapter.PrimaryEvidence{Kind: adapter.PrimaryKindPromotion, DurableLSN: 10, Basis: adapter.BasisPlanned},
|
||||
ExpectCurrent: &ExpectedLine{ReplicaID: line.ReplicaID, Epoch: line.Epoch}}); err != nil {
|
||||
t.Fatalf("failback: %v", err)
|
||||
}
|
||||
ask := nextAskOrFail(t, ctrl)
|
||||
if ask.Intent != IntentReassign || ask.ReplicaID != "r2" {
|
||||
t.Fatalf("lost=%v: took %+v, want Reassign r2", lost, ask)
|
||||
}
|
||||
if err := pub.apply(ask); !errors.Is(err, ErrExpectedLineMoved) {
|
||||
t.Fatalf("lost=%v: the queued Reassign decided against %s@%d: err=%v, want ErrExpectedLineMoved", lost, line.ReplicaID, line.Epoch, err)
|
||||
}
|
||||
if after, _ := pub.VolumeAuthorityLine("v1"); after.ReplicaID != "r3" || after.Epoch != line.Epoch+1 {
|
||||
t.Fatalf("lost=%v: line %+v, want the failback's r3@%d", lost, after, line.Epoch+1)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,10 @@ type assignmentQueue struct {
|
||||
items map[string]AssignmentAsk
|
||||
order []string
|
||||
wake chan struct{}
|
||||
// taken is the volume of the ask the publisher took last and is still
|
||||
// applying: it is cleared when the publisher asks for its next one (the
|
||||
// publisher applies one ask at a time, between two calls of next).
|
||||
taken string
|
||||
}
|
||||
|
||||
func newAssignmentQueue() *assignmentQueue {
|
||||
@@ -42,7 +46,19 @@ func (q *assignmentQueue) discard(volumeID string) {
|
||||
delete(q.items, volumeID)
|
||||
}
|
||||
|
||||
// pending reports whether volumeID's ask is queued or still being applied.
|
||||
// A desired ask that is neither ended without a publication (lost).
|
||||
func (q *assignmentQueue) pending(volumeID string) bool {
|
||||
q.mu.Lock()
|
||||
defer q.mu.Unlock()
|
||||
_, queued := q.items[volumeID]
|
||||
return queued || q.taken == volumeID
|
||||
}
|
||||
|
||||
func (q *assignmentQueue) next(ctx context.Context) (AssignmentAsk, error) {
|
||||
q.mu.Lock()
|
||||
q.taken = "" // the publisher is done with the ask it took last
|
||||
q.mu.Unlock()
|
||||
for {
|
||||
q.mu.Lock()
|
||||
if len(q.order) > 0 {
|
||||
@@ -54,6 +70,7 @@ func (q *assignmentQueue) next(ctx context.Context) (AssignmentAsk, error) {
|
||||
continue
|
||||
}
|
||||
delete(q.items, vid)
|
||||
q.taken = vid
|
||||
q.mu.Unlock()
|
||||
return ask, nil
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package master
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/seaweedfs/seaweed-block/core/authority"
|
||||
"github.com/seaweedfs/seaweed-block/core/host/bootstrap"
|
||||
)
|
||||
|
||||
// A fenced replace decided by the gate reaches the controller as a failover
|
||||
// whatever the gate's reason. Here the gate replaces a primary only it reads
|
||||
// as unacceptable: its node reads format level 0 on a level-1 cluster (not
|
||||
// placement-eligible), while the primary's own slot flags still read
|
||||
// reachable and ready, and it still reports (no loss is recorded). The
|
||||
// controller judges acceptability by those flags alone, so unless the gate
|
||||
// marks the replaced primary unacceptable in what it submits, the controller
|
||||
// answers "the current primary is acceptable" on every tick and the fenced
|
||||
// decision never publishes.
|
||||
func TestAFencedReplaceOfAPrimaryOnlyTheGateRejectsReachesAReassign(t *testing.T) {
|
||||
ctrl, pub, _ := lossCluster(t, authority.TopologyControllerConfig{})
|
||||
h, buf := lossMaster(t, &fenceProbe{plain: lossPlain, fenced: lossFenced})
|
||||
h.ctrl = ctrl
|
||||
h.boot = &bootstrap.DurableAuthorityBootstrap{Publisher: pub}
|
||||
h.reads = newReadsLevels(time.Hour)
|
||||
h.reads.note("s1", "vol-rf3", "p-r1", 0) // the primary's node reads the old level
|
||||
h.reads.note("s2", "vol-rf3", "p-r2", 1)
|
||||
h.reads.note("s3", "vol-rf3", "p-r3", 1)
|
||||
h.format.v.Store(1)
|
||||
t0 := time.Date(2026, 12, 5, 8, 0, 0, 0, time.UTC)
|
||||
for tick := range 3 {
|
||||
now := t0.Add(time.Duration(tick) * time.Second)
|
||||
snap := silentPrimary() // r1's flags read reachable and ready
|
||||
snap.Volumes[0].Authority, _ = pub.VolumeAuthorityLine("vol-rf3")
|
||||
if snap.Volumes[0].Authority.Epoch != 1 {
|
||||
break // published
|
||||
}
|
||||
heard := map[string]time.Time{"r1": now, "r2": now, "r3": now} // r1 still reports: no loss
|
||||
h.notePrimaryLosses(rx(heard, now), &snap)
|
||||
h.takeGateReplaces()
|
||||
h.applyPromotionEvidenceGate(&snap)
|
||||
if l := gateLine(t, buf.String(), "vol-rf3"); !regexp.MustCompile(`primary_lost=false decision=replace\(fenced_at=2\)$`).MatchString(l) {
|
||||
t.Fatalf("tick %d: gate line %q; want a fenced replace with no loss recorded", tick, l)
|
||||
}
|
||||
outcomes, err := ctrl.SubmitObservedStateOutcomes(snap, authority.SupportabilityReport{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
h.reportReplaces("", nil, outcomes)
|
||||
}
|
||||
if strings.Contains(buf.String(), "controller: no ask: the current primary is acceptable") {
|
||||
t.Fatalf("the controller kept a primary the gate replaced:\n%s", buf.String())
|
||||
}
|
||||
if !regexp.MustCompile(`decision=replace\(fenced_at=2\) controller: enqueued Reassign r[23] \(failover\)`).MatchString(buf.String()) {
|
||||
t.Fatalf("the fenced replace was not enqueued as a failover:\n%s", buf.String())
|
||||
}
|
||||
waitLossLine(t, pub, "vol-rf3", func(l authority.AuthorityBasis) bool { return l.Epoch == 2 && l.ReplicaID != "r1" })
|
||||
}
|
||||
@@ -500,12 +500,15 @@ func (h *Host) applyPromotionEvidenceGate(snap *authority.ClusterSnapshot) (int,
|
||||
slot.PlannedMoveAllowed = false
|
||||
}
|
||||
}
|
||||
// A fenced replacement of a lost primary reaches the controller as
|
||||
// a failover: its slot no longer reads acceptable, so the controller
|
||||
// publishes the fenced target with its fenced evidence (the line is
|
||||
// minted only at the fenced epoch), never keeping the old line nor
|
||||
// A fenced replacement reaches the controller as a failover,
|
||||
// whatever the gate's reason (a recorded loss, or a primary only
|
||||
// the gate reads as unacceptable, such as one on a node below the
|
||||
// cluster's format level): its slot no longer reads acceptable, so
|
||||
// the controller publishes the fenced target with its fenced
|
||||
// evidence (the line is minted only at the fenced epoch), never
|
||||
// keeping the old line by its own acceptability predicate nor
|
||||
// routing the target as a planned rebalance without that epoch.
|
||||
if lost && fencedReplace {
|
||||
if fencedReplace {
|
||||
current := &vol.Slots[currentIdx]
|
||||
current.Reachable, current.ReadyForPrimary = false, false
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ The design is described in three documents, and this one collects their machines
|
||||
**Conventions.** These are the same as in the design documents.
|
||||
|
||||
- Code references name a file and a function, not a line number. Test references name the test function and its file.
|
||||
- A TLA+ entry names a specification in [`docs/spec/`](../spec/README.md) and an invariant or property defined in it. The models check designs at small scale and are mapped to the code by reading (see the [limits](../spec/README.md#limits)).
|
||||
- A TLA+ entry names a specification in [`docs/spec/`](../spec/README.md) and an invariant or property defined in it; an entry naming a model checked outside the repository says so. The models check designs at small scale and are mapped to the code by reading (see the [limits](../spec/README.md#limits)).
|
||||
- Status:
|
||||
- `ACTIVE`: a Go test in this repository asserts the statement.
|
||||
- `STUB`: the code enforces the statement (by reading), but no test asserts it yet. A release note must not claim behaviour backed only by a `STUB` row.
|
||||
@@ -192,7 +192,7 @@ flowchart LR
|
||||
|---|---|---|---|---|
|
||||
| Unbound | Bound (epoch 1, endpoint version 1) | `IntentBind`; no slot of this volume holds a present line (checked per volume, also after a restart); to move to another slot use `IntentReassign` | `core/authority/authority.go` `applyWithWorkspaceMove`, `boundReplicaForVolume`; `core/authority/controller.go` `decideVolume` (binds only a volume with no line) | `INV-AUTH-ONE-PRIMARY-001`, `INV-AUTH-PERSIST-BEFORE-PUBLISH-001` |
|
||||
| Bound | Bound (endpoint version + 1) | `IntentRefreshEndpoint`; same epoch; new addresses, or the same addresses for another primary process (the line's incarnation differs); a no-op when both are unchanged; refused (`ErrExpectedLineMoved`) when the ask names the line it was decided against and the volume's line is no longer that one (replica, epoch, addresses) | `core/authority/authority.go` `applyWithWorkspaceMove`; `core/authority/directive.go` `expectedLineMoved` | `INV-AUTH-PERSIST-BEFORE-PUBLISH-001`, `INV-AUTH-RESTART-REISSUE-001` |
|
||||
| Bound | Reassigned (per-volume maximum epoch + 1) | `IntentReassign`; some earlier publication exists; an enrolled workspace volume changes only through a guarded move | `core/authority/authority.go` `applyWithWorkspaceMove`, `maxPublishedEpochForVolume` | `INV-AUTH-EPOCH-MINT-001`, `INV-AUTH-ONE-PRIMARY-001` |
|
||||
| Bound | Reassigned (per-volume maximum epoch + 1) | `IntentReassign`; some earlier publication exists; an enrolled workspace volume changes only through a guarded move; refused (`ErrExpectedLineMoved`) when the ask names the line it was decided against (the controller's rebalance and failover, an operator's failback) and the volume's line is no longer that one, compared by replica and epoch, and by addresses only when the ask names them (the controller's moves do; an operator's failback names replica and epoch only, so an endpoint move to other addresses does not refuse it): a queued controller move never overwrites a reassign or an endpoint move to other addresses that landed after its decision; a same-address endpoint reissue (new endpoint version or incarnation, same addresses) still matches, and the move's epoch bump fences it | `core/authority/authority.go` `applyWithWorkspaceMove`, `maxPublishedEpochForVolume`; `core/authority/directive.go` `expectedLineMoved`; `core/authority/controller.go` `decideVolume` | `INV-AUTH-EPOCH-MINT-001`, `INV-AUTH-ONE-PRIMARY-001` |
|
||||
| any | (store write first) | with an authority store configured, every transition is written to the store before memory changes or subscribers are notified; a failed write publishes nothing; a write whose outcome is unknown (the directory fsync after the rename failed) fail-stops blockmaster, so no caller is told it failed | `core/authority/authority.go` `applyWithWorkspaceMove` | `INV-AUTH-PERSIST-BEFORE-PUBLISH-001` |
|
||||
| any (workspace) | Uncertain | a failed workspace authority write, including a lease extension; later changes for that volume, and renewals that would issue a new or extended grant, are refused until restart (a Revoking lease still gets its bounded drain reply) | `core/authority/authority.go` `applyWithWorkspaceMove`; `core/authority/workspace.go` `persistWorkspaceLocked`; `core/authority/workspace_lease_view.go` `RenewWorkspaceLease`, `extendWorkspaceLease` | `INV-AUTH-UNCERTAIN-001` |
|
||||
| Uncertain | Uncertain (move answer) | failed move replies classify uncertainty after local locks release, before any admission refusal; request-context cancellation/deadline remain typed; known successful replay is unchanged | `core/authority/workspace.go` `WorkspaceMoveOutcomeError`; `core/host/master/workspace_service.go` `MoveWorkspace` | `INV-AUTH-UNCERTAIN-001` |
|
||||
@@ -201,6 +201,34 @@ flowchart LR
|
||||
| any authority line, stores still awaited (stage 1) | DeleteReserved without the holder's acknowledgement | the master's record is marked first, durably and in the lock that ends the store wait; the mark freezes the record in stage 1 (the wait never ends after it, so the primary, whose assignment keeps awaiting the stores, never serves); the reservation then skips the live-lease refusal. Deleting HEAD waits out the lease as above. Past stage 1, also while the end of creation is unrecorded (the volume may be serving), the live-lease refusal stays | `core/host/master/volume_delete_authority.go` `Reserve`; `core/host/master/store_attestation.go` `markDeleteWithoutAck`, `awaited`; `core/authority/workspace_delete_reservation.go` `ReserveNeverCreatedWorkspaceDeletion` | `INV-WS-DELETE-WITHOUT-ACK-001` |
|
||||
| DeleteReserved, removed from the desired spec | Retired metadata (reservation permanent) | no live lease, then a fresh bounded HEAD read proves deleted or absent; unread/live/deleting keeps the records. Remove authority durably, then placement and bindings, then the volume record; a crash retries the remaining removals. A startup lease skip schedules one more pass after the latest observed barrier, also without the product loop; full passes log skips. The store and its resweep inputs are untouched | `core/host/master/spec_retirement.go` `ReconcileDeletedSpecVolumes`, `startPostFloorRetirement`; `core/authority/workspace_retirement.go` `RetireDeletedWorkspace` | `INV-SPEC-DELETE-RETIRE-001`, `INV-SPEC-DELETE-RETRY-001` |
|
||||
|
||||
**Controller ask, per volume (between the promotion gate and the publisher).**
|
||||
|
||||
The topology controller turns a supported snapshot into at most one ask per volume. The publisher drains the controller's queue one ask at a time (its `Run` loop, between two calls of `next`). A fenced replace decided by the supported gate is submitted with the replaced primary's slot unacceptable, whatever the gate's reason, so the controller's own acceptability predicate never keeps that primary. An ask is pending while it is queued or held by the publisher; an identical ask is deduplicated only while it is pending.
|
||||
|
||||
```mermaid
|
||||
stateDiagram-v2
|
||||
[*] --> Queued: intake decides an ask (desired, DesiredAt set)
|
||||
Queued --> Held: publisher takes it (next)
|
||||
Held --> Published: apply publishes (line moves)
|
||||
Held --> Lost: apply ends without a publication (publisher calls next again)
|
||||
Lost --> Queued: next intake decides the identical ask (DesiredAt kept)
|
||||
Queued --> Queued: identical ask decided (already desired)
|
||||
Held --> Held: identical ask decided (already desired)
|
||||
Published --> [*]: snapshot observes the new line (desired confirmed)
|
||||
```
|
||||
|
||||
| From | To | Event and guard | Enforced in | Protects |
|
||||
|---|---|---|---|---|
|
||||
| no desired ask | Queued | an intake of a supported snapshot decides an ask; the desired entry records DesiredAt. A fenced replace (with or without a recorded loss) reaches the controller with the replaced primary's slot unreachable and not ready, so its intake decides the failover to the fenced target | `core/authority/controller.go` `processSupportedVolumeLocked`, `decideVolume`; `core/host/master/product_loop.go` `applyPromotionEvidenceGate` | `INV-PROMOTE-REPLACE-HANDOFF-001`, `INV-PROMOTE-REPLACE-HANDOFF-002` |
|
||||
| Queued | Held | the publisher takes the ask; the queue records the volume it holds | `core/authority/queue.go` `next` | `INV-AUTH-DESIRED-RETRY-001` |
|
||||
| Queued or Held | (no change) | an intake decides the identical ask while it is pending: deduplicated (`already desired since T`), nothing queued twice | `core/authority/controller.go` `processSupportedVolumeLocked`; `core/authority/queue.go` `pending` | `INV-AUTH-DESIRED-RETRY-001` |
|
||||
| Held | Published | the apply publishes the line (epoch minted by the publisher) | `core/authority/authority.go` `applyWithWorkspaceMove` | `INV-AUTH-EPOCH-MINT-001` |
|
||||
| Held | Lost | the apply ends without a publication (refused, or dropped); the publisher asks for its next ask, which clears the held volume | `core/authority/queue.go` `next` | `INV-AUTH-DESIRED-RETRY-001` |
|
||||
| Lost | Queued (DesiredAt kept) | an intake decides the identical ask while the line, re-read after the pending check, is still the one it decided against (an ask published during the intake is not lost): enqueued again (`enqueued again ...`), the desired entry and its DesiredAt unchanged | `core/authority/controller.go` `processSupportedVolumeLocked` | `INV-AUTH-DESIRED-RETRY-001`, `INV-AUTH-DESIRED-RETRY-002` |
|
||||
| any desired (unconfirmed) | Stuck evidence | DesiredAt + retry window passed without the line observed; a repeatedly lost ask reaches it from its first desire | `core/authority/convergence.go` `evaluateStuckLocked` | `INV-AUTH-DESIRED-RETRY-002` |
|
||||
|
||||
Model: PromoLive r6, checked outside the repository (it is not in `docs/spec/`), models this handoff with the intake split as the code does it (read the line and decide; after the publisher may have run, enqueue only if the ask is not pending and the line is still the one read). `RoundProgress` and `QueuedMatchesLine` hold; the mutants `dedupe_keeps_lost`, `predicate_split` and `nonatomic_submit` are each caught. The retry window and the Stuck evidence are not modelled; their test is the evidence.
|
||||
|
||||
**Volume creation phase, in blockmaster's store record** (`core/host/master/store_attestation.go`, decided by `inCreationPhase` in `core/host/master/product_loop.go`). Every replacement entry (both promotion gates, the operator's failover and planned move, the rebalance) acts only on Established.
|
||||
|
||||
```mermaid
|
||||
@@ -1010,6 +1038,8 @@ Notes:
|
||||
| `INV-CLI-TYPED-REFUSAL-001` | The chunk CLI reports a restore the master refused for a foreign source as `restore_source_not_own` (from the master's typed reason, never its text) and a volume the master does not know as `volume_not_found`. | M2 none → created (restore refusal); CLI volume resolve | `core/host/master/services.go` `CreateVolume`; `core/rpc/lifecycleclient/reason.go` `WithReason`, `Reason`; `cmd/sw-block/chunk_b.go` `chunkRestore`, `run` | `TestOpsChunkTypedRefusalCodes` (`cmd/sw-block/chunk_typed_codes_test.go`), `TestReasonRoundTrip` (`core/rpc/lifecycleclient/reason_test.go`), `TestARealCatalogRestoreOfARestoreTargetLeavesNothing` (`core/host/master/restore_refusal_catalog_test.go`) | — (reporting only; the refusal is `INV-CREATE-ONE-IDENTITY-001`'s). Limits: other FailedPrecondition refusals stay the generic `not_admitted` | ACTIVE |
|
||||
| `INV-CLI-RESTORE-VERB-001` | `volume restore --abort` changes nothing unless the master records this command's source, snapshot and request id for the target and this host's settings name exactly it (volume, master, `--layout-id` alone in the extra arguments); a re-run counts only this replica's published line as placed. | client (no state machine): the CLI side of M2 restore create, placement and delete | `cmd/sw-block/volume_backup.go` `volumeRestoreAbort`, `volumeRestore`, `restorePlaced`; `core/host/master/services.go` `lifecycleVolumeResponse` | `TestVolumeRestoreAbortRefusesAForeignTarget`, `TestVolumeRestoreAbortRefusesAnotherLocalInstallation`, `TestVolumeRestoreAbortInterruptedAtEveryStepCompletes`, `TestVolumeRestoreCrashTableBothWays`, `TestVolumeRestorePublicationDuringThePlacement`, `TestVolumeRestorePlacementOfAnotherLineRefuses`, `TestVolumeRestoreCreatesPlacesAndStarts`, `TestVolumeBackupTakesOneSnapshotAndRerunReplays`, `TestVolumeBackupRefusals`, `TestVolumeBackupIncompleteAnswerIsUnknown` (`cmd/sw-block/volume_backup_test.go`), `TestGetVolumeAnswersTheRecordedRestoreTuple` (`core/host/master/volume_restore_tuple_test.go`) | — (the command's model is checked outside the repository; its trace is on the pull request) | 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` | `TestLayoutGrantedEpochIssuerSites`, `TestLayoutEpochEnumerationRejectsANewIssuer`, `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`); also in `core/authority/layout_granted_epoch_guard_test.go` | `ControlPlane` `UniqueEpoch` | ACTIVE |
|
||||
| `INV-AUTH-DESIRED-RETRY-001` | The controller deduplicates a desired ask only while it is pending: queued, or taken by the publisher and still being applied. An identical ask that ended without a publication, the line still the one it was decided against, is enqueued again on the next intake. | M2 controller ask: Queued or Held (deduplicated); Held → Lost; Lost → Queued | `core/authority/controller.go` `processSupportedVolumeLocked`; `core/authority/queue.go` `pending`, `next` | `TestALostReassignIsEnqueuedAgainOnTheNextIntake`, `TestAnAskPublishedDuringTheIntakeIsNotEnqueuedAgain` (`core/authority/controller_lost_ask_test.go`) | PromoLive r6 (outside the repository) `QueuedMatchesLine`, `RoundProgress` (mutants `dedupe_keeps_lost`, `nonatomic_submit`) | ACTIVE |
|
||||
| `INV-AUTH-DESIRED-RETRY-002` | An ask enqueued again keeps its first DesiredAt, so an ask lost on every apply still becomes Stuck once the retry window passes from that first desire. | M2 controller ask: Lost → Queued (DesiredAt kept); Stuck evidence | `core/authority/controller.go` `processSupportedVolumeLocked`; `core/authority/convergence.go` `evaluateStuckLocked` | `TestARepeatedlyLostReassignKeepsItsDesiredAtAndBecomesStuck` (`core/authority/controller_lost_ask_test.go`) | PromoLive r6 (outside the repository) `RoundProgress` (the retry; the retry window and Stuck are not modelled: the test is the evidence) | ACTIVE |
|
||||
| `INV-AUTH-RESTART-REISSUE-001` | A line records the primary process it was issued for (durable); a current primary reporting another process is re-issued its line at a new endpoint version, and a primary adopts no line issued for another process, so a restarted process never reuses the dead one's sessions. | M2 authority (RefreshEndpoint); M3 primary adoption | `core/authority/authority.go` `applyWithWorkspaceMove` (records the ask's or the source's incarnation); `core/authority/controller.go` `endpointStale`, `sameAsk`, `refreshAsk` (conditional on the line it read); `core/host/master/product_loop.go` `RunLifecycleProductTick`, `restartedHolderRefresh` (the product loop's direct path for a workspace-bound RF1 volume, conditional on the line it read); `core/authority/workspace.go` `persistWorkspaceTimedLocked`; `core/authority/observation_store.go` `SlotFactAt`; `core/host/master/host.go` (the source); `core/host/volume/host.go` `applyFact` | `TestPublisher_RestartedPrimaryGetsANewEndpointVersion`, `TestPublisher_AskWithoutAProcessIsIssuedForTheReportedOne`, `TestTopologyController_RestartedPrimaryAtTheSameAddressIsReissued`, `TestTopologyController_QueuedRefreshIsReplacedForANewerProcess`, `TestTopologyController_UnnamedLineIsReissuedOnceForTheReportingProcess`, `TestWorkspaceLeaseWriteKeepsTheLinesIncarnationAcrossReload`, `TestObservationStore_SlotFactAtIsTheProcessAtThoseEndpoints` (`core/authority/restart_endpoint_version_test.go`); `TestLinesNameTheirPrimarysProcess`, `TestLineForTheTargetsEndpointsNamesTheTargetsProcess` (`core/host/master/line_incarnation_test.go`); `TestRF1RuntimeVolumeIsReissuedToARestartedHolder`, `TestRF1RuntimeLineNamingNoProcessIsReissued`, `TestRF1RefreshDecidedBeforeACrossHostMoveIsNotApplied` (`core/host/master/rf1_restart_reissue_test.go`); `TestRefreshIsConditionalOnTheLineItWasDecidedAgainst`, `TestControllerRefreshNamesTheLineItWasDecidedAgainst` (`core/authority/refresh_expected_line_test.go`); `TestHost_ApplyFact_LineIssuedForAnotherProcessIsNotAdopted`, `TestHost_ApplyFact_UnnamedLineIsNotAdoptedWhereLinesNameTheirProcess` (`core/host/volume/line_incarnation_test.go`); `TestHostConfigAdoptsOnlyLinesNamingThisProcess` (`cmd/blockvolume/lines_name_their_process_test.go`); `TestRestartedPrimaryAtTheSameEpochIsAdmitted` (`core/replication/primary_restart_session_test.go`) | — | 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, a failed write does not publish it, and an unknown outcome (directory fsync after the rename failed) fail-stops blockmaster: see M2 any → (store write first). | M2 any → (store write first) | `core/authority/authority.go` `applyWithWorkspaceMove`; `core/authority/authority_store_file.go` `Put` (`failStopDurabilityUnknown` after a failed directory open or fsync behind the rename, every record; a close error after a good fsync is reported written; Windows keeps its previous behaviour) | `TestDurableAuthority_PutFailureRollsBackInMemoryState` (`core/authority/authority_restart_test.go`); `TestPutFailStopsWhenTheDirectoryFsyncFailsAfterRename`, `TestPutReportsWrittenWhenOnlyTheDirectoryCloseFails` (`core/authority/authority_store_dir_fsync_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 |
|
||||
@@ -1382,6 +1412,8 @@ Notes:
|
||||
| `INV-PROMOTE-ACK-PROFILE-MATCH-001` | The automatic path holds a lost primary's volume, before any fencing round and showing `ack_profile_mismatch`, when a probe answer names no ack profile or another than blockmaster's `--launcher-replication-ack`; blockmaster refuses to start with an unknown one. | M3 Supporting → promotion candidate (both gates) | `core/host/master/probe_round.go` `profileMismatch`; `core/host/master/product_loop.go` `automaticFailoverHold` (plain round), `fencedDecision` (fencing round); `core/host/volume/probe_round.go` `probeAnswer`; `cmd/blockvolume/main.go` `hostConfig`; `cmd/blockmaster/main.go` `parseFlags` | `TestTheAutomaticPathHoldsOnAnAckProfileMismatch`, `TestProbeRound_ReportsAnAckProfileMismatch`, `TestTheFencingRoundsAckProfileIsCheckedToo` (`core/host/master/ack_profile_mismatch_test.go`); `TestProbeAnswerNamesTheVolumesAckProfile` (`core/host/volume/probe_ack_profile_test.go`); `TestHostConfigAnswersTheVolumesOwnAckProfile` (`cmd/blockvolume/probe_ack_profile_test.go`); `TestBlockmasterRefusesAnUnknownLauncherReplicationAck` (`cmd/blockmaster/launcher_replication_ack_flag_test.go`) | — | ACTIVE |
|
||||
| `INV-PROMOTE-DECISION-REPORTED-001` | Every replace decision of the supported promotion gate is logged once after its tick: with the controller's outcome from the same submission (read under its lock, so a later intake cannot change it), as not submitted and why, or as a failed submit. Diagnostics only: no decision changes. | M3 Supporting → promotion candidate (supported gate → controller → publisher) | `core/host/master/product_loop.go` `submitPlacementSnapshots`, `noteGateReplace`, `reportReplaces`; `core/authority/controller.go` `SubmitObservedStateOutcomes`, `LastOutcome` | `TestAReplaceDecisionLogsWhatTheControllerDidWithIt` (cases: enqueued, already desired, no ask with why, not submitted, an intake after the submission does not change its report, a submission that did not carry the volume, one report per decision), `TestAProductTickReplaceLogsTheControllerOutcomeAndThePublication`, `TestABindingReadFailureAfterTheProbeReportsTheDecisionNotSubmitted` (`core/host/master/gate_controller_outcome_test.go`, `core/host/master/gate_binding_read_failure_test.go`) | — (diagnostics; no published specification models the log) | ACTIVE |
|
||||
| `INV-AUTHORITY-PUBLICATION-LOGGED-001` | Every authority publication is logged on the master's log with its volume, replica, epoch, endpoint version and intent, also when no event sink is set. Diagnostics only: no decision changes. | M3 controller → publisher (publication observer) | `core/host/master/product_loop.go` `recordAuthorityPublishedEvent` | `TestAPublicationIsLogged`, `TestAProductTickReplaceLogsTheControllerOutcomeAndThePublication` (`core/host/master/gate_controller_outcome_test.go`) | — (diagnostics; no published specification models the log) | ACTIVE |
|
||||
| `INV-PROMOTE-REPLACE-HANDOFF-001` | A fenced replace decided by the supported promotion gate, whatever its reason (a recorded loss, or a primary only the gate reads as unacceptable, such as one on a node below the cluster's format level), submits the replaced primary's slot as unreachable and not ready. | M2 controller ask: no desired ask → Queued (failover) | `core/host/master/product_loop.go` `applyPromotionEvidenceGate` | `TestAFencedReplaceOfAPrimaryOnlyTheGateRejectsReachesAReassign` (`core/host/master/gate_controller_replace_test.go`) | PromoLive r6 (outside the repository) `RoundProgress` (mutant `predicate_split`) | ACTIVE |
|
||||
| `INV-PROMOTE-REPLACE-HANDOFF-002` | The controller never keeps a primary the gate replaced by its own acceptability predicate: it publishes the fenced target with its fenced evidence, the line minted only at the fenced epoch. | M2 controller ask: no desired ask → Queued (failover); M3 Primary → another replica Primary at e+1 | `core/authority/controller.go` `decideVolume` | `TestAFencedReplaceOfAPrimaryOnlyTheGateRejectsReachesAReassign` (`core/host/master/gate_controller_replace_test.go`); `TestALostPrimarysFencedReplacementIsPublished` (`core/host/master/primary_loss_publish_test.go`) | PromoLive r6 (outside the repository) `RoundProgress` (mutant `predicate_split`) | ACTIVE |
|
||||
| `INV-PRIMARY-ACK-PROFILE-001` | A primary of a replicated line serves only when its own `--replication-ack` is the profile its assignment names (blockmaster's); otherwise its frontend is not Healthy and status names both profiles. So a lost primary, which does not answer, acknowledged under the master's profile. | M1 Primary → Serving (replicated line) | `core/host/master/services.go` `assignmentFact` (`ack_profile`); `core/host/volume/workspace_startup.go` `noteAckProfile`; `core/host/volume/projection_bridge.go` `projectionWithSupersede`; `core/host/volume/status_server.go` | `TestPrimaryOfAReplicatedLineServesOnlyUnderTheMastersAckProfile` (`core/host/volume/ack_profile_refusal_test.go`); `TestAssignmentNamesTheMastersAckProfile` (`core/host/master/ack_profile_mismatch_test.go`) | — | ACTIVE |
|
||||
| `INV-CSI-CONSUMES-AUTHORITY-001` | CSI never imports authority code or builds assignment facts; it takes the publish target from blockmaster and refreshes it before a stage, and blockmaster mints the IDs of the events CSI reports. | M2 (read side) | `core/csi/master_backend.go` `LookupPublishTarget`; `core/csi/node.go` `refreshPublishContext`; `core/host/master/observation_service.go` `ReportClusterEvent` | `TestG15a_CSI_DoesNotImportAuthorityOrConstructAssignmentFacts` (`core/csi/boundary_guard_test.go`); `TestG15e_CSIReattachUsesFreshPublishTargetAfterUnstage` (`core/csi/node_test.go`); `TestObservationService_ReportClusterEventAppearsInVolumeTimeline` (`core/host/master/observation_service_test.go`) | — | ACTIVE |
|
||||
| `INV-K8S-NONLOOPBACK-001` | Generated multi-node Helm values enable external iSCSI, external status and loopback rejection; with rejection enabled CSI never publishes a loopback target and fails closed when only loopback targets exist. | M2 (read side) | `cmd/sw-block/main.go` `runOpsGenerateHelmValues`; `core/csi/master_backend.go` `rejectFrontendAddr` | `TestOpsGenerateHelmValuesMultiNodeExternalISCSI` (`cmd/sw-block/main_test.go`); `TestNodeLoss_ControlStatusLookup_RejectsLoopbackPublishTargetsWhenEnabled`, `TestNodeLoss_ControlStatusLookup_FailClosedWhenOnlyLoopbackTargets` (`core/csi/master_backend_test.go`) | — | ACTIVE |
|
||||
|
||||
@@ -33,7 +33,8 @@ writing guest:
|
||||
`sw-block ops volumes --master-api <addr> -o json`, and if the primary moved, repeat the failover against it. A
|
||||
read shows the line at that moment only: blockmaster applies the queued rebalance when its assignment queue reaches
|
||||
it, not at a fixed time, so the primary can still move after any read, and the guest is then started again on the
|
||||
new primary (item 4).
|
||||
new primary (item 4). Fixed in v1.1.2: blockmaster refuses a queued rebalance or failover when the volume's line
|
||||
moved after it was decided.
|
||||
|
||||
**Planned for a later release.** Supported replicated volumes are planned for a later release; v1.1.x keeps every replicated
|
||||
configuration a preview. Replicated volumes are a preview: a primary cut off from the block master is not stopped
|
||||
|
||||
@@ -57,7 +57,7 @@ v1.1.1 is a fix release of the v1.1 line. None of its changes alters a stored fo
|
||||
- Affects replicated volumes (preview) whose acknowledgement profile allows a planned move: `sync-all`, or `sync-quorum` with two replicas.
|
||||
- blockmaster may decide an automatic rebalance, which moves the primary to a less loaded server, just before an operator's `sw-block ops failover`. If that rebalance is applied after the failover, it moves the primary again, away from the replica the operator chose.
|
||||
- No acknowledged write is lost: under these profiles every replica holds every acknowledged write.
|
||||
- What to do: after `sw-block ops failover`, read the volume's line with `sw-block ops volumes --master-api <addr> -o json`; if `primary_replica` moved again, repeat the failover with `--expect-current <primary_replica>@<epoch>`. No read confirms that the primary stays: blockmaster applies the queued rebalance when its assignment queue reaches it, not at a fixed time, so it can still move the primary after any read, and the guest is then started again on the new primary. A fix is planned for a later v1.1.x release.
|
||||
- What to do: after `sw-block ops failover`, read the volume's line with `sw-block ops volumes --master-api <addr> -o json`; if `primary_replica` moved again, repeat the failover with `--expect-current <primary_replica>@<epoch>`. No read confirms that the primary stays: blockmaster applies the queued rebalance when its assignment queue reaches it, not at a fixed time, so it can still move the primary after any read, and the guest is then started again on the new primary. Fixed in v1.1.2: blockmaster refuses a queued rebalance or failover when the volume's line moved after it was decided, so one decided before an operator's failover is no longer applied after it. A rebalance decided after the failover can still move the primary, as any rebalance can.
|
||||
|
||||
## Known issue: resuming an interrupted snapshot delete can stop the volume's snapshot deletes and cleaning
|
||||
|
||||
|
||||
@@ -2,6 +2,13 @@
|
||||
|
||||
v1.1.2 is not yet released.
|
||||
|
||||
## Fixed
|
||||
|
||||
- **Replicated volumes (preview): a queued rebalance no longer undoes an operator failover.** blockmaster's automatic
|
||||
rebalance and failover name the volume's line they were decided against, and blockmaster refuses one when that line
|
||||
moved since (another replica or epoch, or other addresses). A rebalance decided just before `sw-block ops failover`
|
||||
is no longer applied after it. This was a v1.1.1 known issue.
|
||||
|
||||
## Known issue: blockmaster restart can stall on a busy filesystem
|
||||
|
||||
- **Trigger:** blockmaster's state directory or its ancestors share a filesystem with heavy writes, such as the holders' local data.
|
||||
|
||||
@@ -487,8 +487,8 @@ func (f *Filer) rebuildRemoteDeletionTombstones(ctx context.Context, mounts []ut
|
||||
ctx = context.WithValue(ctx, lazyFetchContextKey{}, true)
|
||||
startTsNs := f.remoteDeletionRebuildStartTsNs(ctx, mounts)
|
||||
openGate := func() {
|
||||
f.remoteTombstonesDone.Store(nil)
|
||||
close(done)
|
||||
f.remoteTombstonesDone.Store(nil)
|
||||
}
|
||||
// Deletes made after startup are recorded through the live delete and
|
||||
// event paths, so replay can only be missing deletes committed before
|
||||
|
||||
Reference in new issue
Block a user