mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-06 02:57:37 +01:00
fix(block): complete mini startup and cleanup proof
This commit is contained in:
1 parent
14b6e653fa
commit
af7f50945f
6 files changed
+203
-25
No files matched your search
@@ -97,3 +97,12 @@ TestWeedClustersSideBySideKeepTheirOwnFilerCensus
|
||||
# Kubernetes state: a holder on a wiped state directory never comes up empty.
|
||||
TestRF1HolderOnAWipedStateDirectoryRefusesStoreLost
|
||||
TestRF3WipedPrimaryRefusesAndASurvivorServesItsData
|
||||
|
||||
# Non-root mini startup and owned cleanup controls.
|
||||
TestMiniStartsWithoutRootAndNamesItsBinaries
|
||||
TestMiniOwnedGroupCleanupStopsDescendants
|
||||
TestMiniSettledCleanupDoesNotSignal
|
||||
TestMiniCleanupFailStopAndSettlement
|
||||
TestMiniContextAllowsChildShutdownGrace
|
||||
TestMiniLockProofRequiresContention
|
||||
TestMiniHintWordsQuoteSpacesAndQuotes
|
||||
@@ -116,6 +116,10 @@ TAG=v1.1.1
|
||||
curl -fsSLO https://github.com/seaweedfs/seaweed-block/releases/download/$TAG/sw-block-$TAG-linux-amd64.tar.gz
|
||||
curl -fsSLO https://github.com/seaweedfs/seaweed-block/releases/download/$TAG/SHA256SUMS
|
||||
sha256sum -c --ignore-missing SHA256SUMS && tar -xzf sw-block-$TAG-linux-amd64.tar.gz
|
||||
# v1.1.1 prerequisite: its child lookup uses PATH and its lock is host-wide.
|
||||
export PATH="$PWD:$PATH"
|
||||
sudo install -d -m 0755 /run/sw-block
|
||||
sudo install -d -m 0700 -o "$(id -u)" -g "$(id -g)" /run/sw-block/locks
|
||||
./blockvolume --version # must print the tag's commit
|
||||
./sw-block mini --dir ./swb-mini --weed /path/to/weed
|
||||
```
|
||||
|
||||
@@ -24,6 +24,11 @@ func TestMiniStartsWithoutRootAndNamesItsBinaries(t *testing.T) {
|
||||
if weed == "" {
|
||||
t.Fatal("CHUNKSTORE_WEED must name the pinned real SeaweedFS binary")
|
||||
}
|
||||
var err error
|
||||
weed, err = filepath.Abs(weed)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
bins := os.Getenv("SWBLOCK_TEST_BINS")
|
||||
if bins == "" {
|
||||
bins = t.TempDir()
|
||||
@@ -31,6 +36,10 @@ func TestMiniStartsWithoutRootAndNamesItsBinaries(t *testing.T) {
|
||||
miniGoBuild(t, filepath.Join(bins, b), "github.com/seaweedfs/seaweed-block/cmd/"+b)
|
||||
}
|
||||
}
|
||||
bins, err = filepath.Abs(bins)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
cli := filepath.Join(bins, "sw-block")
|
||||
shift := 3000 + (os.Getpid()*13)%6000
|
||||
dir := filepath.Join(t.TempDir(), "mini")
|
||||
@@ -48,7 +57,7 @@ func TestMiniStartsWithoutRootAndNamesItsBinaries(t *testing.T) {
|
||||
}
|
||||
// The running line precedes the hints; await the last hint without reading
|
||||
// a buffer concurrently with its writer.
|
||||
for !strings.Contains(p.output.String(), weed+" shell -master=") {
|
||||
for !strings.Contains(p.output.String(), miniHintWord(weed)+" shell -master=") {
|
||||
select {
|
||||
case <-p.done:
|
||||
t.Fatalf("mini exited before its hints: %s", p.output.String())
|
||||
@@ -57,7 +66,12 @@ func TestMiniStartsWithoutRootAndNamesItsBinaries(t *testing.T) {
|
||||
case <-time.After(20 * time.Millisecond):
|
||||
}
|
||||
}
|
||||
_ = p.cmd.Process.Signal(syscall.SIGINT)
|
||||
if err := miniLockConflict(filepath.Join(dir, "locks", "v1.lock")); err != nil {
|
||||
t.Fatalf("serving holder does not own its trial lock: %v", err)
|
||||
}
|
||||
if err := p.signalLeader(syscall.SIGINT); err != nil {
|
||||
t.Fatalf("could not deliver Ctrl-C: %v", err)
|
||||
}
|
||||
if err := p.join(t, 40*time.Second); err != nil {
|
||||
t.Fatalf("mini after Ctrl-C: %v\n%s", err, p.output.String())
|
||||
}
|
||||
@@ -70,7 +84,7 @@ func TestMiniStartsWithoutRootAndNamesItsBinaries(t *testing.T) {
|
||||
if strings.Contains(text, "+ sw-block ") || strings.Contains(text, " sw-block ") {
|
||||
t.Errorf("mini prints a sw-block command without its absolute path")
|
||||
}
|
||||
for _, want := range []string{" " + cli + " ops workspace show", " " + cli + " ops chunk snapshot", weed + " shell -master=", "mini takes no scheduled snapshot", cli + " mini --dir "} {
|
||||
for _, want := range []string{" " + miniHintWord(cli) + " ops workspace show", " " + miniHintWord(cli) + " ops chunk snapshot", miniHintWord(weed) + " shell -master=", "mini takes no scheduled snapshot", miniHintWord(cli) + " mini --dir "} {
|
||||
if !strings.Contains(text, want) {
|
||||
t.Errorf("mini's output lacks %q", want)
|
||||
}
|
||||
@@ -90,10 +104,10 @@ func TestMiniStartsWithoutRootAndNamesItsBinaries(t *testing.T) {
|
||||
ctx2, cancel2 := context.WithTimeout(context.Background(), 3*time.Minute)
|
||||
defer cancel2()
|
||||
p2 := startOwnedMini(t, ctx2, cli, "mini", "--dir", dir2, "--bin", broken, "--weed", weed, "--port-shift", fmt.Sprint(shift+1))
|
||||
err := p2.join(t, 3*time.Minute+10*time.Second)
|
||||
err = p2.join(t, 3*time.Minute+miniShutdownGrace+10*time.Second)
|
||||
b2 := p2.output.String()
|
||||
t.Logf("failed start:\n%s", b2)
|
||||
if err == nil || !strings.Contains(b2, "start again on it with") || !strings.Contains(b2, cli+" mini --dir "+dir2+" --reuse") {
|
||||
if err == nil || !strings.Contains(b2, "start again on it with") || !strings.Contains(b2, miniHintWord(cli)+" mini --dir "+miniHintWord(dir2)+" --reuse") {
|
||||
t.Fatalf("a failed start: %v", err)
|
||||
}
|
||||
for _, binary := range []string{weed, filepath.Join(broken, "blockmaster"), filepath.Join(broken, "blockvolume")} {
|
||||
@@ -110,7 +124,7 @@ func miniGoBuild(t *testing.T, out, pkg string) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute)
|
||||
defer cancel()
|
||||
p := startOwnedMini(t, ctx, "go", "build", "-o", out, pkg)
|
||||
if err := p.join(t, 3*time.Minute+10*time.Second); err != nil {
|
||||
if err := p.join(t, 3*time.Minute+miniShutdownGrace+10*time.Second); err != nil {
|
||||
t.Fatalf("build %s: %v\n%s", pkg, err, p.output.String())
|
||||
}
|
||||
p.assertStopped(t)
|
||||
@@ -121,3 +135,58 @@ func exists(p string) bool {
|
||||
_, err := os.Stat(p)
|
||||
return err == nil
|
||||
}
|
||||
|
||||
// Expected command words follow the printed POSIX-shell contract.
|
||||
func miniHintWord(s string) string {
|
||||
if s != "" && strings.Trim(s, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@%+=:,./_-") == "" {
|
||||
return s
|
||||
}
|
||||
return "'" + strings.ReplaceAll(s, "'", `'\''`) + "'"
|
||||
}
|
||||
|
||||
func miniLockConflict(path string) error {
|
||||
f, err := os.Open(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
err = syscall.Flock(int(f.Fd()), syscall.LOCK_EX|syscall.LOCK_NB)
|
||||
if err == syscall.EWOULDBLOCK || err == syscall.EAGAIN {
|
||||
return nil
|
||||
}
|
||||
if err == nil {
|
||||
_ = syscall.Flock(int(f.Fd()), syscall.LOCK_UN)
|
||||
return fmt.Errorf("lock was available")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func TestMiniLockProofRequiresContention(t *testing.T) {
|
||||
path := filepath.Join(t.TempDir(), "v1.lock")
|
||||
f, err := os.Create(path)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer f.Close()
|
||||
if err := miniLockConflict(path); err == nil {
|
||||
t.Fatal("unheld file passed the serving-lock proof")
|
||||
}
|
||||
if err := syscall.Flock(int(f.Fd()), syscall.LOCK_EX|syscall.LOCK_NB); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := miniLockConflict(path); err != nil {
|
||||
t.Fatalf("held lock failed proof: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMiniHintWordsQuoteSpacesAndQuotes(t *testing.T) {
|
||||
for _, row := range []struct{ path, want string }{
|
||||
{"/tmp/bin/sw-block", "/tmp/bin/sw-block"},
|
||||
{"/tmp/bin with space/sw-block", "'/tmp/bin with space/sw-block'"},
|
||||
{"/tmp/it's/weed", `'/tmp/it'\''s/weed'`},
|
||||
} {
|
||||
if got := miniHintWord(row.path); got != row.want {
|
||||
t.Fatalf("%q: got %q want %q", row.path, got, row.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,16 @@ func assertMiniUnprivileged(t *testing.T) {
|
||||
t.Fatal("non-root qualification must run without uid 0")
|
||||
}
|
||||
p := "/run/sw-block/locks"
|
||||
// A read-only existing file can still be flocked without a directory write.
|
||||
// Refuse qualification if it can even be opened; never mutate the host path.
|
||||
lock, err := os.Open(filepath.Join(p, "v1.lock"))
|
||||
if err == nil {
|
||||
_ = lock.Close()
|
||||
t.Fatal("existing host lock is readable; old host-lock path is usable")
|
||||
}
|
||||
if !errors.Is(err, os.ErrNotExist) && !errors.Is(err, syscall.EACCES) && !errors.Is(err, syscall.EPERM) {
|
||||
t.Fatalf("host lock file preflight: %v", err)
|
||||
}
|
||||
for {
|
||||
_, err := os.Stat(p)
|
||||
if err == nil {
|
||||
@@ -81,32 +91,47 @@ type ownedMini struct {
|
||||
leaderKey string
|
||||
dispatches atomic.Int64
|
||||
// Only the isolated fail-stop controls replace the census or its window.
|
||||
census func() []int
|
||||
censusWait time.Duration
|
||||
groupExists func() bool
|
||||
census func() []int
|
||||
censusWait time.Duration
|
||||
}
|
||||
|
||||
// Open the leader pidfd before starting Wait: even an already-exited child is
|
||||
// still unreaped here, so its numeric PID cannot have been reused.
|
||||
const miniShutdownGrace = 35 * time.Second // three 10-second child stops plus margin
|
||||
|
||||
// Probe before starting any workload. CLONE_PIDFD then obtains the child's
|
||||
// immutable reference atomically with creation, before a cancellation can run.
|
||||
func miniPidfdSupport() error {
|
||||
fd, err := unix.PidfdOpen(os.Getpid(), 0)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer unix.Close(fd)
|
||||
return unix.PidfdSendSignal(fd, 0, nil, 0)
|
||||
}
|
||||
func startOwnedMini(t *testing.T, ctx context.Context, bin string, args ...string) *ownedMini {
|
||||
t.Helper()
|
||||
if err := miniPidfdSupport(); err != nil {
|
||||
t.Fatalf("pidfd ownership unavailable before start: %v", err)
|
||||
}
|
||||
p := &ownedMini{cmd: exec.CommandContext(ctx, bin, args...), done: make(chan struct{}), leaderFD: -1}
|
||||
p.cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
|
||||
p.cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true, PidFD: &p.leaderFD}
|
||||
p.cmd.Stdout, p.cmd.Stderr = &p.output, &p.output
|
||||
p.cmd.WaitDelay = 3 * time.Second
|
||||
p.cmd.Cancel = func() error { return p.signalLeader(unix.SIGTERM) }
|
||||
// os/exec must not kill only the leader after a short WaitDelay. Our
|
||||
// watchdog grants the full product shutdown window, then owns group cleanup.
|
||||
p.cmd.Cancel = func() error { go p.stop(t); return nil }
|
||||
p.mu.Lock() // a context cancellation cannot observe the unopened pidfd
|
||||
if err := p.cmd.Start(); err != nil {
|
||||
p.mu.Unlock()
|
||||
t.Fatal(err)
|
||||
}
|
||||
fd, err := unix.PidfdOpen(p.cmd.Process.Pid, 0)
|
||||
if err != nil {
|
||||
miniFailStop(t, fmt.Sprintf("cannot own leader incarnation: %v", err))
|
||||
if p.leaderFD < 0 {
|
||||
p.mu.Unlock()
|
||||
p.ownershipFailed(t, "atomic leader pidfd missing")
|
||||
}
|
||||
p.leaderFD = fd
|
||||
info, err := miniProc(p.cmd.Process.Pid)
|
||||
if err != nil {
|
||||
miniFailStop(t, fmt.Sprintf("cannot record leader incarnation: %v", err))
|
||||
p.mu.Unlock()
|
||||
p.ownershipFailed(t, fmt.Sprintf("cannot record leader incarnation: %v", err))
|
||||
}
|
||||
p.leaderKey = info.key
|
||||
p.mu.Unlock()
|
||||
@@ -114,7 +139,26 @@ func startOwnedMini(t *testing.T, ctx context.Context, bin string, args ...strin
|
||||
t.Cleanup(func() { p.stop(t) })
|
||||
return p
|
||||
}
|
||||
|
||||
// No Wait goroutine exists yet: the unreaped direct child cannot have its
|
||||
// PID recycled. Stop and reap it before failing closed with directories kept.
|
||||
func (p *ownedMini) ownershipFailed(t *testing.T, why string) {
|
||||
_ = p.cmd.Process.Kill()
|
||||
p.cmd.WaitDelay = time.Second
|
||||
reaped := make(chan struct{})
|
||||
go func() { _ = p.cmd.Wait(); close(reaped) }()
|
||||
select {
|
||||
case <-reaped:
|
||||
case <-time.After(5 * time.Second):
|
||||
}
|
||||
miniFailStop(t, why)
|
||||
}
|
||||
func (p *ownedMini) signalFD(fd int, sig unix.Signal) error {
|
||||
p.mu.Lock()
|
||||
defer p.mu.Unlock()
|
||||
if p.settled {
|
||||
return os.ErrProcessDone
|
||||
}
|
||||
p.dispatches.Add(1)
|
||||
return unix.PidfdSendSignal(fd, sig, nil, 0)
|
||||
}
|
||||
@@ -124,7 +168,8 @@ func (p *ownedMini) signalLeader(sig unix.Signal) error {
|
||||
if p.settled {
|
||||
return os.ErrProcessDone
|
||||
}
|
||||
return p.signalFD(p.leaderFD, sig)
|
||||
p.dispatches.Add(1)
|
||||
return unix.PidfdSendSignal(p.leaderFD, sig, nil, 0)
|
||||
}
|
||||
func (p *ownedMini) isSettled() bool { p.mu.Lock(); defer p.mu.Unlock(); return p.settled }
|
||||
func (p *ownedMini) settle() {
|
||||
@@ -148,7 +193,21 @@ func (p *ownedMini) join(t *testing.T, bound time.Duration) error {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
func (p *ownedMini) stop(t *testing.T) { p.stopOnce.Do(func() { p.stopGroup(t) }) }
|
||||
func (p *ownedMini) stop(t *testing.T) {
|
||||
p.stopOnce.Do(func() {
|
||||
if p.isSettled() {
|
||||
return
|
||||
}
|
||||
_ = p.signalLeader(unix.SIGTERM)
|
||||
select {
|
||||
case <-p.done:
|
||||
p.assertStopped(t)
|
||||
return
|
||||
case <-time.After(miniShutdownGrace):
|
||||
}
|
||||
p.stopGroup(t)
|
||||
})
|
||||
}
|
||||
|
||||
// Never signal a numeric PGID. While the original leader is stopped, its
|
||||
// group identity cannot disappear; capture and stop each member by pidfd.
|
||||
@@ -262,7 +321,17 @@ func (p *ownedMini) assertStopped(t *testing.T) {
|
||||
} else {
|
||||
live = miniGroupLive(t, p.cmd.Process.Pid)
|
||||
}
|
||||
if len(live) == 0 {
|
||||
// A /proc listing is not atomic: a member can fork then disappear
|
||||
// between list and stat. Signal 0 is only an existence query (never a
|
||||
// numeric effect signal); ESRCH proves the entire group is now absent.
|
||||
absent := false
|
||||
if p.groupExists != nil {
|
||||
absent = !p.groupExists()
|
||||
} else {
|
||||
err := unix.Kill(-p.cmd.Process.Pid, 0)
|
||||
absent = errors.Is(err, unix.ESRCH)
|
||||
}
|
||||
if len(live) == 0 && absent {
|
||||
select {
|
||||
case <-p.done:
|
||||
p.settle()
|
||||
@@ -375,7 +444,7 @@ func TestMiniSettledCleanupDoesNotSignal(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMiniCleanupFailStopAndSettlement(t *testing.T) {
|
||||
for _, mode := range []string{"join", "residue", "settled"} {
|
||||
for _, mode := range []string{"join", "residue", "missed-member", "settled"} {
|
||||
t.Run(mode, func(t *testing.T) {
|
||||
marker := filepath.Join(t.TempDir(), "cleanup-ran")
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
@@ -413,7 +482,7 @@ func TestMiniCleanupFailStopHelper(t *testing.T) {
|
||||
t.Error(err)
|
||||
}
|
||||
})
|
||||
p := &ownedMini{done: make(chan struct{}), leaderFD: -1, censusWait: 10 * time.Millisecond}
|
||||
p := &ownedMini{done: make(chan struct{}), leaderFD: -1, censusWait: 10 * time.Millisecond, groupExists: func() bool { return false }}
|
||||
switch mode {
|
||||
case "join":
|
||||
p.join(t, 10*time.Millisecond)
|
||||
@@ -421,6 +490,11 @@ func TestMiniCleanupFailStopHelper(t *testing.T) {
|
||||
close(p.done)
|
||||
p.census = func() []int { return []int{1234} }
|
||||
p.assertStopped(t)
|
||||
case "missed-member":
|
||||
close(p.done)
|
||||
p.census = func() []int { return nil }
|
||||
p.groupExists = func() bool { return true }
|
||||
p.assertStopped(t)
|
||||
case "settled":
|
||||
close(p.done)
|
||||
p.census = func() []int { return nil }
|
||||
@@ -429,3 +503,24 @@ func TestMiniCleanupFailStopHelper(t *testing.T) {
|
||||
t.Fatal("invalid control")
|
||||
}
|
||||
}
|
||||
|
||||
// A four-second shutdown exceeds the old WaitDelay. The context watchdog
|
||||
// must let it finish rather than kill its leader before children are stopped.
|
||||
func TestMiniContextAllowsChildShutdownGrace(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
p := startOwnedMini(t, ctx, "/bin/sh", "-c", "trap 'sleep 4; echo graceful; exit 0' TERM; echo ready; while :; do sleep .05; done")
|
||||
deadline := time.Now().Add(5 * time.Second)
|
||||
for !strings.Contains(p.output.String(), "ready") {
|
||||
if time.Now().After(deadline) {
|
||||
t.Fatal("shutdown fixture not ready")
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
}
|
||||
cancel()
|
||||
_ = p.join(t, miniShutdownGrace+10*time.Second)
|
||||
p.assertStopped(t)
|
||||
if !strings.Contains(p.output.String(), "graceful") {
|
||||
t.Fatalf("shutdown killed prematurely: %s", p.output.String())
|
||||
}
|
||||
}
|
||||
@@ -292,6 +292,7 @@ func (r *miniRun) start(name, bin string, args []string) (*miniChild, error) {
|
||||
}
|
||||
cmd := exec.Command(bin, args...)
|
||||
cmd.Stdout, cmd.Stderr, cmd.Stdin = lf, lf, nil
|
||||
cmd.Env = []string{}
|
||||
// mini's children are not systemd units even when mini runs under one;
|
||||
// blockvolume refuses mini's lock directory while INVOCATION_ID is set.
|
||||
for _, kv := range os.Environ() {
|
||||
|
||||
@@ -392,7 +392,7 @@ stateDiagram-v2
|
||||
| StopPending | StopPending | each sleep after a completed renewal is at most `stopPendingPoll` (250 ms); a renewal already in flight is not interrupted | `core/host/volume/workspace_lease.go` `renewDelay`, `Run` | `INV-WS-STOP-PENDING-001` |
|
||||
| StopPending | Valid | only the latest detach attempt, provably not applied, with serving resumed; an applied, fenced or unknown outcome, or an older attempt's resume, leaves StopPending | `core/frontend/durable/provider_chunk.go` `resumeAfterDetach`; `core/host/volume/workspace_runtime.go` `WorkspaceStopResumed`; `core/host/volume/workspace_lease.go` `ClearStopPending` | `INV-WS-STOP-PENDING-001` |
|
||||
| Fenced | Drained, Acked | the stop callback succeeded; only then, and only when revoked, the acknowledgement is sent; a call that got no answer (`DeadlineExceeded`, `Unavailable`) is made again until the lease deadline, any other answer is final | `core/host/volume/workspace_lease.go` `drain`, `retryableAckError` | `INV-WS-REVOKE-ACK-001`, `INV-WS-REVOKE-ACK-RETRY-001` |
|
||||
| (start) | Attaching, Refused | the volume's host lock `/run/sw-block/locks/<volume id>.lock` is taken before the store opens; held by another live process, or its directory or file cannot be created or opened, refuses (`storage.ErrWALStoreLocked`, `ErrVolumeLockDirUnavailable`) | `core/frontend/durable/provider.go` `DurableProvider.lockVolumeOnHost` (from `ensureHandle`) | `INV-WS-ONE-PROCESS-PER-HOST-001` |
|
||||
| (start) | Attaching, Refused | normal starts take the volume's host lock `/run/sw-block/locks/<volume id>.lock` before the store opens (isolated non-systemd mini trials instead use their own `--dir/locks`); held by another live process, or its directory or file cannot be created or opened, refuses (`storage.ErrWALStoreLocked`, `ErrVolumeLockDirUnavailable`) | `core/frontend/durable/provider.go` `DurableProvider.lockVolumeOnHost` (from `ensureHandle`) | `INV-WS-ONE-PROCESS-PER-HOST-001` |
|
||||
| Attaching | Refused | a local root from another claim or behind HEAD's position (`layout.ErrStaleLocalRoot`): final typed refusal with a cure, no serving or retry | `core/frontend/durable/provider_layout.go` `startLayoutRoot`; `provider_chunk.go` `recoverChunk`, `chunkAuthorityWait` | `INV-WS-STALE-LOCAL-ROOT-001` |
|
||||
| (startup) | Refused | The agreed leader lists another filer or several; or all configured masters cannot agree and confirm exactly the target within 60 s (`ErrNotSingleFiler`) | `core/frontend/chunkstore/single_filer.go` `CheckSingleFiler`; `cmd/blockvolume/chunk_remote.go` `newChunkWiring` | `INV-WS-SINGLE-FILER-001` |
|
||||
| (startup) | (startup), chunk guard on or off | on only if the filer definitely refuses the probe's mismatched chunk-condition update of a disposable HEAD; then every store the catalog opens sends the chunk condition. Any other answer leaves it off (page re-read only) and refuses nothing. sw-block metadata writers run the same probe within their --timeout | `core/frontend/chunkstore/startup_head_probe.go` `checkConditionalHead`, `probeChunkCondition`, `ProbeChunkGuard`; `cmd/sw-block/chunk_b.go` `bCatalog` | `INV-WS-CHUNK-CONDITION-PROBE-001` |
|
||||
@@ -1096,7 +1096,7 @@ Notes:
|
||||
| `INV-WS-CLAIM-BEFORE-SERVE-001` | A new B holder claims HEAD at its issued epoch only after the local root is validated against the HEAD it updates; an older epoch or another holder at the same epoch is refused, and guest writes stay closed until assignment and claim. | M9 Start → Claim → Serving | `core/frontend/chunkstore/layout/start.go` `Start`; `core/frontend/durable/provider_layout.go` `startLayoutRoot` | `TestStart_ValidatesAgainstTheHeadItUpdates`, `TestStart_Refusals` (`core/frontend/chunkstore/layout/start_test.go`); `TestStart_TheClaimRechecksTheSeedRule` (`core/frontend/chunkstore/layout/start_seed_test.go`); `TestFreshStoreRefusesWriteBeforeAssignmentThenPublishesAfterClaim` (`core/frontend/durable/provider_restore_schedule_test.go`) | `INV-SNAPK-START-LINEAGE-001`, `INV-SNAPK-START-CLAIM-001` | ACTIVE |
|
||||
| `INV-VOL-GEOMETRY-FLAGS-RECORD-001` | A create-mode start whose `--durable-blocks`/`--durable-blocksize` disagree with the volume record exits 78 before any local store exists; an existing store is checked only at attach; an absent record keeps the create path; an unread record exits 75 (filer failed) or 78 (corrupt). | blockvolume startup (before the durable provider) | `cmd/blockvolume/main.go`; `cmd/blockvolume/chunk_remote.go` `geometryFlagsRefusal`; `core/frontend/chunkstore/layout/volume.go`, `start.go`, `create.go`; `core/frontend/chunkstore/catalog_b.go` | `TestGeometryFlagsRefusalComparesTheRecord`, `TestVolumeRequiresGeometry`, `TestVolumeGeometryChecksAndIsImmutable`, `TestStartGeometryMismatchPrecedesClaim`, `TestBCatalogRestoreCopiesVolumeGeometry`, `TestVolumeGeometryLivesOnlyInVolume` | K3: immutable required VOLUME geometry; Start checks the local persisted shape before claim; restores copy source geometry; no resize or compatibility path. | ACTIVE |
|
||||
| `INV-WS-STALE-LOCAL-ROOT-001` | An old or rolled-back local root is refused by `layout.Start` before serving; synchronous and deferred attach end without retry and report the typed stale-root error and cure. A fresh root at its own epoch likewise ends with `ErrMissingLocalRoot` and its cure. | M4 Claiming → Refused | `core/frontend/durable/provider_layout.go` `startLayoutRoot`; `core/frontend/durable/provider_chunk.go` `recoverChunk`, `chunkAuthorityWait`; `core/frontend/durable/provider_startup.go` `endChunkStartup` | `TestLayoutProviderRefusesEmptyOwnEpochAndRemountedOldRoot`, `TestFinalLayoutStartRefusalTable` (`core/frontend/durable/provider_layout_test.go`, `provider_layout_start_class_test.go`) | — | ACTIVE |
|
||||
| `INV-WS-ONE-PROCESS-PER-HOST-001` | One host runs at most one live blockvolume per volume: each takes the volume's exclusive host lock before its store opens and holds it until the store closes; a second is refused before it opens anything, whatever its `--durable-root`. | M4 (start) → Attaching, Refused | `core/frontend/durable/provider.go` `DurableProvider.lockVolumeOnHost` | `TestOneLiveProcessPerVolumePerHost`, `TestHostVolumeLockDirectoryCreatedOrRefused`, `TestHostVolumeLockRefusesNonDirectoryLockPath`, `TestHostVolumeLockTakesReadOnlyLockFile` (`core/frontend/durable/one_process_per_volume_test.go`); `TestHostVolumeLockCreatesParent0755AndLocks0700`, `TestHostVolumeLockKeepsExistingDirectoryModes` (`core/frontend/durable/volume_lock_parent_mode_test.go`); `TestVolumeLockDirTestOnlyRefusedUnderSystemd` (`cmd/blockvolume/volume_lock_flag_test.go`) | — | ACTIVE |
|
||||
| `INV-WS-ONE-PROCESS-PER-HOST-001` | Normal starts hold one exclusive host lock per volume until store close, refusing a second before store open regardless of --durable-root. Mini's non-systemd test override locks within its trial directory only; normal and systemd starts retain host-wide exclusion. | M4 (start) → Attaching, Refused | `core/frontend/durable/provider.go` `DurableProvider.lockVolumeOnHost` | `TestOneLiveProcessPerVolumePerHost`, `TestHostVolumeLockDirectoryCreatedOrRefused`, `TestHostVolumeLockRefusesNonDirectoryLockPath`, `TestHostVolumeLockTakesReadOnlyLockFile` (`core/frontend/durable/one_process_per_volume_test.go`); `TestHostVolumeLockCreatesParent0755AndLocks0700`, `TestHostVolumeLockKeepsExistingDirectoryModes` (`core/frontend/durable/volume_lock_parent_mode_test.go`); `TestVolumeLockDirTestOnlyRefusedUnderSystemd` (`cmd/blockvolume/volume_lock_flag_test.go`) | — | ACTIVE |
|
||||
| `INV-CHUNK-LEASE-REQUIRED-001` | Blockvolume refuses walstore-chunk startup without --workspace-lease before any host or store is opened. The refusal names concurrent acknowledging writers and acknowledged-write loss after a forced move; plain walstore startup is unchanged. | M4 startup → Refused | `cmd/blockvolume/main.go` `parseFlags` | `TestChunkVolumeRequiresWorkspaceLeaseBeforeStart` | — | ACTIVE |
|
||||
| `INV-WS-CONDITIONAL-HEAD-001` | Catalog startup requires a wrong-generation conditional update of a disposable HEAD to be definitely refused and leave its bytes and generation unchanged. Unknown probe outcomes refuse admission; cleanup failures only warn with the leftover path. No volume HEAD is used. | M4 startup → Refused | `core/frontend/chunkstore/swfs_catalog.go` `DialBCatalog`; `startup_head_probe.go` `checkConditionalHead` | `TestCatalogStartupRequiresWrongGenerationHeadRefusal`, `TestConditionalHeadNextStartCleansCrashLeftovers`, `TestConditionalHeadSweepWaitsAndLeavesNewProbes`, `TestCatalogStartupDoesNotWaitForUndeletableProbe`, `TestLayoutIdentityWriterAndReaders` | — | ACTIVE |
|
||||
| `INV-WS-CHUNK-CONDITION-PROBE-001` | Catalog startup and sw-block metadata writers turn the chunk guard on only if the filer definitely refuses a mismatched chunk-condition update of a disposable HEAD; any other answer leaves the page re-read as the only check. No version string is read; the startup log and /status/chunk name it. | M4 startup | `core/frontend/chunkstore/startup_head_probe.go` `probeChunkCondition`, `ProbeChunkGuard`; `catalog_b.go` `Store`, `MetadataGuard`, `Usage`; `cmd/sw-block/chunk_b.go` `bCatalog` | `TestTheStartupProbeTurnsTheChunkGuardOnOnlyForAFilerThatEnforcesIt` (`core/frontend/chunkstore/startup_chunk_condition_probe_test.go`), `TestAFailedChunkGuardProbeLeavesTheGuardOff` (`core/frontend/chunkstore/chunk_guard_report_test.go`), `TestCatalogStartupRequiresWrongGenerationHeadRefusal` (`core/frontend/chunkstore/startup_head_probe_test.go`), `TestStatusServer_StatusChunkUsage` (`core/host/volume/status_chunk_test.go`), `TestOpsChunkWritingCatalogRunsTheChunkConditionProbe`, `TestOpsChunkWritingCatalogProbeIsBoundedByTheTimeout` (`cmd/sw-block/chunk_guard_probe_test.go`) | MetaABA r2, checked outside the repository: guard on = `safe_chunks_equal`; the fallback is the re-read, which a chunk still queued for deletion defeats (`mut_reread_delayed`) | ACTIVE |
|
||||
|
||||
Reference in new issue
Block a user