mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 18:47:20 +01:00
Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cda91c24ea | ||
|
|
71f5b6f440 | ||
|
|
ca22f937b5 | ||
|
|
4eb8b2a2fa | ||
|
|
799c5c1130 | ||
|
|
5ae2b8a56c |
No files matched your search
@@ -12,6 +12,7 @@ import (
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
"syscall"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -25,7 +26,7 @@ import (
|
||||
type storeRecordMaster struct {
|
||||
control.UnimplementedLifecycleServiceServer
|
||||
mu sync.Mutex
|
||||
mode string // "creating", "ended", "older", "unavailable"
|
||||
mode string // "creating", "ended", "older", "unreadable", "unavailable"
|
||||
}
|
||||
|
||||
func (m *storeRecordMaster) set(mode string) { m.mu.Lock(); m.mode = mode; m.mu.Unlock() }
|
||||
@@ -42,6 +43,8 @@ func (m *storeRecordMaster) GetReplicaStore(_ context.Context, q *control.GetRep
|
||||
return &control.GetReplicaStoreResponse{Listed: true, CreationEnded: true}, nil
|
||||
case "older":
|
||||
return nil, status.Error(codes.Unimplemented, "unknown method GetReplicaStore")
|
||||
case "unreadable":
|
||||
return nil, status.Error(codes.FailedPrecondition, "the replica's store record is unreadable")
|
||||
}
|
||||
return nil, status.Error(codes.Unavailable, "lifecycle store unavailable")
|
||||
}
|
||||
@@ -102,7 +105,10 @@ func runHolder(t *testing.T, bin, master, root, locks string, until func() bool,
|
||||
// the volume is creating an empty state directory creates the store; once
|
||||
// creation ended, a store other than the recorded one, and a wiped state
|
||||
// directory, exit 78 store_lost; an older master (no GetReplicaStore) and an
|
||||
// unreadable record exit 75 with an empty state directory left empty.
|
||||
// unreadable record exit 75 with an empty state directory left empty. A
|
||||
// master that gives no reply is waited out inside the process, writing
|
||||
// nothing, so a start during an outage does not burn the unit's start limit;
|
||||
// once it answers creating, the same process creates its store.
|
||||
func TestBlockvolumeAsksTheMasterBeforeCreatingItsStore(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("builds and runs the blockvolume binary")
|
||||
@@ -184,11 +190,64 @@ func TestBlockvolumeAsksTheMasterBeforeCreatingItsStore(t *testing.T) {
|
||||
}
|
||||
empty(t)
|
||||
|
||||
for mode, reason := range map[string]string{"older": "master_too_old", "unavailable": "store_record_unreadable"} {
|
||||
for mode, reason := range map[string]string{"older": "master_too_old", "unreadable": "store_record_unreadable"} {
|
||||
m.set(mode)
|
||||
if code, _, out := runHolder(t, bin, ln.Addr().String(), root, locks, nil, 60*time.Second); code != exitWorkspaceRetry || !strings.Contains(out, reason) {
|
||||
t.Fatalf("%s master, empty state: exit %d, want 75 %s\n%s", mode, code, reason, out)
|
||||
}
|
||||
empty(t)
|
||||
}
|
||||
|
||||
// No reply for longer than the old 10 s read bound plus the unit's 5 s
|
||||
// restart delay: the process stays, writes nothing, and creates its
|
||||
// store once the master answers creating.
|
||||
m.set("unavailable")
|
||||
start, answered := time.Now(), false
|
||||
answer := func() bool {
|
||||
if !answered && time.Since(start) > 25*time.Second {
|
||||
if entries, err := os.ReadDir(root); err != nil || len(entries) != 0 {
|
||||
t.Errorf("the waiting holder wrote into its state directory: %v %v", entries, err)
|
||||
}
|
||||
m.set("creating")
|
||||
answered = true
|
||||
}
|
||||
return created()
|
||||
}
|
||||
if code, running, out := runHolder(t, bin, ln.Addr().String(), root, locks, answer, 90*time.Second); !running || !created() || !strings.Contains(out, "waiting for the master at "+ln.Addr().String()) {
|
||||
t.Fatalf("a master with no reply, then creating: exit %d running %v created %v\n%s", code, running, created(), out)
|
||||
}
|
||||
|
||||
// A stop during the wait is a clean stop: exit 0, nothing created.
|
||||
if runtime.GOOS == "windows" {
|
||||
return // no SIGTERM to another process
|
||||
}
|
||||
if err := os.RemoveAll(root); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := os.MkdirAll(root, 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
m.set("unavailable")
|
||||
var buf bytes.Buffer
|
||||
cmd := exec.Command(bin, "--master", ln.Addr().String(), "--server-id", "s1", "--volume-id", "v1", "--replica-id", "r1",
|
||||
"--data-addr", "127.0.0.1:0", "--ctrl-addr", "127.0.0.1:0", "--durable-root", root, "--durable-impl", "walstore",
|
||||
"--durable-blocks", "64", "--"+volumeLockDirTestOnlyFlag, locks)
|
||||
cmd.Stdout, cmd.Stderr = &buf, &buf
|
||||
if err := cmd.Start(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
done := make(chan error, 1)
|
||||
go func() { done <- cmd.Wait() }()
|
||||
time.Sleep(5 * time.Second)
|
||||
_ = cmd.Process.Signal(syscall.SIGTERM)
|
||||
select {
|
||||
case err := <-done:
|
||||
if err != nil || !strings.Contains(buf.String(), "stopped while waiting for the master") {
|
||||
t.Fatalf("SIGTERM during the wait: %v\n%s", err, buf.String())
|
||||
}
|
||||
case <-time.After(30 * time.Second):
|
||||
killAndJoin(cmd, done)
|
||||
t.Fatalf("SIGTERM did not end the wait\n%s", buf.String())
|
||||
}
|
||||
empty(t)
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import (
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/seaweedfs/seaweed-block/core/adapter"
|
||||
@@ -926,9 +927,24 @@ func runVolume(f flags, exits *processExit) int {
|
||||
if xErr == nil && f.durableImpl != "walstore-chunk" {
|
||||
// A plain walstore store is the volume's only copy: ask the master
|
||||
// before anything is created or written (GetReplicaStore).
|
||||
qctx, qcancel := context.WithTimeout(context.Background(), replicaStoreQueryTimeout)
|
||||
rec, qerr := h.ReplicaStoreRecord(qctx)
|
||||
qcancel()
|
||||
var storeWait atomic.Bool
|
||||
if status != nil {
|
||||
status.SetStartupWait(storeWait.Load)
|
||||
}
|
||||
rec, qerr := readReplicaStore(exits.parent, f.masterAddr, h.ReplicaStoreRecord, log.Printf, storeWait.Store)
|
||||
if exits.parent.Err() != nil {
|
||||
// Stopped while waiting for the master: nothing was opened or
|
||||
// created, and a stop is not a failure.
|
||||
fmt.Fprintln(os.Stderr, "blockvolume: stopped while waiting for the master's store record; nothing was created")
|
||||
_ = closeProviderAfterSnapshotOperations(status, dp.Close)
|
||||
if status != nil {
|
||||
shutCtx, shutCancel := context.WithTimeout(context.Background(), 2*time.Second)
|
||||
_ = status.Close(shutCtx)
|
||||
shutCancel()
|
||||
}
|
||||
_ = h.Close()
|
||||
return 0
|
||||
}
|
||||
admission, refuse := decideStoreAdmission(rec, qerr, exists)
|
||||
if refuse != nil {
|
||||
fmt.Fprintln(os.Stderr, "blockvolume: durable storage open refused:", refuse.reason, refuse.detail)
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
//go:build linux && subprocess && chunkstore_integration && systemd_integration
|
||||
|
||||
package main_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
// A plain walstore holder started under the shipped unit's restart policy and
|
||||
// start limit while blockmaster gives no reply (nothing listens on its
|
||||
// address) waits inside the process for its store record: through a
|
||||
// 5-minute outage the unit stays active with no restart, /status says
|
||||
// waiting_for_master and the journal names the wait; once blockmaster
|
||||
// starts, the volume serves with no restart. Before, the start exited 75 at
|
||||
// once, the unit restarted every RestartSec, and after StartLimitBurst
|
||||
// starts it stayed failed even once the master came back.
|
||||
//
|
||||
// A runtime unit file (/run/systemd/system) stands for the installed unit.
|
||||
func TestWalstoreUnitWaitsForAnUnreachableMasterWithoutBurningItsStartLimit(t *testing.T) {
|
||||
if os.Getenv("GAP1_SYSTEMD_AUTHORIZED") != "1" {
|
||||
t.Fatal("explicit real-systemd qualification authorization required; no skip counts as proof")
|
||||
}
|
||||
if os.Geteuid() != 0 {
|
||||
t.Fatal("systemd qualification needs root")
|
||||
}
|
||||
shipped := gap1ShippedPolicy(t)
|
||||
interval, burst := shippedStartLimit(t)
|
||||
|
||||
exe := filepath.Join(t.TempDir(), "blockvolume")
|
||||
if d := os.Getenv("SWBLOCK_TEST_BINS"); d != "" {
|
||||
exe = filepath.Join(d, "blockvolume")
|
||||
} else {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute)
|
||||
out, err := exec.CommandContext(ctx, "go", "build", "-o", exe, "github.com/seaweedfs/seaweed-block/cmd/blockvolume").CombinedOutput()
|
||||
cancel()
|
||||
if err != nil {
|
||||
t.Fatalf("build blockvolume: %v %s", err, out)
|
||||
}
|
||||
}
|
||||
masterBin := filepath.Join(filepath.Dir(exe), "blockmaster")
|
||||
if os.Getenv("SWBLOCK_TEST_BINS") == "" {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute)
|
||||
out, err := exec.CommandContext(ctx, "go", "build", "-o", masterBin, "github.com/seaweedfs/seaweed-block/cmd/blockmaster").CombinedOutput()
|
||||
cancel()
|
||||
if err != nil {
|
||||
t.Fatalf("build blockmaster: %v %s", err, out)
|
||||
}
|
||||
}
|
||||
master, data, ctrl, statusAddr, nvme := handoffAddress(t), handoffAddress(t), handoffAddress(t), handoffAddress(t), handoffAddress(t)
|
||||
// nothing listens at master until blockmaster starts below
|
||||
|
||||
unit := fmt.Sprintf("swb-c04-walstore-wait-%d.service", os.Getpid())
|
||||
writeRuntimeUnit(t, unit, exe, []string{"--master", master, "--server-id", "s1", "--volume-id", "v1", "--replica-id", "r1",
|
||||
"--data-addr", data, "--ctrl-addr", ctrl, "--status-addr", statusAddr, "--durable-root", t.TempDir(), "--durable-impl", "walstore",
|
||||
"--durable-blocks", "64", "--nvme-listen", nvme, "--nvme-subsysnqn", "nqn.2026-05.io.seaweedfs:v1"}, []string{
|
||||
"StartLimitIntervalSec=" + interval,
|
||||
"StartLimitBurst=" + burst,
|
||||
}, []string{
|
||||
"Restart=on-failure",
|
||||
"RestartSec=" + shipped["RestartSec"],
|
||||
"RestartPreventExitStatus=" + shipped["RestartPreventExitStatus"],
|
||||
"TimeoutStopSec=" + shipped["TimeoutStopSec"],
|
||||
})
|
||||
if out, err := runSystemctl("start", unit); err != nil {
|
||||
t.Fatalf("start %s: %v %s", unit, err, out)
|
||||
}
|
||||
// A 5-minute outage: on the old behaviour the unit has failed after
|
||||
// StartLimitBurst starts RestartSec apart, well before this.
|
||||
window := 5 * time.Minute
|
||||
started := time.Now()
|
||||
var state map[string]string
|
||||
for time.Since(started) < window {
|
||||
time.Sleep(2 * time.Second)
|
||||
s, err := gap1ReadUnit(unit)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
state = s
|
||||
if s["ActiveState"] == "failed" {
|
||||
t.Fatalf("the unit gave up %v into the master outage: NRestarts %s Result %s; journal: %s",
|
||||
time.Since(started).Round(time.Second), s["NRestarts"], s["Result"], lastLines(unitJournal(unit), 15))
|
||||
}
|
||||
}
|
||||
journal := unitJournal(unit)
|
||||
t.Logf("walstore unit after %v with no master: ActiveState %s NRestarts %s", window, state["ActiveState"], state["NRestarts"])
|
||||
if state["ActiveState"] != "active" || state["NRestarts"] != "0" {
|
||||
t.Fatalf("after %v: ActiveState %s NRestarts %s; want active with no restart; journal: %s", window, state["ActiveState"], state["NRestarts"], lastLines(journal, 15))
|
||||
}
|
||||
if !strings.Contains(journal, "waiting for the master at "+master+" to answer this replica's store record: no reply for") {
|
||||
t.Fatalf("the journal does not name the wait: %s", lastLines(journal, 15))
|
||||
}
|
||||
if reason := statusNotReadyReason(statusAddr, "v1"); reason != "waiting_for_master" {
|
||||
t.Fatalf("/status NotReadyReason %q during the wait; want waiting_for_master", reason)
|
||||
}
|
||||
|
||||
// blockmaster starts: the waiting process goes on and serves, with no restart.
|
||||
dir := t.TempDir()
|
||||
topo := filepath.Join(dir, "topology.yaml")
|
||||
nl := string(rune(10))
|
||||
if err := os.WriteFile(topo, []byte("volumes:"+nl+" - volume_id: v1"+nl+" slots:"+nl+" - replica_id: r1"+nl+" server_id: s1"+nl), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
mlog, err := os.Create(filepath.Join(dir, "blockmaster.log"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
mc := exec.Command(masterBin, "--authority-store", filepath.Join(dir, "master"), "--listen", master, "--topology", topo, "--expected-slots-per-volume", "1")
|
||||
mc.Stdout, mc.Stderr = mlog, mlog
|
||||
if err := mc.Start(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Cleanup(func() { _ = mc.Process.Kill(); _ = mc.Wait(); mlog.Close() })
|
||||
back := time.Now()
|
||||
for !volumeFrontendReady(statusAddr, "v1") {
|
||||
if time.Since(back) > 2*time.Minute {
|
||||
b, _ := os.ReadFile(mlog.Name())
|
||||
t.Fatalf("v1 never served after blockmaster started; journal: %s; blockmaster: %s", lastLines(unitJournal(unit), 15), lastLines(string(b), 10))
|
||||
}
|
||||
time.Sleep(time.Second)
|
||||
}
|
||||
s, _ := gap1ReadUnit(unit)
|
||||
t.Logf("walstore unit served %v after blockmaster started: ActiveState %s NRestarts %s", time.Since(back).Round(time.Second), s["ActiveState"], s["NRestarts"])
|
||||
if s["ActiveState"] != "active" || s["NRestarts"] != "0" {
|
||||
t.Fatalf("after serving: ActiveState %s NRestarts %s; want active with no restart", s["ActiveState"], s["NRestarts"])
|
||||
}
|
||||
}
|
||||
|
||||
// statusNotReadyReason is /status's NotReadyReason for vol ("" when unreadable).
|
||||
func statusNotReadyReason(statusAddr, vol string) string {
|
||||
resp, err := http.Get("http://" + statusAddr + "/status?volume=" + vol)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
var p struct{ NotReadyReason string }
|
||||
if json.NewDecoder(resp.Body).Decode(&p) != nil {
|
||||
return ""
|
||||
}
|
||||
return p.NotReadyReason
|
||||
}
|
||||
|
||||
func lastLines(s string, n int) string {
|
||||
lines := strings.Split(strings.TrimSpace(s), string(rune(10)))
|
||||
if len(lines) > n {
|
||||
lines = lines[len(lines)-n:]
|
||||
}
|
||||
return strings.Join(lines, " | ")
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/seaweedfs/seaweed-block/core/host/volume"
|
||||
control "github.com/seaweedfs/seaweed-block/core/rpc/control"
|
||||
"github.com/seaweedfs/seaweed-block/core/storage"
|
||||
"google.golang.org/grpc/codes"
|
||||
@@ -13,6 +15,57 @@ import (
|
||||
// its durable open.
|
||||
const replicaStoreQueryTimeout = 10 * time.Second
|
||||
|
||||
// replicaStoreRetryEvery paces the store record read while blockmaster gives
|
||||
// no reply, and replicaStoreWaitLogEvery its log line. Vars only so a test
|
||||
// can shorten them.
|
||||
var (
|
||||
replicaStoreRetryEvery = 2 * time.Second
|
||||
replicaStoreWaitLogEvery = 30 * time.Second
|
||||
)
|
||||
|
||||
// readReplicaStore reads the master's record of this replica's store. While
|
||||
// blockmaster gives no reply (volume.MasterCallClass: neither contact nor a
|
||||
// credentials refusal) the process waits and reads again, with no bound, so
|
||||
// a start during a master outage does not exit and burn the unit's start
|
||||
// limit. It runs before the store is opened or created, so nothing is
|
||||
// written meanwhile; waiting reports the wait (for /status) and the log
|
||||
// repeats it every replicaStoreWaitLogEvery with the master's address and the
|
||||
// time waited. Any answer, a credentials refusal, or ctx's end returns the
|
||||
// last result.
|
||||
func readReplicaStore(ctx context.Context, master string, read func(context.Context) (*control.GetReplicaStoreResponse, error), logf func(string, ...any), waiting func(bool)) (*control.GetReplicaStoreResponse, error) {
|
||||
var since, logged time.Time
|
||||
defer func() {
|
||||
if !since.IsZero() {
|
||||
waiting(false)
|
||||
}
|
||||
}()
|
||||
for {
|
||||
qctx, cancel := context.WithTimeout(ctx, replicaStoreQueryTimeout)
|
||||
rec, err := read(qctx)
|
||||
cancel()
|
||||
contact, credentials := volume.MasterCallClass(err)
|
||||
if contact || credentials || ctx.Err() != nil {
|
||||
if !since.IsZero() && ctx.Err() == nil {
|
||||
logf("blockvolume: the master at %s answered this replica's store record after %s", master, time.Since(since).Round(time.Second))
|
||||
}
|
||||
return rec, err
|
||||
}
|
||||
if since.IsZero() {
|
||||
since = time.Now()
|
||||
waiting(true)
|
||||
}
|
||||
if logged.IsZero() || time.Since(logged) >= replicaStoreWaitLogEvery {
|
||||
logged = time.Now()
|
||||
logf("blockvolume: waiting for the master at %s to answer this replica's store record: no reply for %s (%v); nothing is created or written meanwhile", master, time.Since(since).Round(time.Second), err)
|
||||
}
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return rec, err
|
||||
case <-time.After(replicaStoreRetryEvery):
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// storeAdmission is how the durable open may treat the local store: with
|
||||
// mustExist it never creates one (a missing store is refused at the open
|
||||
// itself), and a nonzero id is the store it must find.
|
||||
@@ -27,7 +80,8 @@ type storeAdmission struct {
|
||||
// exists:
|
||||
//
|
||||
// answer store present store absent
|
||||
// error / timeout refuse 75 refuse 75
|
||||
// no reply (waited out in-process by readReplicaStore; only a shutdown ends the wait)
|
||||
// other error refuse 75 refuse 75
|
||||
// older master (Unimplemented) open as before refuse 75 master_too_old
|
||||
// not listed open as before refuse 75 volume_not_listed
|
||||
// listed, replicated, non-primary open or create (peer rebuild path, as before)
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
control "github.com/seaweedfs/seaweed-block/core/rpc/control"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// The store record read waits inside the process while blockmaster gives no
|
||||
// reply (Unavailable, DeadlineExceeded, a timed-out read), logging once, and
|
||||
// returns the first answer; any other result returns at once (a credentials
|
||||
// refusal, an older master, an answered error), and so does a shutdown.
|
||||
func TestReadReplicaStoreWaitsOnlyWhileTheMasterGivesNoReply(t *testing.T) {
|
||||
prev := replicaStoreRetryEvery
|
||||
replicaStoreRetryEvery = time.Millisecond
|
||||
t.Cleanup(func() { replicaStoreRetryEvery = prev })
|
||||
want := &control.GetReplicaStoreResponse{Listed: true}
|
||||
script := func(errs ...error) (func(context.Context) (*control.GetReplicaStoreResponse, error), *int) {
|
||||
calls := 0
|
||||
return func(context.Context) (*control.GetReplicaStoreResponse, error) {
|
||||
calls++
|
||||
if calls <= len(errs) {
|
||||
return nil, errs[calls-1]
|
||||
}
|
||||
return want, nil
|
||||
}, &calls
|
||||
}
|
||||
logs := 0
|
||||
logf := func(string, ...any) { logs++ }
|
||||
var states []bool
|
||||
waiting := func(w bool) { states = append(states, w) }
|
||||
|
||||
read, calls := script(status.Error(codes.Unavailable, "connection refused"), status.Error(codes.DeadlineExceeded, "deadline"), context.DeadlineExceeded)
|
||||
if rec, err := readReplicaStore(context.Background(), "127.0.0.1:9180", read, logf, waiting); err != nil || rec != want || *calls != 4 || logs != 2 {
|
||||
t.Fatalf("no reply three times, then an answer: rec %v err %v calls %d logs %d (want the answer after 4 reads, 2 log lines)", rec, err, *calls, logs)
|
||||
}
|
||||
if len(states) != 2 || !states[0] || states[1] {
|
||||
t.Fatalf("the wait was reported %v; want waiting, then not", states)
|
||||
}
|
||||
// The log line repeats at its cadence, not at every read.
|
||||
prevLog := replicaStoreWaitLogEvery
|
||||
replicaStoreWaitLogEvery = 50 * time.Millisecond
|
||||
t.Cleanup(func() { replicaStoreWaitLogEvery = prevLog })
|
||||
logs, slow := 0, 0
|
||||
slowRead := func(context.Context) (*control.GetReplicaStoreResponse, error) {
|
||||
slow++
|
||||
if slow > 60 {
|
||||
return want, nil
|
||||
}
|
||||
time.Sleep(5 * time.Millisecond)
|
||||
return nil, status.Error(codes.Unavailable, "down")
|
||||
}
|
||||
if _, err := readReplicaStore(context.Background(), "m", slowRead, logf, func(bool) {}); err != nil || logs < 3 || logs > 12 {
|
||||
t.Fatalf("about 300 ms of no reply at a 50 ms cadence logged %d lines (err %v); want a few, not one per read", logs, err)
|
||||
}
|
||||
for _, e := range []error{status.Error(codes.Unauthenticated, "bad cert"), status.Error(codes.Unimplemented, "older"), status.Error(codes.Internal, "boom"), errors.New("plain")} {
|
||||
read, calls := script(e)
|
||||
if _, err := readReplicaStore(context.Background(), "m", read, logf, func(bool) {}); !errors.Is(err, e) || *calls != 1 {
|
||||
t.Fatalf("%v: waited (%d reads) instead of returning it", e, *calls)
|
||||
}
|
||||
}
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
never := func(context.Context) (*control.GetReplicaStoreResponse, error) {
|
||||
cancel()
|
||||
return nil, status.Error(codes.Unavailable, "down")
|
||||
}
|
||||
done := make(chan error, 1)
|
||||
go func() { _, err := readReplicaStore(ctx, "m", never, logf, func(bool) {}); done <- err }()
|
||||
select {
|
||||
case err := <-done:
|
||||
if status.Code(err) != codes.Unavailable {
|
||||
t.Fatalf("a shutdown during the wait: %v", err)
|
||||
}
|
||||
case <-time.After(5 * time.Second):
|
||||
t.Fatal("a shutdown did not end the wait")
|
||||
}
|
||||
}
|
||||
@@ -68,8 +68,8 @@ func TestGetReplicaStoreAnswersFromTheMastersCreationFact(t *testing.T) {
|
||||
}
|
||||
for _, bad := range []string{"zz", "00000000000000000000000000000000"} {
|
||||
seed(&attestedStores{Stores: map[string]string{"r1": bad}})
|
||||
if r, err := ask("vol"); status.Code(err) != codes.Unavailable {
|
||||
t.Fatalf("an invalid recorded id %q: %+v %v, want Unavailable (never creating)", bad, r, err)
|
||||
if r, err := ask("vol"); status.Code(err) != codes.FailedPrecondition {
|
||||
t.Fatalf("an invalid recorded id %q: %+v %v, want FailedPrecondition (an answer, never creating)", bad, r, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -609,7 +609,7 @@ func (s *services) GetReplicaStore(ctx context.Context, q *control.GetReplicaSto
|
||||
state, id := s.host.ReplicaStoreState(q.GetVolumeId(), q.GetReplicaId())
|
||||
switch state {
|
||||
case replicaStoreUnknown:
|
||||
return nil, status.Error(codes.Unavailable, "the replica's store record is unreadable (an invalid recorded store id)")
|
||||
return nil, status.Error(codes.FailedPrecondition, "the replica's store record is unreadable (an invalid recorded store id)")
|
||||
case replicaStoreEnded:
|
||||
out.CreationEnded = true
|
||||
if !id.IsZero() {
|
||||
|
||||
@@ -65,11 +65,11 @@ func newMasterWait(now func() time.Time, logf func(string, ...any)) *masterWait
|
||||
return &masterWait{now: now, logf: logf}
|
||||
}
|
||||
|
||||
// masterCallClass sorts a call result: a reply produced by blockmaster's
|
||||
// MasterCallClass sorts a call result: a reply produced by blockmaster's
|
||||
// handler (any status but the transport codes) is contact; Unavailable,
|
||||
// DeadlineExceeded and Canceled are no reply; Unauthenticated and
|
||||
// PermissionDenied are a credentials refusal.
|
||||
func masterCallClass(err error) (contact, credentials bool) {
|
||||
func MasterCallClass(err error) (contact, credentials bool) {
|
||||
if err == nil {
|
||||
return true, false
|
||||
}
|
||||
@@ -95,7 +95,7 @@ func masterCallClass(err error) (contact, credentials bool) {
|
||||
// assignment to accept). The heartbeat does not check identity, so its
|
||||
// answers alone do not end it sooner.
|
||||
func (w *masterWait) call(err error) {
|
||||
contact, credentials := masterCallClass(err)
|
||||
contact, credentials := MasterCallClass(err)
|
||||
identity := ""
|
||||
r := leaseRefusalDetail(err)
|
||||
if r != nil && r.GetKind() == control.WorkspaceLeaseRefusal_IDENTITY {
|
||||
|
||||
@@ -485,3 +485,21 @@ func TestRecordedRevocationFinalRequiresTypedFailedPrecondition(t *testing.T) {
|
||||
t.Fatal("log text became a terminal verdict")
|
||||
}
|
||||
}
|
||||
|
||||
// While the start waits for blockmaster's first answer, /status says
|
||||
// waiting_for_master, ahead of any other reason, and is not ready.
|
||||
func TestStatusSaysWaitingForMasterDuringTheStartupWait(t *testing.T) {
|
||||
p := stubProjector{p: engine.ReplicaProjection{Mode: engine.ModeHealthy, Epoch: 1, EndpointVersion: 1}}
|
||||
view := NewAdapterProjectionView(p, "v1", "r1", nil)
|
||||
s := NewStatusServer(view)
|
||||
s.SetDurableStatusSource(stubDurableStatusSource{vols: []durable.VolumeStatus{{VolumeID: "v1", Operational: true}}})
|
||||
waiting := true
|
||||
s.SetStartupWait(func() bool { return waiting })
|
||||
if got := s.statusProjection(); got.FrontendPrimaryReady || got.NotReadyReason != NotReadyWaitingForMaster {
|
||||
t.Fatalf("during the wait: ready %v reason %q", got.FrontendPrimaryReady, got.NotReadyReason)
|
||||
}
|
||||
waiting = false
|
||||
if got := s.statusProjection(); got.NotReadyReason == NotReadyWaitingForMaster {
|
||||
t.Fatalf("after the wait: reason %q", got.NotReadyReason)
|
||||
}
|
||||
}
|
||||
@@ -68,6 +68,7 @@ type StatusServer struct {
|
||||
peerSource peerStatusSource
|
||||
durableSource durableStatusSource
|
||||
masterWait func() *MasterWait // why a workspace primary holds no grant; nil: not wired
|
||||
startupWait func() bool // true while the start waits for blockmaster's first answer; nil: not wired
|
||||
nvmeSource nvmeStatusSource
|
||||
guestSources map[string]func() int // frontend -> guests connected now
|
||||
ublkSource ublkStatusSource
|
||||
@@ -203,12 +204,13 @@ type StatusProjection struct {
|
||||
// primary, its local durable backend admits I/O, and it may serve guest
|
||||
// I/O (INV-FE-PRIMARY-READY-OPERATIONAL-001).
|
||||
FrontendPrimaryReady bool
|
||||
// NotReadyReason says why FrontendPrimaryReady is false, first match: a
|
||||
// workspace primary holds no granted lease now (NotReadyLeaseNotHeld); the
|
||||
// local durable backend admits no I/O (its evidence: attach pending,
|
||||
// fenced, detached) or has no status for the volume; the frontend target
|
||||
// is not listening yet; this replica is not the healthy primary. Empty
|
||||
// when ready.
|
||||
// NotReadyReason says why FrontendPrimaryReady is false, first match: the
|
||||
// start waits for blockmaster to answer before it opens the volume's
|
||||
// store (NotReadyWaitingForMaster); a workspace primary holds no granted
|
||||
// lease now (NotReadyLeaseNotHeld); the local durable backend admits no
|
||||
// I/O (its evidence: attach pending, fenced, detached) or has no status
|
||||
// for the volume; the frontend target is not listening yet; this replica
|
||||
// is not the healthy primary. Empty when ready.
|
||||
NotReadyReason string `json:",omitempty"`
|
||||
// AuthorityRole is primary, superseded or unknown.
|
||||
AuthorityRole string
|
||||
@@ -619,6 +621,17 @@ func (s *StatusServer) handleStatusNVMe(w http.ResponseWriter, r *http.Request)
|
||||
// the lease-readiness gate (no claim, no listen, not ready).
|
||||
const NotReadyLeaseNotHeld = "lease_not_held"
|
||||
|
||||
// NotReadyWaitingForMaster: the start waits for blockmaster to answer before
|
||||
// it opens or creates the volume's store (blockmaster gives no reply).
|
||||
const NotReadyWaitingForMaster = "waiting_for_master"
|
||||
|
||||
// SetStartupWait wires whether the start is waiting for blockmaster's answer.
|
||||
func (s *StatusServer) SetStartupWait(f func() bool) {
|
||||
s.mu.Lock()
|
||||
s.startupWait = f
|
||||
s.mu.Unlock()
|
||||
}
|
||||
|
||||
func (s *StatusServer) statusProjection() StatusProjection {
|
||||
p := s.authorityProjection()
|
||||
authorityReady := p.FrontendPrimaryReady
|
||||
@@ -628,6 +641,7 @@ func (s *StatusServer) statusProjection() StatusProjection {
|
||||
p.FrontendPrimaryReady = p.FrontendPrimaryReady && !nvmePending
|
||||
src := s.durableSource
|
||||
masterWait := s.masterWait
|
||||
startupWait := s.startupWait
|
||||
s.mu.Unlock()
|
||||
// INV-FE-PRIMARY-READY-OPERATIONAL-001: not FrontendPrimaryReady while the
|
||||
// local backend admits no I/O (before the storage claim of a chunk volume,
|
||||
@@ -659,8 +673,14 @@ func (s *StatusServer) statusProjection() StatusProjection {
|
||||
if backendReason != "" || leaseNotHeld || profileRefusal != "" {
|
||||
p.FrontendPrimaryReady = false
|
||||
}
|
||||
waiting := startupWait != nil && startupWait()
|
||||
if waiting {
|
||||
p.FrontendPrimaryReady = false
|
||||
}
|
||||
if !p.FrontendPrimaryReady {
|
||||
switch {
|
||||
case waiting:
|
||||
p.NotReadyReason = NotReadyWaitingForMaster
|
||||
case profileRefusal != "":
|
||||
p.NotReadyReason = profileRefusal
|
||||
case leaseNotHeld:
|
||||
|
||||
@@ -1083,7 +1083,7 @@ Notes:
|
||||
| `INV-WS-FORCED-CONFIRM-NO-BYPASS-001` | No force-move flag bypasses the confirmation, and `--dry-run` is never a confirmation: it sends only a preview, which needs the same confirmation. | M2 lease: Expired → Moved (forced) (the explicit-force guard) | `cmd/sw-block/workspace.go` `runWorkspaceForceMove`, `workspacePreview`; `core/rpc/wsclient/wsclient.go` `PreviewForcedMove` | `TestWorkspaceForceMove_Row2_DryRunPreview`, `TestWorkspaceHelpText` (`cmd/sw-block/workspace_test.go`) | — | ACTIVE |
|
||||
| `INV-ATTACH-ASSIGNMENT-BOUND-001` | Without a master wait, the assignment allowance is checked between attach attempts; it never cancels a granted attempt's manifest read. Per-fetch bounds, recovery progress and provider Close still apply. | M1 Recovering to Serving (wait scheduling only) | `DurableProvider.chunkAuthorityWait` | `TestDefaultAttachAt262144EntriesOutlivesAssignmentWait`, `TestDefaultGrantedAttachFailureEndsAtAssignmentAllowance` (`core/frontend/durable/default_attach_attempt_test.go`); `TestRestoreDeferredAssignmentWaitEndsOnDeadlineAndClose` (`core/frontend/durable/provider_assignment_test.go`) | none (scheduling; authority guards unchanged) | ACTIVE |
|
||||
| `INV-WS-STARTUP-RETRY-001` | A workspace primary exits 75 on assignment timeout or lease expiry after bounded cleanup. A master fact newer than nonzero observed-own, or an exact foreign HEAD at/above the assigned epoch, permits 78. Newer HEAD/store format: 78. ACK and signal keep normal exit; lease and claim gates never relax. | M2 restart | `cmd/blockvolume/process_exit.go` `superviseProcess`, `workspaceRetryOutcome`; `core/frontend/durable/provider_layout.go` `startLayoutRoot`; `core/frontend/durable/provider_startup.go` `ChunkStartupIdentityRefused`, `ChunkStartupNewerVersion`, `endChunkStartup`; `cmd/blockvolume/process_exit.go` `chooseChunkStartupExit`, `durableOpenFatalExit` | `TestANewerHeadVersionExits78NotRestartable`, `TestAStoreOfANewerFormatExits78` (`cmd/blockvolume/newer_version_exit_test.go`); `TestChunkStartupNewerVersionIsGenerationBound` (`core/frontend/durable/provider_startup_internal_test.go`); `TestChunkAssignmentTimeoutExposesCurrentRecoveryOutcome` (`core/frontend/durable/provider_startup_outcome_test.go`); `TestChunkStartupOutcomeRejectsOldGenerationAndCoalescesWake` (`core/frontend/durable/provider_startup_internal_test.go`); `TestWorkspaceDisplacedClaimUsesAssignedEpoch`, `TestWorkspaceRetryUsesNewestOwnAssignment`, `TestWorkspaceForeignHeadClaimChoosesNoRetry`, `TestWorkspaceOldLocalHolderForeignHeadChoosesNoRetry` (`cmd/blockvolume/process_exit_authority_test.go`); `TestWorkspaceExitFirstOutcomeIsLatched`, `TestWorkspaceExitDoesNotWaitForBlockedFrontendClose`, `TestWorkspacePlannedStopKeepsSuccess` (`cmd/blockvolume/process_exit_test.go`) | Existing WorkspaceRegrant restart transition; no new grant rule | ACTIVE |
|
||||
| `INV-WALSTORE-NO-EMPTY-STORE-001` | A plain walstore holder (single replica, or a replicated volume's line primary) creates its store only on the master's creating answer. Once its store is recorded, or its volume predates attestation, a missing store exits 78 store_lost; an unreadable record exits 75. Neither writes anything. | Holder startup, before the durable open | `cmd/blockvolume/store_admission.go` `decideStoreAdmission`; `cmd/blockvolume/main.go` `runVolume` (before `InitReplicaFloor`); `core/host/master/store_attestation.go` `GetReplicaStore`, `ReplicaStoreState`; `core/frontend/durable/provider.go` `openOrCreate` (`ErrLostStore`) | `TestRF1HolderOnAWipedStateDirectoryRefusesStoreLost` (`cmd/blockvolume/rf1_store_lost_test.go`, process-level); `TestBlockvolumeAsksTheMasterBeforeCreatingItsStore` (`cmd/blockvolume/lost_store_exit_test.go`); `TestStoreAdmissionCreatesOnlyOnAnExplicitCreatingAnswer` (`cmd/blockvolume/store_admission_test.go`); `TestRF3WipedPrimaryRefusesAndASurvivorServesItsData` (`cmd/blockvolume/rf3_primary_store_lost_test.go`, process-level); `TestGetReplicaStoreAnswersFromTheMastersCreationFact` (`core/host/master/get_replica_store_test.go`); `TestGetReplicaStoreAnswersAReplicatedPrimaryFromItsOwnStore` (`core/host/master/primary_store_answer_test.go`); `TestAnEndedVolumeWithoutItsStoreRefusesAndCreatesNothing` (`core/frontend/durable/lost_store_test.go`) | MasterCreate NoEmptyHeadOverLineage projected onto the holder's local store (mutant RecreateWhenReady, here recreate_when_ended); CreateEvid2 creation fact; KnownZero (walstore has no HEAD to hydrate from). A replicated volume's non-primary replica keeps the peer rebuild: a fresh store has no durable LSN and is not the recorded store, so it never counts as a survivor or a promotion candidate | STUB |
|
||||
| `INV-WALSTORE-NO-EMPTY-STORE-001` | A plain walstore holder (single replica, or a replicated volume's line primary) creates its store only on the master's creating answer. Once its store is recorded, or its volume predates attestation, a missing store exits 78 store_lost; an unreadable record exits 75. Neither writes anything. | Holder startup, before the durable open | `cmd/blockvolume/store_admission.go` `decideStoreAdmission`; `cmd/blockvolume/main.go` `runVolume` (before `InitReplicaFloor`); `core/host/master/store_attestation.go` `GetReplicaStore`, `ReplicaStoreState`; `core/frontend/durable/provider.go` `openOrCreate` (`ErrLostStore`) | `TestRF1HolderOnAWipedStateDirectoryRefusesStoreLost` (`cmd/blockvolume/rf1_store_lost_test.go`, process-level); `TestBlockvolumeAsksTheMasterBeforeCreatingItsStore` (`cmd/blockvolume/lost_store_exit_test.go`); `TestReadReplicaStoreWaitsOnlyWhileTheMasterGivesNoReply` (`cmd/blockvolume/store_record_wait_test.go`); `TestStoreAdmissionCreatesOnlyOnAnExplicitCreatingAnswer` (`cmd/blockvolume/store_admission_test.go`); `TestRF3WipedPrimaryRefusesAndASurvivorServesItsData` (`cmd/blockvolume/rf3_primary_store_lost_test.go`, process-level); `TestGetReplicaStoreAnswersFromTheMastersCreationFact` (`core/host/master/get_replica_store_test.go`); `TestGetReplicaStoreAnswersAReplicatedPrimaryFromItsOwnStore` (`core/host/master/primary_store_answer_test.go`); `TestAnEndedVolumeWithoutItsStoreRefusesAndCreatesNothing` (`core/frontend/durable/lost_store_test.go`) | MasterCreate NoEmptyHeadOverLineage projected onto the holder's local store (mutant RecreateWhenReady, here recreate_when_ended); CreateEvid2 creation fact; KnownZero (walstore has no HEAD to hydrate from). A replicated volume's non-primary replica keeps the peer rebuild: a fresh store has no durable LSN and is not the recorded store, so it never counts as a survivor or a promotion candidate | STUB |
|
||||
| `INV-WS-SERVE-AFTER-OWN-STORE-001` | A new volume's primary acknowledges no write until the master has recorded every initial replica's store, its own included (a single-replica volume waits for its own). So a replica's recorded store precedes every write it acknowledges. | Volume creation: stores awaited, then Serving | `core/host/master/store_attestation.go` `awaited`; `core/host/master/services.go` `assignmentFact`; `core/host/volume/workspace_startup.go` `ReplicaStoresAwaited`; `core/host/volume/projection_bridge.go` `replicaStoresAwaited` | `TestAnRF1PrimaryAwaitsItsOwnStoreBeforeServing` (`core/host/master/primary_store_answer_test.go`); `TestNewVolumeAssignmentWaitsForReplicaAttestations` (`core/host/master/store_record_wait_test.go`); `TestNewVolumePrimaryServesNothingBeforeReplicaAttestations` (`core/host/volume/replica_stores_wait_test.go`) | CreateEvid2: a recorded store may hold acknowledged data, which is what lets `INV-WALSTORE-NO-EMPTY-STORE-001` read a recorded store as creation ended | ACTIVE |
|
||||
| `INV-WS-MASTER-WAIT-001` | Startup waits without a bound while the master gives no reply or refuses credentials or identity; after contact it ends 30 s beyond the later of recovery's first reply or the master barrier. Typed MOVED or DELETED ends it with 78, including a confirmed moved source without an own assignment. | M2 Awaiting assignment → Process exited | `core/host/volume/master_wait.go` `masterWait` (contact from heartbeat, stream and renewal results; the refusal kind from the status detail only); `core/frontend/durable/provider_chunk.go` `chunkAuthorityWait` (`ChunkMasterWait`); `cmd/blockvolume/process_exit.go` `chooseChunkStartupExit`; `core/host/master/workspace_service.go` `leaseRefusal`, `renewalMoved`; `core/authority/workspace.go` `WorkspaceSourceMoved`; `core/host/master/services.go` `SubscribeAssignments`; `core/authority/workspace_lease_view.go` `LeaseBarrierError`; `core/host/volume/workspace_lease.go` `renewDelay` (sleeps until just past the barrier time, jittered, at most 2 min; then a 200 ms poll for 5 s); `core/rpc/link/link.go` `MasterReconnect` | `TestChunkAuthorityWaitStartsAtFirstContact`, `TestLeaseGuardSleepsUntilTheBarrier`, `TestStatusShowsTheMasterWait`, `TestCredentialsRefusedForAnHourWaitsAndLogs`, `TestHeartbeatLogsTheMasterWait`, `TestFlappingMasterNeverExpiresEarly` (`core/host/volume/master_wait_test.go`); `TestMasterLinkReconnectsWithinTwoSeconds` (`core/host/volume/master_reconnect_test.go`); `TestChunkAuthorityWaitFollowsTheMasterWait`, `TestChunkAuthorityWaitPassesItsOwnStart`, `TestChunkGrantedAttachThatKeepsFailingIsBounded`, `TestChunkAuthorityWaitAttachesAGrantOnTheBoundsTick` (`core/frontend/durable/provider_master_wait_test.go`); `TestIdentityRefusalWaitsVisibly`, `TestChunkAuthorityWaitAfterASlowOpenGetsItsFullLimit`, `TestIdentityRefusalEndsAndDecays` (`core/host/volume/master_wait_test.go`); `TestIdentityRefusalEndsOnADeliveredAssignment` (`cmd/blockvolume/process_exit_authority_test.go`); `TestIdentityRefusalIsTyped` (`core/host/master/workspace_lease_refusal_kind_test.go`); `TestLeaseRefusalKinds`, `TestRenewalReplicaMismatchAtOlderLineEpochIsOther` (`core/host/master/workspace_lease_refusal_kind_test.go`); `TestChunkStartupExitFinalGives78`, `TestRestartedMovedSourceExits78WithoutAnOwnLine` (`cmd/blockvolume/process_exit_authority_test.go`); `TestWorkspaceSourceMovedProof`, `TestMovedSourceProofCallers`, `TestMasterWaitFinalSites`, `TestMovedAssignmentStreamIsFinalWithoutAnyOwnAssignment`; also in `core/authority/workspace_source_moved_test.go`, `core/host/master/workspace_moved_source_guard_test.go` | Real systemd moved-source and prestarted-target controls remain qualification gates. | ACTIVE |
|
||||
|
||||
@@ -1529,7 +1529,7 @@ One row per wait in the data and control paths. Guest-visible rows on one path m
|
||||
|
||||
| Site | Waits for | Bound | Owner that ends it | On expiry | Lock held while waiting | Guest-visible |
|
||||
|---|---|---|---|---|---|---|
|
||||
| `cmd/blockvolume/main.go` `runVolume`, `Host.ReplicaStoreRecord` (one call before the durable open of a plain walstore holder) | the master's `GetReplicaStore` answer | `replicaStoreQueryTimeout` (10 s) | the call's own context | exit 75 `store_record_unreadable`, nothing written; the supervisor restarts the unit | none | no (no frontend has started) |
|
||||
| `cmd/blockvolume/store_admission.go` `readReplicaStore` (from `runVolume`, before the durable open of a plain walstore holder) | the master's `GetReplicaStore` answer | none while blockmaster gives no reply (`volume.MasterCallClass`); each read `replicaStoreQueryTimeout` (10 s), reads `replicaStoreRetryEvery` (2 s) apart | the master's answer, or a signal (`processExit.parent`) | none: an answer goes to `decideStoreAdmission` (an unreadable record exits 75 `store_record_unreadable`), nothing written while waiting | none | no (no frontend has started) |
|
||||
| `core/storage/chunk_publish_settled.go` `runPublishSettled` (from `unlockCap`, on the cut or detach caller's goroutine) | the `OnPublishSettled` hook to return | the hook's duration: the hook must return without blocking and without remote calls, enqueueing its work to its own worker | the hook implementer | none: a stalled hook stalls its caller, and later reports queue without a bound (a nil hook queues nothing) | none (`capMu` and `stMu` released) | yes on detach (the detach caller delivers before returning) |
|
||||
| `cmd/blockvolume/frontend_gate.go` `awaitFrontendStart` (from `runVolume`, before any frontend starts) | the backend's first admitted I/O (`StorageBackend.FirstServing`), or the process's stop waiter returning | none of its own: it ends on the stop waiter, which INV-WS-STARTUP-RETRY-001 bounds (a refused or timed-out claim latches exit 75/78) | `runVolume` (`INV-FE-PRIMARY-READY-OPERATIONAL-001`) | no frontend starts; shutdown as after the frontends | none | no (no target listens yet) |
|
||||
| `cmd/blockvolume/frontend_gate.go` `firstAdmitted` (one goroutine from `runVolume`, workspace chunk primaries only) | the backend's first admitted I/O (`FirstServing`), then `AdmitsIO` passing, re-checked every 50 ms (the backend has no projection-change signal) | until first served or the process outcome (`e.done`), whichever comes first | the process exit owner (`superviseProcess`) through `e.done` | none: it ends without starting the frontends | none | no (no target listens yet) |
|
||||
|
||||
@@ -742,6 +742,7 @@ Volume status (`/status?volume=<id>`, heartbeats, cluster status):
|
||||
| What you see | Meaning | What to do |
|
||||
|---|---|---|
|
||||
| `NotReadyReason: lease_not_held`, `MasterWait.Reason: unreachable` | The holder cannot reach blockmaster, so it has no lease and serves nothing. Until its lease expires (about 15-20 s after its last renewal) the old process still reports `Healthy: true`. Then it exits 75 and systemd restarts it 5 s later: the status page is gone for those seconds, the restarted process shows these fields, and the guest reconnects by itself. | Start or reach blockmaster. The volume serves again by itself. |
|
||||
| `NotReadyReason: waiting_for_master` | A plain walstore holder started while blockmaster gives no reply. It waits in the process before it opens or creates its store, writes nothing, and logs the wait every 30 s; the unit stays active and does not restart. | Start or reach blockmaster. The holder opens its store and serves by itself. |
|
||||
| `RecoveryWait: awaiting_authority` (recovery-progress `AwaitingAuthority: true`) | Recovery finished, and the volume waits for blockmaster's assignment. The startup window is paused. | As above. |
|
||||
| `recovery_stalled` | No recovery step completed for a whole startup window. | Look for disk starvation (section 8). The volume serves no I/O and continues once the disk serves it. |
|
||||
| `binary_too_old` | The holder's binary reads an older format than the cluster's, so it gets no assignment. | Upgrade that host to v1.1 (section 7). |
|
||||
|
||||
@@ -33,7 +33,7 @@ The volume's authority and health projection. Go type `volume.StatusProjection`.
|
||||
| `Memory.RSSBytes` | uint64 | resident set size from /proc/self/status (VmRSS); 0 off Linux |
|
||||
| `Memory.AnonymousRSSBytes` | uint64 | anonymous resident memory (RssAnon); 0 off Linux |
|
||||
| `FrontendPrimaryReady` | bool | FrontendPrimaryReady: this replica is the healthy, non-superseded primary, its local durable backend admits I/O, and it may serve guest I/O (INV-FE-PRIMARY-READY-OPERATIONAL-001). |
|
||||
| `NotReadyReason` | string | NotReadyReason says why FrontendPrimaryReady is false, first match: a workspace primary holds no granted lease now (NotReadyLeaseNotHeld); the local durable backend admits no I/O (its evidence: attach pending, fenced, detached) or has no status for the volume; the frontend target is not listening yet; this replica is not the healthy primary. Empty when ready. (omitted when empty) |
|
||||
| `NotReadyReason` | string | NotReadyReason says why FrontendPrimaryReady is false, first match: the start waits for blockmaster to answer before it opens the volume's store (NotReadyWaitingForMaster); a workspace primary holds no granted lease now (NotReadyLeaseNotHeld); the local durable backend admits no I/O (its evidence: attach pending, fenced, detached) or has no status for the volume; the frontend target is not listening yet; this replica is not the healthy primary. Empty when ready. (omitted when empty) |
|
||||
| `AuthorityRole` | string | AuthorityRole is primary, superseded or unknown. |
|
||||
| `ReplicationRole` | string | ReplicationRole is none (a primary), recovering, not_ready, replica_ready or unknown. |
|
||||
| `RoleAdmissionFailure` | string | RoleAdmissionFailure (G1) explains a not-Healthy projection caused by a failed role call on the replica listener; empty otherwise. (omitted when empty) |
|
||||
|
||||
Reference in new issue
Block a user