mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-06 02:57:37 +01:00
Merge pull request #710 from seaweedfs/fix/refused-restore-no-record
fix(master): a refused restore leaves no target record; a deleted name is not told to retry
This commit is contained in:
commit
a02bc5d2f5
6 files changed
+617
-6
No files matched your search
@@ -0,0 +1,404 @@
|
||||
package master
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"github.com/seaweedfs/seaweed-block/core/frontend/chunkstore"
|
||||
"github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/filerpb"
|
||||
"github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout"
|
||||
"github.com/seaweedfs/seaweed-block/core/lifecycle"
|
||||
control "github.com/seaweedfs/seaweed-block/core/rpc/control"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// catalogBlobs is an in-memory needle store for the real catalog.
|
||||
type catalogBlobs struct {
|
||||
mu sync.Mutex
|
||||
m map[string][]byte
|
||||
}
|
||||
|
||||
func (b *catalogBlobs) Put(_ context.Context, data []byte) (string, error) {
|
||||
b.mu.Lock()
|
||||
defer b.mu.Unlock()
|
||||
id := fmt.Sprint(len(b.m) + 1)
|
||||
b.m[id] = append([]byte(nil), data...)
|
||||
return id, nil
|
||||
}
|
||||
|
||||
func (b *catalogBlobs) Get(_ context.Context, fid string) ([]byte, error) {
|
||||
b.mu.Lock()
|
||||
defer b.mu.Unlock()
|
||||
d, ok := b.m[fid]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("%w: %s", chunkstore.ErrBlobNotFound, fid)
|
||||
}
|
||||
return append([]byte(nil), d...), nil
|
||||
}
|
||||
|
||||
// countingFiler counts the filer writes and can fail the first VOLUME
|
||||
// create in a directory whose name starts with failVolumeIn.
|
||||
type countingFiler struct {
|
||||
chunkstore.Filer
|
||||
mu sync.Mutex
|
||||
writes int
|
||||
failVolumeIn string
|
||||
}
|
||||
|
||||
func (f *countingFiler) count() int {
|
||||
f.mu.Lock()
|
||||
defer f.mu.Unlock()
|
||||
return f.writes
|
||||
}
|
||||
|
||||
func (f *countingFiler) CreateEntry(ctx context.Context, dir string, e *filerpb.Entry, excl bool) error {
|
||||
f.mu.Lock()
|
||||
f.writes++
|
||||
fail := f.failVolumeIn != "" && e.Name == "VOLUME" && strings.Contains(dir, "/"+f.failVolumeIn)
|
||||
if fail {
|
||||
f.failVolumeIn = ""
|
||||
}
|
||||
f.mu.Unlock()
|
||||
if fail {
|
||||
return errors.New("fixture: lost the target's VOLUME create")
|
||||
}
|
||||
return f.Filer.CreateEntry(ctx, dir, e, excl)
|
||||
}
|
||||
|
||||
func (f *countingFiler) UpdateEntry(ctx context.Context, dir string, e *filerpb.Entry, expected map[string][]byte) error {
|
||||
f.mu.Lock()
|
||||
f.writes++
|
||||
f.mu.Unlock()
|
||||
return f.Filer.UpdateEntry(ctx, dir, e, expected)
|
||||
}
|
||||
|
||||
func catalogRef(t *testing.T, spec lifecycle.VolumeSpec) chunkstore.VolumeRef {
|
||||
t.Helper()
|
||||
id, err := layout.ParseVolumeID(spec.LayoutID)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
return chunkstore.VolumeRef{Name: spec.VolumeID, ID: id}
|
||||
}
|
||||
|
||||
// catalogMaster is a master whose layout hooks are the real catalog's, as
|
||||
// blockmaster wires them (cmd/blockmaster/layout_create.go).
|
||||
func catalogMaster(t *testing.T) (*Host, *services, *chunkstore.BCatalog, *countingFiler) {
|
||||
t.Helper()
|
||||
filer := &countingFiler{Filer: chunkstore.NewMemFiler()}
|
||||
cat, err := chunkstore.NewBCatalog(filer, &catalogBlobs{m: map[string][]byte{}}, "/blocks")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
h := newTestMaster(t, t.TempDir())
|
||||
t.Cleanup(func() { closeTestMaster(t, h) })
|
||||
ref := func(spec lifecycle.VolumeSpec) (chunkstore.VolumeRef, error) {
|
||||
id, err := layout.ParseVolumeID(spec.LayoutID)
|
||||
return chunkstore.VolumeRef{Name: spec.VolumeID, ID: id}, err
|
||||
}
|
||||
h.cfg.LayoutCreateVolume = func(ctx context.Context, spec lifecycle.VolumeSpec) error {
|
||||
r, err := ref(spec)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = cat.CreateVolume(ctx, r, layout.Geometry{SizeBytes: spec.SizeBytes, BlockSize: spec.BlockSize, ChunkBytes: spec.ChunkBytes})
|
||||
return err
|
||||
}
|
||||
h.cfg.LayoutReadVolume = func(ctx context.Context, spec lifecycle.VolumeSpec) (layout.Volume, error) {
|
||||
r, err := ref(spec)
|
||||
if err != nil {
|
||||
return layout.Volume{}, err
|
||||
}
|
||||
return cat.ReadVolume(ctx, r)
|
||||
}
|
||||
h.cfg.LayoutReadHead = func(ctx context.Context, spec lifecycle.VolumeSpec) (layout.Head, error) {
|
||||
r, err := ref(spec)
|
||||
if err != nil {
|
||||
return layout.Head{}, err
|
||||
}
|
||||
hd, found, err := cat.ReadHead(ctx, r)
|
||||
if err == nil && !found {
|
||||
err = layout.ErrHeadAbsent
|
||||
}
|
||||
return hd, err
|
||||
}
|
||||
h.cfg.LayoutCreateTarget = func(ctx context.Context, source, target lifecycle.VolumeSpec, snapshot string) error {
|
||||
s, err := ref(source)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
tg, err := ref(target)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = cat.Restore(ctx, s, snapshot, tg)
|
||||
return err
|
||||
}
|
||||
return h, newServices(h), cat, filer
|
||||
}
|
||||
|
||||
type catalogLease struct{}
|
||||
|
||||
func (catalogLease) OldLeaseEnded(context.Context, uint64) error { return nil }
|
||||
|
||||
// catalogSnapshot makes the volume hold a snapshot named name through the
|
||||
// kernel's steps (Start, Begin, objects, Commit). With fromCurrent it
|
||||
// snapshots the chunk its current root names at index 1 (a restore
|
||||
// target's: the source's chunk); otherwise it writes one own chunk.
|
||||
func catalogSnapshot(t *testing.T, cat *chunkstore.BCatalog, rec lifecycle.VolumeRecord, name string, fromCurrent bool) {
|
||||
t.Helper()
|
||||
ctx := context.Background()
|
||||
v := catalogRef(t, rec.Spec)
|
||||
st, err := cat.Store(v)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
g := layout.Geometry{SizeBytes: rec.Spec.SizeBytes, BlockSize: rec.Spec.BlockSize, ChunkBytes: rec.Spec.ChunkBytes}
|
||||
me := layout.HolderID{Epoch: 1, Holder: "s/" + v.Name, ClaimID: "k-" + v.Name}
|
||||
if _, err := layout.Start(ctx, st, catalogLease{}, layout.HolderID{Epoch: 1, Holder: me.Holder}, layout.LocalRoot{Geometry: g, ClaimID: me.ClaimID, Fresh: true, CanStartFrom: func(layout.Head) error { return nil }}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
h, _, err := st.ReadHead(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := layout.RunBegin(ctx, st, me, "s-"+name); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var prev, next map[uint64]layout.Ref
|
||||
if fromCurrent {
|
||||
img, err := layout.NewReader("/blocks", v.Dir(), st.Fetch)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
im, err := img.Open(ctx, *h.Current)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
r, _, err := im.Resolve(ctx, 1)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
prev = map[uint64]layout.Ref{1: r}
|
||||
next = prev
|
||||
} else {
|
||||
data := bytes.Repeat([]byte{0x5a}, int(g.BlockSize))
|
||||
ch := layout.NameChunk(1, data)
|
||||
if err := layout.EnsureObject(ctx, st, ch.Path(), data, "s-"+name); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
next = map[uint64]layout.Ref{1: {Owner: v.Name, OwnerID: v.ID, Chunk: ch}}
|
||||
}
|
||||
root, segs, err := layout.Build(next)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for n, b := range segs {
|
||||
if err := layout.EnsureObject(ctx, st, n.Path(), b, "s-"+name); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
rn, rb, err := layout.NameRoot(root)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := layout.EnsureObject(ctx, st, rn.Path(), rb, "s-"+name); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := layout.RunCommit(ctx, st, st, v.Name, me, layout.CommitRequest{Session: "s-" + name, Prev: prev, Next: next, Position: 1, Snapshot: name}); err != nil {
|
||||
t.Fatalf("snapshot %s of %s: %v", name, v.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
func catalogGen(t *testing.T, cat *chunkstore.BCatalog, rec lifecycle.VolumeRecord) layout.Head {
|
||||
t.Helper()
|
||||
h, found, err := cat.ReadHead(context.Background(), catalogRef(t, rec.Spec))
|
||||
if err != nil || !found {
|
||||
t.Fatalf("HEAD of %s: found=%t %v", rec.Spec.VolumeID, found, err)
|
||||
}
|
||||
return h
|
||||
}
|
||||
|
||||
// catalogSourceAndTarget: a source "src" with snapshot "daily", restored
|
||||
// to "t", which takes a snapshot "copy" of the source's chunk.
|
||||
func catalogSourceAndTarget(t *testing.T) (*Host, *services, *chunkstore.BCatalog, *countingFiler, lifecycle.VolumeRecord, lifecycle.VolumeRecord) {
|
||||
t.Helper()
|
||||
h, svc, cat, filer := catalogMaster(t)
|
||||
ctx := context.Background()
|
||||
if _, err := svc.CreateVolume(ctx, &control.CreateVolumeRequest{VolumeId: "src", SizeBytes: 64 * 4096, ReplicationFactor: 1}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
src, _ := h.Lifecycle().Volumes.GetVolume("src")
|
||||
catalogSnapshot(t, cat, src, "daily", false)
|
||||
if r, err := svc.CreateVolume(ctx, &control.CreateVolumeRequest{VolumeId: "t", SourceVolume: "src", SourceSnapshot: "daily", CreateRequestId: "restore-t"}); err != nil || !r.GetStoreReady() {
|
||||
t.Fatalf("setup restore: %+v %v", r, err)
|
||||
}
|
||||
tgt, _ := h.Lifecycle().Volumes.GetVolume("t")
|
||||
catalogSnapshot(t, cat, tgt, "copy", true)
|
||||
return h, svc, cat, filer, src, tgt
|
||||
}
|
||||
|
||||
// Through the real catalog: a restore from a restore target's snapshot is
|
||||
// refused before any filer write, and the master keeps no record of it.
|
||||
func TestARealCatalogRestoreOfARestoreTargetLeavesNothing(t *testing.T) {
|
||||
h, svc, cat, filer, src, tgt := catalogSourceAndTarget(t)
|
||||
srcBefore, tgtBefore, writes := catalogGen(t, cat, src).Gen, catalogGen(t, cat, tgt).Gen, filer.count()
|
||||
_, err := svc.CreateVolume(context.Background(), &control.CreateVolumeRequest{VolumeId: "t2", SourceVolume: "t", SourceSnapshot: "copy", CreateRequestId: "restore-t2"})
|
||||
if status.Code(err) != codes.FailedPrecondition || !strings.Contains(err.Error(), "another volume's chunks") {
|
||||
t.Fatalf("restore of a restore target's snapshot: %v; want FailedPrecondition naming the foreign chunks", err)
|
||||
}
|
||||
if rec, ok := h.Lifecycle().Volumes.GetVolume("t2"); ok {
|
||||
t.Fatalf("the refused restore left the record %+v", rec)
|
||||
}
|
||||
if got := filer.count(); got != writes {
|
||||
t.Fatalf("the refused restore made %d filer writes", got-writes)
|
||||
}
|
||||
if s, g := catalogGen(t, cat, src).Gen, catalogGen(t, cat, tgt).Gen; s != srcBefore || g != tgtBefore {
|
||||
t.Fatalf("HEADs moved: source %d -> %d, target %d -> %d", srcBefore, s, tgtBefore, g)
|
||||
}
|
||||
}
|
||||
|
||||
// Control, through the real catalog: a target creation that fails after
|
||||
// the dependent's write keeps its record, and the replay completes it with
|
||||
// the same full target id.
|
||||
func TestARealCatalogRestoreFailedAfterItsDependentKeepsItsIdentity(t *testing.T) {
|
||||
h, svc, cat, filer, src, _ := catalogSourceAndTarget(t)
|
||||
filer.failVolumeIn = "t3-"
|
||||
req := &control.CreateVolumeRequest{VolumeId: "t3", SourceVolume: "src", SourceSnapshot: "daily", CreateRequestId: "restore-t3"}
|
||||
if _, err := svc.CreateVolume(context.Background(), req); status.Code(err) != codes.Unavailable {
|
||||
t.Fatalf("a restore that failed after its dependent: %v; want Unavailable (retry)", err)
|
||||
}
|
||||
rec, ok := h.Lifecycle().Volumes.GetVolume("t3")
|
||||
if !ok || rec.StoreReady {
|
||||
t.Fatalf("record %+v present=%t; want the not-ready record kept", rec, ok)
|
||||
}
|
||||
id := catalogRef(t, rec.Spec).ID
|
||||
recorded := false
|
||||
for _, d := range catalogGen(t, cat, src).Snapshots["daily"].Dependents {
|
||||
recorded = recorded || d.TargetID == id
|
||||
}
|
||||
if !recorded {
|
||||
t.Fatal("setup: the failure was not after the dependent's write")
|
||||
}
|
||||
resp, err := svc.CreateVolume(context.Background(), req)
|
||||
if err != nil || !resp.GetStoreReady() || resp.GetLayoutId() != rec.Spec.LayoutID {
|
||||
t.Fatalf("replay: %+v %v; want store-ready with the same layout id %s", resp, err, rec.Spec.LayoutID)
|
||||
}
|
||||
}
|
||||
|
||||
// A snapshot deleted between the master's check and the dependent's write
|
||||
// (the refusal arrives from target creation) is NotFound, with no record.
|
||||
func TestARestoreWhoseSnapshotWentAwayAfterTheCheckLeavesNoRecord(t *testing.T) {
|
||||
h, svc, _ := restoreRefusalMaster(t, fmt.Errorf("%w: %q", layout.ErrNoSnapshot, "s1"))
|
||||
_, err := svc.CreateVolume(context.Background(), &control.CreateVolumeRequest{VolumeId: "target", SourceVolume: "source", SourceSnapshot: "s1", CreateRequestId: "restore-1"})
|
||||
if status.Code(err) != codes.NotFound {
|
||||
t.Fatalf("snapshot gone after the check: %v; want NotFound", err)
|
||||
}
|
||||
if rec, ok := h.Lifecycle().Volumes.GetVolume("target"); ok {
|
||||
t.Fatalf("left the record %+v", rec)
|
||||
}
|
||||
}
|
||||
|
||||
// A record kept for the replay (an interrupted target creation, or a crash
|
||||
// before a refused restore's removal) whose snapshot is gone by the replay:
|
||||
// the replay stops at the master's own snapshot check and settles the record
|
||||
// there (an absent snapshot proves no dependent of the target was written).
|
||||
func TestAPendingRestoreRecordWhoseSnapshotIsGoneIsSettledByTheReplay(t *testing.T) {
|
||||
h, svc, _ := restoreRefusalMaster(t, errors.New("filer unavailable"))
|
||||
req := &control.CreateVolumeRequest{VolumeId: "target", SourceVolume: "source", SourceSnapshot: "s1", CreateRequestId: "restore-1"}
|
||||
if _, err := svc.CreateVolume(context.Background(), req); status.Code(err) != codes.Unavailable {
|
||||
t.Fatalf("setup: interrupted restore: %v", err)
|
||||
}
|
||||
if rec, ok := h.Lifecycle().Volumes.GetVolume("target"); !ok || rec.StoreReady {
|
||||
t.Fatalf("setup: record %+v present=%t; want a kept not-ready record", rec, ok)
|
||||
}
|
||||
h.cfg.LayoutReadHead = func(_ context.Context, source lifecycle.VolumeSpec) (layout.Head, error) {
|
||||
id, _ := layout.ParseVolumeID(source.LayoutID)
|
||||
return layout.Head{VolumeID: id, State: layout.StateLive}, nil // "s1" deleted since
|
||||
}
|
||||
if _, err := svc.CreateVolume(context.Background(), req); status.Code(err) != codes.NotFound {
|
||||
t.Fatalf("replay with the snapshot gone: %v; want NotFound", err)
|
||||
}
|
||||
if rec, ok := h.Lifecycle().Volumes.GetVolume("target"); ok {
|
||||
t.Fatalf("the replay left the pending record %+v", rec)
|
||||
}
|
||||
h.cfg.LayoutCreateTarget = func(context.Context, lifecycle.VolumeSpec, lifecycle.VolumeSpec, string) error { return nil }
|
||||
h.cfg.LayoutReadHead = func(_ context.Context, source lifecycle.VolumeSpec) (layout.Head, error) {
|
||||
id, _ := layout.ParseVolumeID(source.LayoutID)
|
||||
return layout.Head{VolumeID: id, State: layout.StateLive, Snapshots: map[string]layout.Snapshot{"s2": {}}}, nil
|
||||
}
|
||||
if r, err := svc.CreateVolume(context.Background(), &control.CreateVolumeRequest{VolumeId: "target", SourceVolume: "source", SourceSnapshot: "s2", CreateRequestId: "restore-2"}); err != nil || !r.GetStoreReady() {
|
||||
t.Fatalf("a new restore under the settled name: %+v %v", r, err)
|
||||
}
|
||||
}
|
||||
|
||||
// Lease renewal on a not-ready name: an admitted deletion is the untyped
|
||||
// "being deleted", a committed one the typed DELETED; never the retry hint.
|
||||
func TestRenewalOfADeletedNotReadyNameSaysDeleted(t *testing.T) {
|
||||
h := newTestMaster(t, t.TempDir())
|
||||
t.Cleanup(func() { closeTestMaster(t, h) })
|
||||
h.cfg.WorkspaceRPC = true
|
||||
svc := newServices(h)
|
||||
h.cfg.LayoutCreateVolume = func(context.Context, lifecycle.VolumeSpec) error { return fmt.Errorf("filer unavailable") }
|
||||
if _, err := svc.CreateVolume(context.Background(), &control.CreateVolumeRequest{VolumeId: "x", SizeBytes: 1 << 20, ReplicationFactor: 1}); status.Code(err) != codes.Unavailable {
|
||||
t.Fatalf("setup: not-ready create: %v", err)
|
||||
}
|
||||
if text, r := refusalOf(t, "not ready", svc.workspaceVolumeForRenewal("x")); text != "workspace: created, store not ready; retry CreateVolume" || r != nil {
|
||||
t.Fatalf("control: not ready, not deleted: %q %v; want the retry hint", text, r)
|
||||
}
|
||||
if _, err := h.lifecycle.Deletions.Admit("x", "del-x"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if text, r := refusalOf(t, "admitted", svc.workspaceVolumeForRenewal("x")); text != "workspace: volume is being deleted" || r != nil {
|
||||
t.Fatalf("admitted deletion: %q detail %v; want the untyped being-deleted refusal", text, r)
|
||||
}
|
||||
if _, err := h.lifecycle.Deletions.Commit("x", "del-x"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if text, r := refusalOf(t, "committed", svc.workspaceVolumeForRenewal("x")); text != "workspace: volume is being deleted" || r == nil || r.GetKind() != control.WorkspaceLeaseRefusal_DELETED {
|
||||
t.Fatalf("committed deletion: %q detail %v; want typed DELETED", text, r)
|
||||
}
|
||||
}
|
||||
|
||||
// Scope of the record removal: only a record that never left the creation
|
||||
// phase goes (a refused restore). A volume that served and was deleted keeps
|
||||
// its name reserved for good: neither a plain create nor the same restore
|
||||
// request can bring the name back, and no record or filer write appears.
|
||||
func TestAServedThenDeletedNameIsStillRefused(t *testing.T) {
|
||||
h, svc, _, filer, _, tgt := catalogSourceAndTarget(t) // t: restored, store-ready, has served a snapshot
|
||||
if !tgt.StoreReady {
|
||||
t.Fatal("setup: the target is not store-ready")
|
||||
}
|
||||
if _, err := h.lifecycle.Deletions.Admit("t", "del-t"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := h.lifecycle.Deletions.Commit("t", "del-t"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := h.lifecycle.Volumes.DeleteVolume("t"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
writes := filer.count()
|
||||
for name, req := range map[string]*control.CreateVolumeRequest{
|
||||
"plain create": {VolumeId: "t", SizeBytes: 64 * 4096, ReplicationFactor: 1},
|
||||
"the same restore": {VolumeId: "t", SourceVolume: "src", SourceSnapshot: "daily", CreateRequestId: "restore-t"},
|
||||
"a new restore": {VolumeId: "t", SourceVolume: "src", SourceSnapshot: "daily", CreateRequestId: "restore-t-again"},
|
||||
} {
|
||||
_, err := svc.CreateVolume(context.Background(), req)
|
||||
if status.Code(err) != codes.FailedPrecondition || !strings.Contains(err.Error(), "never reused") {
|
||||
t.Fatalf("%s of the deleted served name: %v; want FailedPrecondition, never reused", name, err)
|
||||
}
|
||||
if rec, ok := h.Lifecycle().Volumes.GetVolume("t"); ok {
|
||||
t.Fatalf("%s brought back a record %+v", name, rec)
|
||||
}
|
||||
}
|
||||
if got := filer.count(); got != writes {
|
||||
t.Fatalf("the refused creates made %d filer writes", got-writes)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package master
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout"
|
||||
"github.com/seaweedfs/seaweed-block/core/lifecycle"
|
||||
control "github.com/seaweedfs/seaweed-block/core/rpc/control"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// restoreRefusalMaster is a master with a store-ready source holding the
|
||||
// snapshot "s1", whose target creation answers refuse.
|
||||
func restoreRefusalMaster(t *testing.T, refuse error) (*Host, *services, *int) {
|
||||
t.Helper()
|
||||
h := newTestMaster(t, t.TempDir())
|
||||
t.Cleanup(func() { closeTestMaster(t, h) })
|
||||
svc := newServices(h)
|
||||
h.cfg.LayoutCreateVolume = func(context.Context, lifecycle.VolumeSpec) error { return nil }
|
||||
if _, err := svc.CreateVolume(context.Background(), &control.CreateVolumeRequest{VolumeId: "source", SizeBytes: 1 << 20, ReplicationFactor: 1}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
g := layout.Geometry{SizeBytes: 1 << 20, BlockSize: 4096, ChunkBytes: 4 << 20}
|
||||
h.cfg.LayoutReadVolume = func(_ context.Context, source lifecycle.VolumeSpec) (layout.Volume, error) {
|
||||
id, err := layout.ParseVolumeID(source.LayoutID)
|
||||
return layout.Volume{ID: id, Name: source.VolumeID, Geometry: g, Format: layout.VolumeFormat}, err
|
||||
}
|
||||
h.cfg.LayoutReadHead = func(_ context.Context, source lifecycle.VolumeSpec) (layout.Head, error) {
|
||||
id, _ := layout.ParseVolumeID(source.LayoutID)
|
||||
return layout.Head{VolumeID: id, State: layout.StateLive, Snapshots: map[string]layout.Snapshot{"s1": {}}}, nil
|
||||
}
|
||||
calls := new(int)
|
||||
h.cfg.LayoutCreateTarget = func(context.Context, lifecycle.VolumeSpec, lifecycle.VolumeSpec, string) error {
|
||||
*calls++
|
||||
return refuse
|
||||
}
|
||||
return h, svc, calls
|
||||
}
|
||||
|
||||
// A restore its target creation refuses for good (here a snapshot of a
|
||||
// restore target, which names another volume's chunks: the refusal the
|
||||
// catalog's restore gives, before it writes anything) changes nothing: no
|
||||
// lifecycle record is left under the target name, a replay is refused the
|
||||
// same way, and the name stays free for a restore that is admitted.
|
||||
func TestARefusedRestoreLeavesNoTargetRecord(t *testing.T) {
|
||||
foreign := fmt.Errorf("%w: %q", layout.ErrForeignSource, "s1")
|
||||
h, svc, calls := restoreRefusalMaster(t, foreign)
|
||||
req := &control.CreateVolumeRequest{VolumeId: "target", SourceVolume: "source", SourceSnapshot: "s1", CreateRequestId: "restore-1"}
|
||||
for i := 0; i < 2; i++ {
|
||||
_, err := svc.CreateVolume(context.Background(), req)
|
||||
if status.Code(err) != codes.FailedPrecondition {
|
||||
t.Fatalf("attempt %d: refused restore answered %v; want FailedPrecondition", i, err)
|
||||
}
|
||||
if rec, ok := h.Lifecycle().Volumes.GetVolume("target"); ok {
|
||||
t.Fatalf("attempt %d: a refused restore left the target record %+v", i, rec)
|
||||
}
|
||||
}
|
||||
if *calls != 2 {
|
||||
t.Fatalf("target creation ran %d times; want once per attempt", *calls)
|
||||
}
|
||||
h.cfg.LayoutCreateTarget = func(context.Context, lifecycle.VolumeSpec, lifecycle.VolumeSpec, string) error { return nil }
|
||||
resp, err := svc.CreateVolume(context.Background(), &control.CreateVolumeRequest{VolumeId: "target", SourceVolume: "source", SourceSnapshot: "s1", CreateRequestId: "restore-2"})
|
||||
if err != nil || !resp.GetStoreReady() {
|
||||
t.Fatalf("an admitted restore under the refused name: %+v %v", resp, err)
|
||||
}
|
||||
}
|
||||
|
||||
// Control: an interrupted target creation (any other error) keeps its
|
||||
// not-ready record for the replay to heal, as before.
|
||||
func TestAnInterruptedRestoreKeepsItsRecordForTheReplay(t *testing.T) {
|
||||
h, svc, _ := restoreRefusalMaster(t, fmt.Errorf("filer unavailable"))
|
||||
req := &control.CreateVolumeRequest{VolumeId: "target", SourceVolume: "source", SourceSnapshot: "s1", CreateRequestId: "restore-1"}
|
||||
if _, err := svc.CreateVolume(context.Background(), req); status.Code(err) != codes.Unavailable {
|
||||
t.Fatalf("interrupted restore: %v; want Unavailable (retry)", err)
|
||||
}
|
||||
if rec, ok := h.Lifecycle().Volumes.GetVolume("target"); !ok || rec.StoreReady {
|
||||
t.Fatalf("interrupted restore: record %+v present=%t; want a not-ready record", rec, ok)
|
||||
}
|
||||
}
|
||||
|
||||
// workspace show of a name whose store never became ready and whose
|
||||
// deletion is admitted says it is being deleted, not to retry a
|
||||
// CreateVolume that is refused for a deleted name.
|
||||
func TestWorkspaceShowOfADeletedNotReadyNameSaysDeleted(t *testing.T) {
|
||||
h := newTestMaster(t, t.TempDir())
|
||||
t.Cleanup(func() { closeTestMaster(t, h) })
|
||||
h.cfg.WorkspaceRPC = true
|
||||
svc := newServices(h)
|
||||
h.cfg.LayoutCreateVolume = func(context.Context, lifecycle.VolumeSpec) error { return fmt.Errorf("filer unavailable") }
|
||||
if _, err := svc.CreateVolume(context.Background(), &control.CreateVolumeRequest{VolumeId: "x", SizeBytes: 1 << 20, ReplicationFactor: 1}); status.Code(err) != codes.Unavailable {
|
||||
t.Fatalf("setup: not-ready create: %v", err)
|
||||
}
|
||||
q := &control.WorkspaceVolume{VolumeId: "x"}
|
||||
if _, err := svc.QueryWorkspace(context.Background(), q); status.Convert(err).Message() != "workspace: created, store not ready; retry CreateVolume" {
|
||||
t.Fatalf("control: a not-ready name not being deleted: %v; want the retry hint", err)
|
||||
}
|
||||
if _, err := h.lifecycle.Deletions.Admit("x", "del-x"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := svc.QueryWorkspace(context.Background(), q); status.Code(err) != codes.FailedPrecondition || status.Convert(err).Message() != "workspace: volume is being deleted" {
|
||||
t.Fatalf("a deleted not-ready name: %v; want FailedPrecondition 'workspace: volume is being deleted'", err)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package master
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout"
|
||||
"github.com/seaweedfs/seaweed-block/core/lifecycle"
|
||||
control "github.com/seaweedfs/seaweed-block/core/rpc/control"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// A removal that fails answers a retry, not the refusal, and keeps the
|
||||
// record; the replay removes it. For a foreign snapshot the replay is
|
||||
// refused again by target creation; for a snapshot gone since, the replay
|
||||
// stops at the master's own check and settles the record there.
|
||||
func TestAFailedRecordRemovalIsARetryAndTheReplaySettlesIt(t *testing.T) {
|
||||
for _, tc := range []struct {
|
||||
name string
|
||||
refuse error
|
||||
replay codes.Code
|
||||
gone bool // the snapshot is absent at the replay's check
|
||||
}{
|
||||
{"foreign snapshot", fmt.Errorf("%w: %q", layout.ErrForeignSource, "s1"), codes.FailedPrecondition, false},
|
||||
{"snapshot gone, then absent at the check", fmt.Errorf("%w: %q", layout.ErrNoSnapshot, "s1"), codes.NotFound, true},
|
||||
} {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
h, svc, _ := restoreRefusalMaster(t, tc.refuse)
|
||||
prior := undoRestoreRecord
|
||||
t.Cleanup(func() { undoRestoreRecord = prior })
|
||||
undoRestoreRecord = func(*Host, string) error { return errors.New("fixture: lifecycle store write failed") }
|
||||
req := &control.CreateVolumeRequest{VolumeId: "target", SourceVolume: "source", SourceSnapshot: "s1", CreateRequestId: "restore-1"}
|
||||
if _, err := svc.CreateVolume(context.Background(), req); status.Code(err) != codes.Unavailable {
|
||||
t.Fatalf("failed removal: %v; want Unavailable (retry)", err)
|
||||
}
|
||||
if rec, ok := h.Lifecycle().Volumes.GetVolume("target"); !ok || rec.StoreReady {
|
||||
t.Fatalf("failed removal: record %+v present=%t; want it kept, not ready", rec, ok)
|
||||
}
|
||||
undoRestoreRecord = prior
|
||||
if tc.gone {
|
||||
h.cfg.LayoutReadHead = func(_ context.Context, source lifecycle.VolumeSpec) (layout.Head, error) {
|
||||
id, _ := layout.ParseVolumeID(source.LayoutID)
|
||||
return layout.Head{VolumeID: id, State: layout.StateLive}, nil
|
||||
}
|
||||
}
|
||||
if _, err := svc.CreateVolume(context.Background(), req); status.Code(err) != tc.replay {
|
||||
t.Fatalf("replay: %v; want %v", err, tc.replay)
|
||||
}
|
||||
if rec, ok := h.Lifecycle().Volumes.GetVolume("target"); ok {
|
||||
t.Fatalf("replay left the record %+v", rec)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,6 +123,19 @@ func (s *services) CreateVolume(ctx context.Context, req *control.CreateVolumeRe
|
||||
return nil, status.Error(codes.FailedPrecondition, "restore source HEAD is absent, foreign or not live/detached")
|
||||
}
|
||||
if _, ok := head.Snapshots[spec.SourceSnapshot]; !ok {
|
||||
// A replay whose earlier attempt wrote the target's record and then
|
||||
// stopped (a crash, or a removal that failed) settles it here: a
|
||||
// recorded dependent keeps its snapshot, so an absent snapshot means
|
||||
// no dependent of the target is recorded on the source now (one may
|
||||
// have been, and released by the operator). Removing the record
|
||||
// stays safe: a target's store directory is named by its id, so no
|
||||
// later create reuses what this attempt may have written. The
|
||||
// request tuple was matched above.
|
||||
if existing, ok := stores.Volumes.GetVolume(spec.VolumeID); ok && !existing.StoreReady && existing.Spec.SourceLayoutID == source.Spec.LayoutID {
|
||||
if err := undoRestoreRecord(s.host, spec.VolumeID); err != nil {
|
||||
return nil, status.Errorf(codes.Unavailable, "restore source snapshot %q is absent; the target's pending record was not removed: %v; retry", spec.SourceSnapshot, err)
|
||||
}
|
||||
}
|
||||
return nil, status.Errorf(codes.NotFound, "restore source snapshot %q is absent", spec.SourceSnapshot)
|
||||
}
|
||||
spec.SourceLayoutID = source.Spec.LayoutID
|
||||
@@ -162,6 +175,22 @@ func (s *services) CreateVolume(ctx context.Context, req *control.CreateVolumeRe
|
||||
|
||||
var errLayoutStoreNotReady = errors.New("layout store not ready")
|
||||
|
||||
// undoRestoreRecord removes a refused restore's not-ready record; a variable
|
||||
// so a test can make the removal fail.
|
||||
var undoRestoreRecord = func(h *Host, volumeID string) error {
|
||||
return h.lifecycle.Volumes.DeleteVolume(volumeID)
|
||||
}
|
||||
|
||||
// restoreRefusedForGood: target creation refused the restore before any
|
||||
// write (RunAddDependent's checks, ahead of its update), for a reason no
|
||||
// replay changes: the snapshot names another volume's chunks, or it is
|
||||
// absent (a recorded dependent keeps a snapshot from being deleted). Other
|
||||
// refusals, such as a geometry mismatch with an existing VOLUME, can follow
|
||||
// the dependent's write and keep the record for the replay.
|
||||
func restoreRefusedForGood(err error) bool {
|
||||
return errors.Is(err, layout.ErrForeignSource) || errors.Is(err, layout.ErrNoSnapshot)
|
||||
}
|
||||
|
||||
// createLifecycleVolume is called under workspaceMu. A failed filer create
|
||||
// leaves the durable record not-ready; replay uses its same identity and
|
||||
// completes VOLUME/HEAD before publishing the one-way placement hint.
|
||||
@@ -189,6 +218,17 @@ func (h *Host) createLifecycleVolume(ctx context.Context, spec lifecycle.VolumeS
|
||||
return lifecycle.VolumeRecord{}, fmt.Errorf("%w: restore source or target creator is unavailable", errLayoutStoreNotReady)
|
||||
}
|
||||
createErr = h.cfg.LayoutCreateTarget(ctx, source.Spec, rec.Spec, rec.Spec.SourceSnapshot)
|
||||
if restoreRefusedForGood(createErr) {
|
||||
// Refused before it wrote anything, and a replay is refused the
|
||||
// same way (a snapshot's root never changes): a refused restore
|
||||
// changes nothing, so its not-ready record goes too.
|
||||
if err := undoRestoreRecord(h, rec.Spec.VolumeID); err != nil {
|
||||
// Not the refusal's answer: the record stays, so this is a
|
||||
// retry (Unavailable), and the replay removes it.
|
||||
return lifecycle.VolumeRecord{}, fmt.Errorf("%w: %v; its pending record was not removed: %v", errLayoutStoreNotReady, createErr, err)
|
||||
}
|
||||
return lifecycle.VolumeRecord{}, createErr
|
||||
}
|
||||
} else {
|
||||
createErr = h.cfg.LayoutCreateVolume(ctx, rec.Spec)
|
||||
}
|
||||
|
||||
@@ -26,12 +26,14 @@ func (s *services) workspaceVolume(volume string) error {
|
||||
if !ok || r.Spec.ReplicationFactor != 1 {
|
||||
return status.Error(codes.FailedPrecondition, "workspace move requires an existing RF1 volume")
|
||||
}
|
||||
if !s.host.layoutStoreReady(volume) {
|
||||
return status.Error(codes.FailedPrecondition, "workspace: created, store not ready; retry CreateVolume")
|
||||
}
|
||||
// Deletion first: a deleted name's CreateVolume is refused, so it must
|
||||
// never be told to retry it.
|
||||
if s.host.lifecycle.Deletions.Reserved(volume) {
|
||||
return status.Error(codes.FailedPrecondition, "workspace: volume is being deleted")
|
||||
}
|
||||
if !s.host.layoutStoreReady(volume) {
|
||||
return status.Error(codes.FailedPrecondition, "workspace: created, store not ready; retry CreateVolume")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -52,15 +54,15 @@ func (s *services) workspaceVolumeForRenewal(volume string) error {
|
||||
if !ok || r.Spec.ReplicationFactor != 1 {
|
||||
return status.Error(codes.FailedPrecondition, "workspace move requires an existing RF1 volume")
|
||||
}
|
||||
if !s.host.layoutStoreReady(volume) {
|
||||
return status.Error(codes.FailedPrecondition, "workspace: created, store not ready; retry CreateVolume")
|
||||
}
|
||||
if s.host.lifecycle.Deletions.ReservedSnapshot(volume) {
|
||||
if s.host.lifecycle.Deletions.CommittedSnapshot(volume) {
|
||||
return leaseRefusal("workspace: volume is being deleted", control.WorkspaceLeaseRefusal_DELETED, 0)
|
||||
}
|
||||
return status.Error(codes.FailedPrecondition, "workspace: volume is being deleted")
|
||||
}
|
||||
if !s.host.layoutStoreReady(volume) {
|
||||
return status.Error(codes.FailedPrecondition, "workspace: created, store not ready; retry CreateVolume")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -728,6 +728,7 @@ Notes:
|
||||
| `INV-AUTH-CALLER-ROLE-001` | With mutual TLS on, every blockmaster gRPC call (unary, and before every stream send) is decided by the caller's certificate and the current role file: an unknown caller is refused UNAUTHENTICATED, a role its method's rule does not admit PERMISSION_DENIED, a method without a rule always. | AUTHORITY: control API callers (people, tools, nodes) | `core/auth/identity.go` `Authenticator.PeerIdentity`, `Authenticator.Reload`; `core/auth/authorize.go` `Rule.Allows`, `UnaryInterceptor`, `StreamInterceptor`, `RequireNode`, `RequireRole`; `core/host/master/authz.go` `masterRules`, `serverAuth`; `core/rpc/link/tls.go` `ServerCredentials`, `ClientCredentials`; `cmd/blockmaster/auth.go` `authFlags.validate`, `authFlags.build` | `TestPeerIdentity`, `TestRoleFileReload` (`core/auth/identity_test.go`); `TestRuleAllows`, `TestRequireNodeAndRole`, `TestUnaryInterceptor`, `TestStreamEndsAtTheReloadThatRevokesItsCaller` (`core/auth/authorize_test.go`); `TestMasterAuthorizationTableCoversEveryMethod` (`core/host/master/authz_test.go`); `TestForcedMoveNeedsAnAdmin`, `TestNodeActsOnlyForItsOwnServerID` (`core/host/master/auth_red_test.go`); `TestMasterLinkMutualTLS` (`core/rpc/link/tls_test.go`); `TestAuthFlags` (`cmd/blockmaster/auth_flags_test.go`); `TestMasterTLSFlags` (`cmd/blockvolume/master_tls_test.go`). Also: a mutating operator or admin method writes its audit attempt before it runs or is refused as audit unavailable (`Rule.Strict`; `TestMasterOperatorMethodsAreStrict` (inverted: a new operator or admin method fails unless strict or named with its reason), `core/host/master/authz_test.go`; `TestStrictCallsNeedTheirAttemptLine`, `core/auth/strict_audit_test.go`), node calls never wait on the audit log; a reload that removes a caller, or changes its role so the method's rule no longer admits it, ends its open streams at the reload; a forced move needs an admin; plaintext listens only on loopback without a role file (development mode). Limits: the audit log records outcomes and decides nothing; the volume process's own HTTP routes stay loopback-only and unauthenticated. | `AuthLease` (exhaustive run pending) | ACTIVE |
|
||||
| `INV-AUTH-ONE-REPLICATED-FACTOR-001` | CreateVolume admits a replicated volume only if the master can decide it: its replication factor equals the master's one slot count (--expected-slots-per-volume) and the lifecycle product loop runs (only that loop binds, mints and promotes it). | M2 none → Bound (a created replicated volume's first line) | `core/host/master/services.go` `CreateVolume`; `core/host/master/host.go` `Config.LifecycleProductLoop`; `core/authority/controller.go` `ExpectedSlotsPerVolume`, `validateVolumeTopology` | `TestAnRF2CreateOnAnRF3MasterIsRefusedAndFailoverContinues`, `TestAReplicatedCreateWithTheProductLoopOffIsRefused` (`core/host/master/create_rf_mismatch_test.go`) | — (an admission check). Limits: single-replica volumes are admitted at any slot count (they never reach the check); a static --topology file with a mismatched volume is not checked at start (a cluster spec is: `INV-AUTH-REPLICATED-SPEC-NEEDS-LOOP-001`) | ACTIVE |
|
||||
| `INV-AUTH-REPLICATED-SPEC-NEEDS-LOOP-001` | blockmaster refuses to start when its cluster spec holds a replicated volume it could never decide: one whose replication factor differs from --expected-slots-per-volume, or any while the lifecycle product loop is off (only that loop binds, mints and promotes it). | M2 none → Bound (a replicated cluster-spec volume's first line) | `cmd/blockmaster/product_loop_guard.go` `requireProductLoop`; `cmd/blockmaster/main.go` `run` | `TestReplicatedClusterSpecWithTheProductLoopOffIsRefused`, `TestTheProductLoopGuardPassesWhatItShould`, `TestAClusterSpecVolumeOfAnotherReplicationFactorIsRefused`, `TestAPlacementOnlyClusterSpecVolumeIsChecked` (`cmd/blockmaster/product_loop_guard_test.go`) | — (a startup configuration check). Limits: static `--topology` is not refused (its observation controller mints), and has no automatic failover in v1 | ACTIVE |
|
||||
| `INV-CREATE-ONE-IDENTITY-001` | One name, one layout identity; no directory but the record's holds a live HEAD (not none, not deleted). A served volume's deleted name is never created again. | M2 none → created (CreateVolume, restore target creation) | `core/host/master/services.go` `CreateVolume`, `createLifecycleVolume`; `core/frontend/chunkstore/layout/start.go` `Start` | `TestARefusedRestoreLeavesNoTargetRecord` (`core/host/master/restore_refusal_test.go`), `TestARealCatalogRestoreOfARestoreTargetLeavesNothing`, `TestAServedThenDeletedNameIsStillRefused` (`core/host/master/restore_refusal_catalog_test.go`), `TestCreateVolume` (`core/frontend/chunkstore/layout/create_test.go`), `TestDecodeHead_RefusesAnotherVolumesHead` (`core/frontend/chunkstore/layout/head_test.go`) | VolumeCreate OneIdentity (its second clause: a directory with a live HEAD is the record's). Scope: only a refused restore's record, which never left the creation phase (never assigned, never served), is removed, with no filer write. Limits: a served volume's deleted name stays refused until 1.1 | 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`) | `ControlPlane` `UniqueEpoch` | 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 |
|
||||
|
||||
Reference in new issue
Block a user