mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-06 02:57:37 +01:00
Merge current master and document state filesystem isolation
This commit is contained in:
commit
960a914281
24 files changed
+601
-38
No files matched your search
@@ -9,6 +9,7 @@ on:
|
||||
- 'weed/storage/volume_vacuum*.go'
|
||||
- 'weed/storage/volume_loading.go'
|
||||
- 'weed/storage/disk_location.go'
|
||||
- 'weed/server/filer_grpc_server_rename.go'
|
||||
- 'test/winfsp/**'
|
||||
- '.github/workflows/mount-windows.yml'
|
||||
# No base branch filter: this is the only thing that runs the Windows mount,
|
||||
@@ -20,6 +21,7 @@ on:
|
||||
- 'weed/storage/volume_vacuum*.go'
|
||||
- 'weed/storage/volume_loading.go'
|
||||
- 'weed/storage/disk_location.go'
|
||||
- 'weed/server/filer_grpc_server_rename.go'
|
||||
- 'test/winfsp/**'
|
||||
- '.github/workflows/mount-windows.yml'
|
||||
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
name: "release: bump version and cut the release"
|
||||
|
||||
# One entry point for a SeaweedFS release:
|
||||
# 1. bump MAJOR/MINOR in constants.go and the Helm Chart.yaml, commit to master
|
||||
# 1. bump MAJOR/MINOR in constants.go and the Helm Chart.yaml, point the
|
||||
# chart's cosi.image at the newest COSI driver release, commit to master
|
||||
# 2. push the <appVersion> tag, which fans out to the workflows that trigger on
|
||||
# `push: tags` (binaries_release*, container_release_unified, helm_manual_release)
|
||||
# 3. create the GitHub release, with GitHub's generated notes
|
||||
# 4. dispatch "Prepare release" in seaweedfs-csi-driver and seaweedfs-operator,
|
||||
# which pick up the new master through `go get -u`, and wait for both
|
||||
# 4. dispatch "Prepare release" in seaweedfs-csi-driver, seaweedfs-operator and
|
||||
# seaweedfs-cosi-driver, which pick up the new master through `go get`, and
|
||||
# wait for all three. The COSI driver image cut here reaches the chart at
|
||||
# the next release, through step 1.
|
||||
#
|
||||
# Events raised by the default GITHUB_TOKEN do not start other workflows, and it
|
||||
# cannot reach the other two repositories at all. Add a repo secret RELEASE_PAT
|
||||
# with `contents: write` here and `actions: write` on the csi-driver and operator
|
||||
# repos. Without it the tag is still pushed, but nothing downstream of it runs.
|
||||
# cannot reach the other repositories at all. Add a repo secret RELEASE_PAT
|
||||
# with `contents: write` here and `actions: write` on the csi-driver, operator
|
||||
# and cosi-driver repos. Without it the tag is still pushed, but nothing
|
||||
# downstream of it runs.
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
@@ -28,7 +32,7 @@ on:
|
||||
type: string
|
||||
required: false
|
||||
downstream:
|
||||
description: "Also release the CSI driver and the operator"
|
||||
description: "Also release the CSI driver, the operator and the COSI driver"
|
||||
type: boolean
|
||||
default: true
|
||||
dry_run:
|
||||
@@ -134,6 +138,43 @@ jobs:
|
||||
sed -i -E "s/^version:.*/version: ${CHART_VERSION}/" "$CHART"
|
||||
cat "$CHART"
|
||||
|
||||
- name: Point the chart at the newest COSI driver release
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
REPO: seaweedfs/seaweedfs-cosi-driver
|
||||
run: |
|
||||
set -euo pipefail
|
||||
VALUES=k8s/charts/seaweedfs/values.yaml
|
||||
IMAGE="ghcr.io/${REPO}"
|
||||
CUR=$(grep -oP "^ image: \"${IMAGE}:\K[^\"]+" "$VALUES" || true)
|
||||
if [ -z "$CUR" ]; then
|
||||
echo "::warning::no ${IMAGE} image line in ${VALUES}; cosi.image is left alone"
|
||||
exit 0
|
||||
fi
|
||||
# Not worth failing a release over: keep the current image instead.
|
||||
if ! NEW=$(timeout 60 gh release view -R "$REPO" --json tagName --jq .tagName); then
|
||||
echo "::warning::could not read the latest ${REPO} release; cosi.image stays ${CUR}"
|
||||
exit 0
|
||||
fi
|
||||
if [ "$NEW" = "$CUR" ]; then
|
||||
echo "cosi.image is already ${CUR}"
|
||||
exit 0
|
||||
fi
|
||||
if [ "$(printf '%s\n%s\n' "${CUR#v}" "${NEW#v}" | sort -V | tail -n1)" != "${NEW#v}" ]; then
|
||||
echo "::warning::the latest ${REPO} release ${NEW} is older than ${CUR}; cosi.image stays ${CUR}"
|
||||
exit 0
|
||||
fi
|
||||
# A release without its image would break every chart install with cosi.enabled.
|
||||
TOKEN=$(curl -sf --connect-timeout 10 --max-time 30 "https://ghcr.io/token?scope=repository:${REPO}:pull" | jq -r .token || true)
|
||||
if ! curl -sfI -o /dev/null --connect-timeout 10 --max-time 30 -H "Authorization: Bearer ${TOKEN}" \
|
||||
-H 'Accept: application/vnd.oci.image.index.v1+json, application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.oci.image.manifest.v1+json, application/vnd.docker.distribution.manifest.v2+json' \
|
||||
"https://ghcr.io/v2/${REPO}/manifests/${NEW}"; then
|
||||
echo "::warning::${IMAGE}:${NEW} is not pullable; cosi.image stays ${CUR}"
|
||||
exit 0
|
||||
fi
|
||||
sed -i -E "s|^( image: \"${IMAGE}:)[^\"]+\"|\1${NEW}\"|" "$VALUES"
|
||||
grep -n "^ image: \"${IMAGE}:" "$VALUES"
|
||||
|
||||
- name: Commit, and push the tag
|
||||
id: tag
|
||||
env:
|
||||
@@ -156,7 +197,7 @@ jobs:
|
||||
if git diff --quiet; then
|
||||
echo "::warning::Version files are already at ${TAG}; tagging the current HEAD."
|
||||
else
|
||||
git add weed/util/version/constants.go k8s/charts/seaweedfs/Chart.yaml
|
||||
git add weed/util/version/constants.go k8s/charts/seaweedfs/Chart.yaml k8s/charts/seaweedfs/values.yaml
|
||||
git commit -m "${TAG}"
|
||||
git push
|
||||
fi
|
||||
@@ -187,14 +228,20 @@ jobs:
|
||||
include:
|
||||
- repo: seaweedfs/seaweedfs-csi-driver
|
||||
workflow: prepare_release.yaml
|
||||
ref: master
|
||||
- repo: seaweedfs/seaweedfs-operator
|
||||
workflow: prepare_release.yml
|
||||
ref: master
|
||||
- repo: seaweedfs/seaweedfs-cosi-driver
|
||||
workflow: prepare_release.yaml
|
||||
ref: main
|
||||
steps:
|
||||
- name: Release ${{ matrix.repo }}
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.RELEASE_PAT }}
|
||||
REPO: ${{ matrix.repo }}
|
||||
WORKFLOW: ${{ matrix.workflow }}
|
||||
REF: ${{ matrix.ref }}
|
||||
SHA: ${{ needs.release.outputs.sha }}
|
||||
MODULE: github.com/seaweedfs/seaweedfs
|
||||
run: |
|
||||
@@ -204,7 +251,7 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# The dispatched workflow pins seaweedfs with `go get -u ...@latest`, so
|
||||
# The dispatched workflow pins seaweedfs with `go get ...@latest`, so
|
||||
# wait until the proxy serves the release commit as the tip. Asking for
|
||||
# the commit by name is what makes the proxy fetch it. The proxy can
|
||||
# take longer than five minutes to refresh @latest after a new tag.
|
||||
@@ -231,7 +278,7 @@ jobs:
|
||||
BEFORE=$(released)
|
||||
# A minute early, so runner clock skew cannot hide the run.
|
||||
DISPATCHED_AT=$(date -u -d '1 minute ago' '+%Y-%m-%dT%H:%M:%SZ')
|
||||
gh workflow run -R "$REPO" "$WORKFLOW" --ref master -f bump=patch -f update_seaweedfs=true
|
||||
gh workflow run -R "$REPO" "$WORKFLOW" --ref "$REF" -f bump=patch -f update_seaweedfs=true
|
||||
|
||||
RUN_ID=""
|
||||
for _ in $(seq 12); do
|
||||
|
||||
@@ -340,7 +340,9 @@ func run(f flags) int {
|
||||
fmt.Fprintln(os.Stderr, "blockmaster:", err)
|
||||
return 1
|
||||
}
|
||||
fmt.Fprintf(os.Stderr, "blockmaster: lifecycle import durability: %s\n", lifecycle.ImportDurabilityMode(f.lifecycleStore))
|
||||
if st := h.Lifecycle(); st != nil {
|
||||
fmt.Fprintf(os.Stderr, "blockmaster: lifecycle import durability: nodes %s; placements %s\n", st.Nodes.ImportDurabilityMode(), st.Placements.ImportDurabilityMode())
|
||||
}
|
||||
// Every promotion decides on the probe round's answers: each candidate
|
||||
// answers a fresh round over its authenticated node stream.
|
||||
h.SetPromotionEvidenceProvider(h.NewRoundPromotionEvidenceProvider(f.launcherReplicationAck, nil))
|
||||
|
||||
@@ -36,8 +36,9 @@ var restoreCreateRPC = func(ctx context.Context, master string, req *control.Cre
|
||||
}
|
||||
|
||||
// bCatalog dials the filer and opens the volume catalog; a command that
|
||||
// writes first passes the single-filer start check. It returns exit -1 on
|
||||
// success, else the exit code after reporting.
|
||||
// writes first passes the single-filer start check, then runs the chunk
|
||||
// condition probe; each runs within timeout. It returns exit -1 on success,
|
||||
// else the exit code after reporting.
|
||||
func bCatalog(name, filer, base string, writes bool, timeout time.Duration, stdout, stderr io.Writer) (*chunkstore.BCatalog, func() error, int) {
|
||||
if filer == "" {
|
||||
return nil, nil, chunkFail(name, stdout, stderr, ops.VolumeStatusExitInvalid, codeBadRequestCLI, "--chunk-filer is required", false)
|
||||
@@ -67,6 +68,11 @@ func bCatalog(name, filer, base string, writes bool, timeout time.Duration, stdo
|
||||
if err != nil {
|
||||
return fail(err.Error())
|
||||
}
|
||||
if writes {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), timeout)
|
||||
cat.ProbeChunkGuard(ctx)
|
||||
cancel()
|
||||
}
|
||||
return cat, closeFn, -1
|
||||
}
|
||||
|
||||
@@ -354,7 +360,9 @@ func chunkUsage(args []string, stdout, stderr io.Writer) int {
|
||||
c.bindVolume(&vol, "volume", "volume")
|
||||
var ref chunkstore.VolumeRef
|
||||
return c.run(args, false, func() (err error) { ref, err = vol.ref("volume"); return err }, func(ctx context.Context, cat *chunkstore.BCatalog) (any, error) {
|
||||
return cat.Usage(ctx, ref)
|
||||
u, err := cat.Usage(ctx, ref)
|
||||
u.MetadataGuard = ""
|
||||
return u, err
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -176,7 +176,7 @@ func TestOpsChunk_CatalogCommands(t *testing.T) {
|
||||
if code, out, errs := runChunk(cliArgs("restore", volArgs("source", src), volArgs("target", tgt), []string{"--snapshot", "daily"})...); code != 0 || !strings.Contains(out, tgt.Dir()) {
|
||||
t.Fatalf("restore: %d %q %q", code, out, errs)
|
||||
}
|
||||
if code, out, _ := runChunk(cliArgs("usage", volArgs("volume", tgt))...); code != 0 || !strings.Contains(out, `"foreign_chunks":1`) {
|
||||
if code, out, _ := runChunk(cliArgs("usage", volArgs("volume", tgt))...); code != 0 || !strings.Contains(out, `"foreign_chunks":1`) || strings.Contains(out, "metadata_guard") {
|
||||
t.Fatalf("target usage: %d %q", code, out)
|
||||
}
|
||||
if code, out, _ := runChunk(cliArgs("snapshot-delete", volArgs("volume", src), []string{"--name", "daily"})...); code != chunkExitFailed || chunkErrorOut(t, out).Code != "snapshot_has_dependents" {
|
||||
|
||||
@@ -0,0 +1,214 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"path"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"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"
|
||||
)
|
||||
|
||||
// A command that changes chunk metadata runs the chunk condition probe on
|
||||
// the catalog it opens, so its adoptions and marks send the filer's chunk
|
||||
// condition as blockvolume's do; a read-only command writes nothing.
|
||||
func TestOpsChunkWritingCatalogRunsTheChunkConditionProbe(t *testing.T) {
|
||||
mem := newMemChunkStore()
|
||||
prevDial, prevCheck := dialChunkFiler, checkSingleFiler
|
||||
t.Cleanup(func() { dialChunkFiler, checkSingleFiler = prevDial, prevCheck })
|
||||
dialChunkFiler = func(string) (chunkstore.Filer, func() error, error) { return mem, func() error { return nil }, nil }
|
||||
checkSingleFiler = func(context.Context, chunkstore.Filer) error { return nil }
|
||||
for _, tc := range []struct {
|
||||
writes bool
|
||||
guard string
|
||||
}{{true, chunkstore.MetadataGuardChunks}, {false, chunkstore.MetadataGuardReread}} {
|
||||
cat, closeFn, exit := bCatalog("snapshot-delete", "filer:18888", "/blocks", tc.writes, time.Minute, io.Discard, io.Discard)
|
||||
if exit >= 0 {
|
||||
t.Fatalf("writes=%v: catalog open exited %d", tc.writes, exit)
|
||||
}
|
||||
_ = closeFn()
|
||||
if got := cat.MetadataGuard(); got != tc.guard {
|
||||
t.Fatalf("writes=%v: metadata guard %q, want %q", tc.writes, got, tc.guard)
|
||||
}
|
||||
left, err := mem.ListEntries(context.Background(), "/blocks", "", "", 100)
|
||||
if err != nil || len(left) != 0 {
|
||||
t.Fatalf("writes=%v: %d entries left under the catalog base (%v)", tc.writes, len(left), err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// stalledProbeFiler stalls the probe's disposable HEAD create until its
|
||||
// context ends.
|
||||
type stalledProbeFiler struct{ *memChunkStore }
|
||||
|
||||
func (f stalledProbeFiler) CreateEntry(ctx context.Context, dir string, e *filerpb.Entry, oExcl bool) error {
|
||||
if inStartupProbe(dir, e.GetName()) {
|
||||
<-ctx.Done()
|
||||
return ctx.Err()
|
||||
}
|
||||
return f.memChunkStore.CreateEntry(ctx, dir, e, oExcl)
|
||||
}
|
||||
|
||||
// The probe runs within the command's --timeout: after a passing census, a
|
||||
// probe stalled on its filer ends at the timeout, leaves the guard off and
|
||||
// refuses nothing.
|
||||
func TestOpsChunkWritingCatalogProbeIsBoundedByTheTimeout(t *testing.T) {
|
||||
mem := newMemChunkStore()
|
||||
prevDial, prevCheck := dialChunkFiler, checkSingleFiler
|
||||
t.Cleanup(func() { dialChunkFiler, checkSingleFiler = prevDial, prevCheck })
|
||||
dialChunkFiler = func(string) (chunkstore.Filer, func() error, error) {
|
||||
return stalledProbeFiler{mem}, func() error { return nil }, nil
|
||||
}
|
||||
checkSingleFiler = func(context.Context, chunkstore.Filer) error { return nil }
|
||||
start := time.Now()
|
||||
cat, closeFn, exit := bCatalog("snapshot-delete", "filer:18888", "/blocks", true, 200*time.Millisecond, io.Discard, io.Discard)
|
||||
if exit >= 0 {
|
||||
t.Fatalf("a stalled probe refused the command: exit %d", exit)
|
||||
}
|
||||
_ = closeFn()
|
||||
if took := time.Since(start); took > 5*time.Second {
|
||||
t.Fatalf("a stalled probe held the command %v past its 200ms --timeout", took)
|
||||
}
|
||||
if got := cat.MetadataGuard(); got != chunkstore.MetadataGuardReread {
|
||||
t.Fatalf("metadata guard %q after a stalled probe, want %q", got, chunkstore.MetadataGuardReread)
|
||||
}
|
||||
}
|
||||
|
||||
// betweenLookupAndUpdate runs before, once it is set, ahead of the next
|
||||
// update: what other writers do while a stale one is between its lookup and
|
||||
// its update.
|
||||
type betweenLookupAndUpdate struct {
|
||||
*memChunkStore
|
||||
before func()
|
||||
}
|
||||
|
||||
func (f *betweenLookupAndUpdate) runBefore() {
|
||||
if b := f.before; b != nil {
|
||||
f.before = nil
|
||||
b()
|
||||
}
|
||||
}
|
||||
|
||||
func (f *betweenLookupAndUpdate) UpdateEntry(ctx context.Context, dir string, e *filerpb.Entry, expected map[string][]byte) error {
|
||||
f.runBefore()
|
||||
return f.memChunkStore.UpdateEntry(ctx, dir, e, expected)
|
||||
}
|
||||
|
||||
func (f *betweenLookupAndUpdate) UpdateEntryIfChunks(ctx context.Context, dir string, e *filerpb.Entry, expected map[string][]byte, fids []string) error {
|
||||
f.runBefore()
|
||||
return f.memChunkStore.UpdateEntryIfChunks(ctx, dir, e, expected, fids)
|
||||
}
|
||||
|
||||
// A writing command's adoption that paused between its lookup and its update
|
||||
// does not land on an object a cleaner deleted and another executor created
|
||||
// again in between, through the store of the catalog bCatalog opens. An
|
||||
// unchanged object is still adopted; a catalog that ran no probe lets the
|
||||
// stale write through.
|
||||
func TestOpsChunkStaleCLIAdoptionDoesNotOverwriteARecreatedObject(t *testing.T) {
|
||||
for _, tc := range []struct {
|
||||
name string
|
||||
writes, recreate bool
|
||||
}{
|
||||
{"probed catalog, recreated object", true, true},
|
||||
{"probed catalog, unchanged object", true, false},
|
||||
{"catalog without the probe, recreated object", false, true},
|
||||
} {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
mem := newMemChunkStore()
|
||||
hooked := &betweenLookupAndUpdate{memChunkStore: mem}
|
||||
prevDial, prevCheck := dialChunkFiler, checkSingleFiler
|
||||
t.Cleanup(func() { dialChunkFiler, checkSingleFiler = prevDial, prevCheck })
|
||||
dialChunkFiler = func(string) (chunkstore.Filer, func() error, error) { return hooked, func() error { return nil }, nil }
|
||||
checkSingleFiler = func(context.Context, chunkstore.Filer) error { return nil }
|
||||
cat, closeFn, exit := bCatalog("snapshot-delete", "filer:18888", "/blocks", tc.writes, time.Minute, io.Discard, io.Discard)
|
||||
if exit >= 0 {
|
||||
t.Fatalf("catalog open exited %d", exit)
|
||||
}
|
||||
defer closeFn()
|
||||
id, err := layout.NewVolumeID()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
ref := chunkstore.VolumeRef{Name: "v", ID: id}
|
||||
stale, err := cat.Store(ref)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
others, err := chunkstore.NewLayoutStore(mem, mem, path.Join("/blocks", ref.Dir()), id)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
data := bytes.Repeat([]byte{0x5a}, 4096)
|
||||
rel := layout.NameChunk(1, data).Path()
|
||||
obj := path.Join("/blocks", ref.Dir(), rel)
|
||||
fid := func() string {
|
||||
e, err := mem.LookupEntry(ctx, path.Dir(obj), path.Base(obj))
|
||||
if err != nil || len(e.Chunks) != 1 {
|
||||
t.Fatalf("lookup %s: %+v %v", rel, e, err)
|
||||
}
|
||||
return e.Chunks[0].FileId
|
||||
}
|
||||
if err := others.Create(ctx, rel, data, "producer-1"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
first := fid()
|
||||
meta, found, err := others.Stat(ctx, rel)
|
||||
if err != nil || !found {
|
||||
t.Fatalf("stat: %v %v", found, err)
|
||||
}
|
||||
second := first
|
||||
if tc.recreate {
|
||||
hooked.before = func() {
|
||||
if err := others.Mark(ctx, rel, meta, "clean-1"); err != nil {
|
||||
t.Errorf("mark: %v", err)
|
||||
}
|
||||
if err := others.DeleteMarked(ctx, rel, "clean-1"); err != nil {
|
||||
t.Errorf("delete: %v", err)
|
||||
}
|
||||
if err := others.Create(ctx, rel, data, "producer-1"); err != nil {
|
||||
t.Errorf("re-create: %v", err)
|
||||
}
|
||||
second = fid()
|
||||
}
|
||||
}
|
||||
err = stale.Reuse(ctx, rel, meta, "writer-1")
|
||||
if tc.recreate && second == first {
|
||||
t.Fatalf("fixture: the object was not re-created with a new chunk (%s)", first)
|
||||
}
|
||||
switch {
|
||||
case tc.writes && tc.recreate:
|
||||
if !errors.Is(err, layout.ErrPrecondition) {
|
||||
t.Fatalf("the stale CLI adoption over a re-created object answered %v, want ErrPrecondition", err)
|
||||
}
|
||||
if got := fid(); got != second {
|
||||
t.Fatalf("the stale CLI adoption wrote chunk %s over the re-created object's %s", got, second)
|
||||
}
|
||||
case tc.recreate:
|
||||
if err != nil || fid() != first {
|
||||
t.Fatalf("control: without the probe the stale adoption should land (err %v, chunk %s, first %s)", err, fid(), first)
|
||||
}
|
||||
default:
|
||||
if err != nil {
|
||||
t.Fatalf("adoption of an unchanged object: %v", err)
|
||||
}
|
||||
if m, _, err := others.Stat(ctx, rel); err != nil || m.Session != "writer-1" {
|
||||
t.Fatalf("after adoption: %+v %v", m, err)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// inStartupProbe reports whether dir/name lies in a catalog probe's
|
||||
// disposable directory: a fake that stalls object deletes lets the probe's
|
||||
// own cleanup through, as a real filer deletes its inline HEAD at once.
|
||||
func inStartupProbe(dir, name string) bool {
|
||||
return strings.Contains(path.Join(dir, name), "/.startup-head-probe-")
|
||||
}
|
||||
@@ -100,6 +100,9 @@ type waitingDeleteFiler struct {
|
||||
}
|
||||
|
||||
func (f *waitingDeleteFiler) DeleteEntry(ctx context.Context, dir, name string, expected map[string][]byte) error {
|
||||
if inStartupProbe(dir, name) {
|
||||
return f.memChunkStore.DeleteEntry(ctx, dir, name, expected)
|
||||
}
|
||||
f.calls++
|
||||
if f.calls == 1 {
|
||||
timer := time.NewTimer(f.bound / 2)
|
||||
@@ -166,6 +169,9 @@ func TestVolumeDeleteRefreshesAnExpiredSweepAndWaitsFromLastRemoval(t *testing.T
|
||||
type blockedDeleteFiler struct{ *memChunkStore }
|
||||
|
||||
func (f *blockedDeleteFiler) DeleteEntry(ctx context.Context, dir, name string, expected map[string][]byte) error {
|
||||
if inStartupProbe(dir, name) {
|
||||
return f.memChunkStore.DeleteEntry(ctx, dir, name, expected)
|
||||
}
|
||||
<-ctx.Done()
|
||||
return ctx.Err()
|
||||
}
|
||||
|
||||
@@ -369,8 +369,9 @@ type Usage struct {
|
||||
// MetadataGuard names the protection of the volume's metadata changes:
|
||||
// filer_chunk_condition (the startup probe saw the filer enforce the
|
||||
// chunk condition) or page_reread_only (enforcement was not established
|
||||
// at startup; delete intent pages are re-read).
|
||||
MetadataGuard string `json:"metadata_guard"`
|
||||
// at startup; delete intent pages are re-read). Absent when the catalog
|
||||
// ran no probe.
|
||||
MetadataGuard string `json:"metadata_guard,omitempty"`
|
||||
}
|
||||
|
||||
// Usage reads the volume's usage from its HEAD and current root.
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package chunkstore
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
"github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout"
|
||||
)
|
||||
|
||||
// ChunkGuard reports what changeMeta sends: a store over a filer that cannot
|
||||
// carry the chunk condition reports the guard off even when it was set on.
|
||||
func TestChunkGuardReportsOnlyAConditionTheFilerCanCarry(t *testing.T) {
|
||||
id, err := layout.NewVolumeID()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, tc := range []struct {
|
||||
name string
|
||||
filer Filer
|
||||
want bool
|
||||
}{
|
||||
{"a filer that carries it", newFakeFiler(), true},
|
||||
{"a client wrapper that cannot send it", hidesChunkCondition{newFakeFiler()}, false},
|
||||
} {
|
||||
st, err := NewLayoutStore(tc.filer, newFakeBlobs(), "/blocks/v1", id)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
st.SetChunkGuard(true)
|
||||
if got := st.ChunkGuard(); got != tc.want {
|
||||
t.Fatalf("%s: ChunkGuard()=%v after SetChunkGuard(true), want %v", tc.name, got, tc.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// A probe that fails leaves the guard off even after an earlier probe of the
|
||||
// same catalog turned it on.
|
||||
func TestAFailedChunkGuardProbeLeavesTheGuardOff(t *testing.T) {
|
||||
f := newFakeFiler()
|
||||
cat, err := NewBCatalog(f, newFakeBlobs(), "/blocks")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
cat.ProbeChunkGuard(context.Background())
|
||||
if got := cat.MetadataGuard(); got != MetadataGuardChunks {
|
||||
t.Fatalf("first probe: guard %q, want %q", got, MetadataGuardChunks)
|
||||
}
|
||||
f.failCreate = func(string) error { return errors.New("transport: lost answer") }
|
||||
cat.ProbeChunkGuard(context.Background())
|
||||
if got := cat.MetadataGuard(); got != MetadataGuardReread {
|
||||
t.Fatalf("failed probe: guard %q, want %q", got, MetadataGuardReread)
|
||||
}
|
||||
}
|
||||
@@ -374,7 +374,7 @@ func (s *LayoutStore) changeMeta(ctx context.Context, rel string, expect layout.
|
||||
// filer's chunk condition refuses that write. Without it (a filer that
|
||||
// does not enforce the condition), delete intent publication re-reads
|
||||
// each adopted page instead (layout.RunDeleteSnapshotWithIntent).
|
||||
if cf, ok := s.f.(ChunkConditionFiler); ok && s.chunkGuard {
|
||||
if cf, ok := s.chunkCondition(); ok {
|
||||
return layoutError(cf.UpdateEntryIfChunks(ctx, dir, e, objectExpected(expect), entryFids(e)))
|
||||
}
|
||||
return layoutError(s.f.UpdateEntry(ctx, dir, e, objectExpected(expect)))
|
||||
@@ -385,7 +385,17 @@ func (s *LayoutStore) changeMeta(ctx context.Context, rel string, expect layout.
|
||||
func (s *LayoutStore) SetChunkGuard(on bool) { s.chunkGuard = on }
|
||||
|
||||
// ChunkGuard reports whether metadata changes send the chunk condition.
|
||||
func (s *LayoutStore) ChunkGuard() bool { return s.chunkGuard }
|
||||
func (s *LayoutStore) ChunkGuard() bool {
|
||||
_, ok := s.chunkCondition()
|
||||
return ok
|
||||
}
|
||||
|
||||
// chunkCondition is the filer metadata changes send the chunk condition
|
||||
// through: the guard is on and the filer can carry it.
|
||||
func (s *LayoutStore) chunkCondition() (ChunkConditionFiler, bool) {
|
||||
cf, ok := s.f.(ChunkConditionFiler)
|
||||
return cf, ok && s.chunkGuard
|
||||
}
|
||||
|
||||
func (s *LayoutStore) Reuse(ctx context.Context, rel string, expect layout.ObjectMeta, session string) error {
|
||||
if session == "" {
|
||||
|
||||
@@ -157,6 +157,20 @@ func (c *BCatalog) checkConditionalHead(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ProbeChunkGuard runs the startup probe for a catalog NewBCatalog opened
|
||||
// (the sw-block commands that change metadata), so the stores it opens next
|
||||
// send the chunk condition as DialBCatalog's do; a store takes the guard when
|
||||
// it is opened. A failed probe leaves the guard off; it refuses nothing.
|
||||
func (c *BCatalog) ProbeChunkGuard(ctx context.Context) {
|
||||
c.chunkGuard = false
|
||||
if _, ok := c.f.(ChunkConditionFiler); !ok {
|
||||
return
|
||||
}
|
||||
if err := c.checkConditionalHead(ctx); err != nil {
|
||||
log.Printf("chunkstore: WARNING %v; metadata change guard: %s", err, c.MetadataGuard())
|
||||
}
|
||||
}
|
||||
|
||||
// probeChunkCondition asks the filer to rewrite the disposable probe HEAD
|
||||
// only if it holds a chunk it does not have. A filer that enforces
|
||||
// IF_CHUNKS_EQUAL refuses; one that predates it drops the unknown field and
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -377,3 +378,100 @@ func TestSyncfsFilesystemGate(t *testing.T) {
|
||||
t.Error("an unreadable records directory selected syncfs")
|
||||
}
|
||||
}
|
||||
|
||||
func TestImportBatchSelectsSyncfsByFilesystem(t *testing.T) {
|
||||
for _, fs := range []string{"overlay", "ext4"} {
|
||||
t.Run(fs, func(t *testing.T) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
cmd := exec.CommandContext(ctx, os.Args[0], "-test.run=^TestImportBatchSelectChild$", "-test.timeout=8s")
|
||||
cmd.Env = append(os.Environ(), "IMPORT_BATCH_SELECT_FS="+fs)
|
||||
if out, err := cmd.CombinedOutput(); err != nil {
|
||||
t.Fatalf("selector control: %v context=%v\n%s", err, ctx.Err(), out)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestImportBatchSelectChild(t *testing.T) {
|
||||
fs := os.Getenv("IMPORT_BATCH_SELECT_FS")
|
||||
if fs == "" {
|
||||
t.Skip("isolated filesystem hooks")
|
||||
}
|
||||
if !recordKernelSyncfsErrors {
|
||||
t.Skip("kernel does not report writeback errors through syncfs")
|
||||
}
|
||||
magic, wantSyncfs := uint32(unix.OVERLAYFS_SUPER_MAGIC), false
|
||||
if fs == "ext4" {
|
||||
magic, wantSyncfs = unix.EXT4_SUPER_MAGIC, true
|
||||
}
|
||||
dir := t.TempDir()
|
||||
s, err := OpenNodeInventoryStore(dir)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var syncfsCalls, fileSyncs int
|
||||
durableRecordHooksForTest.Store(&durableRecordHooks{
|
||||
statfsType: func(string, uint32) uint32 { return magic },
|
||||
fsSync: func(f *os.File) error {
|
||||
syncfsCalls++
|
||||
return syncRecordFilesystem(f)
|
||||
},
|
||||
fileSync: func(f *os.File) error {
|
||||
fileSyncs++
|
||||
return f.Sync()
|
||||
},
|
||||
})
|
||||
defer durableRecordHooksForTest.Store(nil)
|
||||
if mode := s.ImportDurabilityMode(); strings.HasPrefix(mode, "syncfs") != wantSyncfs {
|
||||
t.Fatalf("%s reports %q", fs, mode)
|
||||
}
|
||||
if err := s.ImportNodes([]NodeRegistration{{ServerID: "a", Addr: "127.0.0.1:19001"}, {ServerID: "b", Addr: "127.0.0.1:19002"}}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if wantSyncfs && (syncfsCalls != 1 || fileSyncs != 0) || !wantSyncfs && (syncfsCalls != 0 || fileSyncs != 2) {
|
||||
t.Fatalf("%s import: %d syncfs, %d file syncs", fs, syncfsCalls, fileSyncs)
|
||||
}
|
||||
if len(s.ListNodes()) != 2 {
|
||||
t.Fatalf("imported %d nodes", len(s.ListNodes()))
|
||||
}
|
||||
}
|
||||
|
||||
func TestImportDurabilityModeProbesEachStoreDirectory(t *testing.T) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
cmd := exec.CommandContext(ctx, os.Args[0], "-test.run=^TestImportDurabilityModeChild$", "-test.timeout=8s")
|
||||
cmd.Env = append(os.Environ(), "IMPORT_MODE_CHILD=1")
|
||||
if out, err := cmd.CombinedOutput(); err != nil {
|
||||
t.Fatalf("mode control: %v context=%v\n%s", err, ctx.Err(), out)
|
||||
}
|
||||
}
|
||||
|
||||
func TestImportDurabilityModeChild(t *testing.T) {
|
||||
if os.Getenv("IMPORT_MODE_CHILD") == "" {
|
||||
t.Skip("isolated filesystem hooks")
|
||||
}
|
||||
if !recordKernelSyncfsErrors {
|
||||
t.Skip("kernel does not report writeback errors through syncfs")
|
||||
}
|
||||
root := t.TempDir()
|
||||
nodes, err := OpenNodeInventoryStore(filepath.Join(root, "nodes"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
placements, err := OpenPlacementIntentStore(filepath.Join(root, "placements"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
durableRecordHooksForTest.Store(&durableRecordHooks{statfsType: func(dir string, _ uint32) uint32 {
|
||||
if dir == filepath.Join(root, "nodes") {
|
||||
return unix.EXT4_SUPER_MAGIC
|
||||
}
|
||||
return unix.OVERLAYFS_SUPER_MAGIC
|
||||
}})
|
||||
defer durableRecordHooksForTest.Store(nil)
|
||||
nodeMode, placementMode := nodes.ImportDurabilityMode(), placements.ImportDurabilityMode()
|
||||
if !strings.HasPrefix(nodeMode, "syncfs") || strings.HasPrefix(placementMode, "syncfs") {
|
||||
t.Fatalf("nodes on ext4 report %q, placements on overlay report %q", nodeMode, placementMode)
|
||||
}
|
||||
}
|
||||
@@ -343,6 +343,9 @@ func copyStringMap(in map[string]string) map[string]string {
|
||||
return out
|
||||
}
|
||||
|
||||
// ImportDurabilityMode reports the persistence path ImportNodes uses.
|
||||
func (s *NodeInventoryStore) ImportDurabilityMode() string { return importDurabilityMode(s.dir) }
|
||||
|
||||
// ImportNodes replays one startup node step. All changed data is durable before
|
||||
// rename; one directory barrier precedes publication of the changed snapshots.
|
||||
func (s *NodeInventoryStore) ImportNodes(nodes []NodeRegistration) error {
|
||||
|
||||
@@ -262,6 +262,9 @@ func copyPlacementIntent(in PlacementIntent) PlacementIntent {
|
||||
return out
|
||||
}
|
||||
|
||||
// ImportDurabilityMode reports the persistence path ImportPlans uses.
|
||||
func (s *PlacementIntentStore) ImportDurabilityMode() string { return importDurabilityMode(s.dir) }
|
||||
|
||||
// ImportPlans replays one startup placement step and publishes only after
|
||||
// the changed files and their shared directory barrier have completed.
|
||||
func (s *PlacementIntentStore) ImportPlans(plans []PlacementPlan) error {
|
||||
|
||||
@@ -58,6 +58,7 @@ type durableRecordHooks struct {
|
||||
dirSync func(string) error
|
||||
batchSyncfs *bool
|
||||
fsSync func(*os.File) error
|
||||
statfsType func(dir string, fsType uint32) uint32
|
||||
}
|
||||
|
||||
var durableRecordHooksForTest atomic.Pointer[durableRecordHooks]
|
||||
@@ -106,9 +107,9 @@ func writeRecordBatchDurably(dir string, records []recordWrite) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ImportDurabilityMode reports the batch persistence path for records under dir.
|
||||
// importDurabilityMode reports the batch persistence path for records under dir.
|
||||
// Single-record mutations always retain their file and directory fsyncs.
|
||||
func ImportDurabilityMode(dir string) string {
|
||||
func importDurabilityMode(dir string) string {
|
||||
if recordBatchSyncfsSupported(dir) {
|
||||
return "syncfs (Linux >= 5.8, local filesystem)"
|
||||
}
|
||||
|
||||
@@ -23,7 +23,11 @@ func recordBatchSyncfsSupported(dir string) bool {
|
||||
if unix.Statfs(dir, &st) != nil {
|
||||
return false
|
||||
}
|
||||
return filesystemReportsSyncfsErrors(uint32(st.Type))
|
||||
fsType := uint32(st.Type)
|
||||
if hooks := durableRecordHooksForTest.Load(); hooks != nil && hooks.statfsType != nil {
|
||||
fsType = hooks.statfsType(dir, fsType)
|
||||
}
|
||||
return filesystemReportsSyncfsErrors(fsType)
|
||||
}
|
||||
|
||||
func filesystemReportsSyncfsErrors(fsType uint32) bool {
|
||||
|
||||
@@ -84,7 +84,8 @@ syncs the directory before publication. A failed `syncfs` is never retried
|
||||
within the step: its writeback error may have been consumed. Recovery writes
|
||||
fresh temps. Older kernels, other filesystems (overlay, FUSE, NFS: syncfs does
|
||||
not reach their backing files) and other platforms retain per-file fsync
|
||||
before rename; startup reports the chosen path. The filesystem-wide sync can
|
||||
before rename; startup reports the chosen path for the node and placement
|
||||
stores, each probed at its own directory. The filesystem-wide sync can
|
||||
also wait for unrelated writeback on that filesystem.
|
||||
The executable arms a one-second process-exit timer before logging
|
||||
and exits immediately after the log returns, rather than waiting for graceful
|
||||
@@ -394,6 +395,7 @@ stateDiagram-v2
|
||||
| (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` |
|
||||
| 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` |
|
||||
| Claiming | Holder | Start validates the local root against the HEAD it conditionally updates; a fresh root seeds before claim, an ordinary reopen keeps its acknowledged local WAL and HEAD identity; guest I/O waits for assignment and claim | `core/frontend/chunkstore/layout/start.go` `Start`; `core/frontend/chunkstore/layout/claim.go` `RunClaim`; `core/frontend/durable/provider_layout.go` `startLayoutRoot` | `INV-WS-CLAIM-BEFORE-SERVE-001`, `INV-SNAPK-HEAD-WRITE-001` |
|
||||
| Claiming | Detached (non-serving) | a same-epoch detached HEAD refuses Start without changing its sealed image; a higher-epoch claimant retains that image | `core/frontend/chunkstore/layout/start.go` `Start`; `core/frontend/chunkstore/layout/claim.go` `Claim` | `INV-WS-SEALED-REOPEN-001` |
|
||||
| Claiming | Holder, or not installed | an unknown transition outcome is resolved by its claim/session identity and the current HEAD; no unverified local success | `core/frontend/chunkstore/layout/claim.go` `RunClaim`; `core/frontend/chunkstore/layout_remote.go` `LayoutRemote.CASHead` | `INV-WS-CAS-UNKNOWN-001` |
|
||||
@@ -641,10 +643,10 @@ stateDiagram-v2
|
||||
idle --> clean: BeginClean(c)
|
||||
clean --> idle: EndClean(c)
|
||||
snap --> snap: PublishList (durable session pages, base CAS)
|
||||
idle --> idle: DeleteSnapshotWithIntent (adopted pages read again, one CAS)
|
||||
snap --> snap: DeleteSnapshotWithIntent (adopted pages read again, one CAS)
|
||||
idle --> idle: DeleteSnapshotWithIntent (adoption chunk-conditioned when the guard is on, pages read again, one CAS)
|
||||
snap --> snap: DeleteSnapshotWithIntent (adoption chunk-conditioned when the guard is on, pages read again, one CAS)
|
||||
clean --> clean: AdvanceList (effects then cursor CAS)
|
||||
clean --> clean: roots, segments, chunk shards and unreached list pages (conditional removal)
|
||||
clean --> clean: roots, segments, chunk shards and unreached list pages (mark chunk-conditioned when the guard is on, conditional removal)
|
||||
idle --> deleting: MarkDeleting (no holder, no dependents)
|
||||
deleting --> deleted: MarkDeleted (after release and pool)
|
||||
```
|
||||
@@ -656,8 +658,8 @@ stateDiagram-v2
|
||||
| any version-1 HEAD with reserved lists | same reserved lists after any existing HEAD transition | at most three additional checked cursors, no repeated Ref across list/lists; deep clone and exact preservation; never consumed or a reason to refuse serving | `head.go` `check`, `clone`, `runTransition`; `remove.go` `Cleaner.Page` retains list metadata | `INV-LIST-RESERVED-001` |
|
||||
| snap(s), list slot empty | snap(s), list cursor published | same full holder, open session and original base generation; every page durable; full slot returns queue_full without replacing work; unknown reply retains protection | `list_chain.go` `StageListPage`, `RunPublishList` | `INV-LIST-PUBLISH-001` |
|
||||
| clean(c), current list page | clean(c), next continuation or none | exact observed cursor CAS only after authenticated page effects succeed; failed reads and failed effects leave cursor unchanged | `list_chain.go` `RunAdvanceList` | `INV-LIST-CURSOR-001` |
|
||||
| clean(c), stored list page | clean(c), unreached page removed | tags before HEAD; current clean session; spare all current-chain pages; conditional mark then delete | `remove.go` `Cleaner.Page` | `INV-LIST-RETIRE-001` |
|
||||
| idle/snap, retained snapshot | same activity, row removed and intent published | one CAS removes only captured name/gen and names its durable chain; each page present, this attempt's tag, unmarked, then read and authenticated again after adoption; clean activity refuses | `delete_intent.go` `RunDeleteSnapshotWithIntent` | `INV-SNAPSHOT-DELETE-INTENT-001`, `INV-SNAPSHOT-DELETE-ADOPT-001`, `INV-SNAPSHOT-DELETE-ADOPT-002` |
|
||||
| clean(c), stored list page | clean(c), unreached page removed | tags before HEAD; current clean session; spare all current-chain pages; conditional mark (with the chunk guard on, also on unchanged chunk fids) then delete | `remove.go` `Cleaner.Page`; `layout_store.go` `changeMeta` | `INV-LIST-RETIRE-001`, `INV-LAYOUT-META-CHUNKS-001` |
|
||||
| idle/snap, retained snapshot | same activity, row removed and intent published | one CAS removes only captured name/gen and names its durable chain; each page present, this attempt's tag, unmarked, then read and authenticated again after adoption; with the chunk guard on, an adoption also needs the page's looked-up chunk fids unchanged; clean activity refuses | `delete_intent.go` `RunDeleteSnapshotWithIntent`; `layout_store.go` `changeMeta` | `INV-SNAPSHOT-DELETE-INTENT-001`, `INV-SNAPSHOT-DELETE-ADOPT-001`, `INV-SNAPSHOT-DELETE-ADOPT-002`, `INV-LAYOUT-META-CHUNKS-001` |
|
||||
| idle live/detached, persisted delete intent | idle live/detached, next intent page or none | receipt-independent continuation from current HEAD; live-root and conditional effect guards; cursor follows completed effects | `delete_intent.go` `RunConsumeSnapshotDeleteIntent`; `BCatalog.CleanSnapshotDeletePage`; `LayoutRemote.Clean` | `INV-SNAPSHOT-DELETE-CONSUME-001` |
|
||||
| idle | snap(s) | caller is the holder at HEAD's epoch (epoch, server and claim id); HEAD present; snap(s) again is a replay, any other activity is refused | head.go `Head.Begin`, `runTransition` | `INV-SNAPK-HEAD-WRITE-001`, `INV-SNAPK-BEGIN-001` |
|
||||
| snap(s) | idle | holder at HEAD's epoch (epoch, server and claim id); activity is snap(s); over idle it succeeds without a write and means only that no activity remains; before resuming a failed stop, abort its still-open session and re-read HEAD: only matching live/idle resumes, detached goes Down, absent/unknown stays stopped | head.go `Head.Abort`; durable/provider_layout.go `settleLayoutStop` | `INV-SNAPK-ABORT-001` |
|
||||
@@ -667,7 +669,7 @@ stateDiagram-v2
|
||||
| any (Start) | idle at epoch e, claim id k | Start only: at HEAD's epoch it continues on the root carrying HEAD's claim id at or above HEAD's position, else refuses; above, a fresh root or the continuing lineage claims, validated against the HEAD the claim updates | start.go `Start`; claim.go `RunClaim` | `INV-SNAPK-START-ROOT-001`, `INV-SNAPK-START-LINEAGE-001`, `INV-SNAPK-START-POSITION-001`, `INV-SNAPK-START-ACTIVITY-001` |
|
||||
| idle | clean(c) | holder at HEAD's epoch (epoch, server and claim id); activity idle (clean(c) again is a replay) | clean.go `Head.BeginClean` | `INV-SNAPK-CLEAN-EXCL-001` |
|
||||
| clean(c) | idle | holder at HEAD's epoch (epoch, server and claim id); activity clean(c); over idle it succeeds without a write | clean.go `Head.EndClean` | `INV-SNAPK-CLEAN-EXCL-001` |
|
||||
| clean(c) | clean(c), names removed | holder at HEAD's epoch, server and claim id with clean(c) open; candidate tags precede each HEAD validation; unreachable roots, then segments, then chunks; mark conditional on the planned tag, delete conditional on its own mark | remove.go `Cleaner.removePlanned` | `INV-SNAPK-REMOVE-MARK-001`, `INV-CLEAN-METADATA-001`, `INV-CLEAN-CURSOR-001` |
|
||||
| clean(c) | clean(c), names removed | holder at HEAD's epoch, server and claim id with clean(c) open; candidate tags precede each HEAD validation; unreachable roots, then segments, then chunks; mark conditional on the planned tag (with the chunk guard on, also on unchanged chunk fids), delete conditional on its own mark | remove.go `Cleaner.removePlanned`; layout_store.go `changeMeta` | `INV-SNAPK-REMOVE-MARK-001`, `INV-CLEAN-METADATA-001`, `INV-CLEAN-CURSOR-001`, `INV-LAYOUT-META-CHUNKS-001` |
|
||||
| idle (live or detached) | deleting | the master reserved the volume for delete (no line granted after), then no line holds a live lease, checked between the HEAD read and the update; no open activity, no snapshot with dependents; deleting again is a replay | delete.go `Head.MarkDeleting`, `RunMarkDeleting` (`DeleteAuthority`) | `INV-SNAPK-DELETE-ORDER-001` |
|
||||
| absent | deleted (tombstone) | the operator's remove-dependent, for a restore target without HEAD (never created, or a restore died between its two creates); one exclusive create, so a later HEAD create of the restore fails; a HEAD appearing first refuses | delete.go `OperatorReleaseDependent` (`TargetStore.CreateDeletedHead`) | `INV-SNAPK-TOMBSTONE-001`, `INV-SNAPK-HEAD-WRITE-001` |
|
||||
| source: any live | source: target released | by the target's volume id, from every snapshot: from DeleteVolume once the target's HEAD is deleting, or from the operator's command once the target is deleted, of another id, no longer naming the source, or tombstoned; an absent target writes nothing | delete.go `Head.ReleaseDependent`, `RunReleaseDependent`, `OperatorReleaseDependent` | `INV-SNAPK-RELEASE-001`, `INV-SNAPK-RELEASE-CALLERS-001`, `INV-SNAPK-RELEASE-OPERATOR-001` |
|
||||
@@ -1023,7 +1025,7 @@ Notes:
|
||||
| `INV-FMT-RETIRE-001` | A host retire, the node registry's only writer after start, is refused, naming the volumes, while the host holds a placement or a live line, and unless confirm repeats the id. A retired id is unregistered; if the host returns it registers again at its reported level. | FormatGate Retire | `core/host/master/format_gate.go` `RetireHost`; `core/host/master/journal_isolation.go` `volumesServedBy` | `TestRetireHostRefusesAHostThatHoldsWork` (`core/host/master/format_gate_test.go`); `TestACleanMoveReleasesTheTopologyHome`, `TestTheTopologyHomeHoldsTheVolumeBeforeAMove`, `TestTheTopologyHomeAloneHoldsTheVolumeBeforeAMove` (`core/host/master/served_topology_move_test.go`); `TestClusterRetireHost` (`cmd/sw-block/cluster_format_test.go`); `TestNodeRegistryIsWrittenOnlyAtStartup` (`cmd/blockmaster/node_registry_guard_test.go`) | `FormatGate` r2 `OneServer` (mutation `retire_holding_host`) | ACTIVE |
|
||||
| `INV-LIFECYCLE-SNAPSHOT-001` | The Volumes and deletion-reservation snapshots read by the renewal path equal the store records after every change of the records, including load, delete and a protective reservation kept in memory on an unknown write outcome; a published snapshot is never mutated. | M2 Bound → Deleting (renewal reads) | `core/lifecycle/store.go` `publishLocked`, `GetVolumeSnapshot`; `core/lifecycle/deletion_reservations.go` `publishLocked`, `ReservedSnapshot` | `TestDeletionReservationSnapshotFollowsRecords`, `TestFileStoreSnapshotFollowsRecords`, `TestLifecycleSnapshotReadsDoNotTakeStoreMutex`, `TestLifecycleSnapshotConcurrentWriters` (`core/lifecycle/renewal_snapshot_test.go`); `TestWorkspaceRenewalRPCDuringHeldSameVolumeReservation` (`core/host/master/workspace_lease_horizon_test.go`) | — | ACTIVE |
|
||||
| `INV-NODE-REGISTRATION-FRESHNESS-001` | Replaying a node registration without an observation time preserves its stored SeenAt; unchanged non-time fields do not rewrite its record. A restart is not a fresh observation, also when the declaration changed; a live heartbeat supplies freshness independently. | M2 lifecycle registration replay (no authority transition) | `core/lifecycle/node_inventory.go` `ImportNodes`, `RegisterNode`, `registrationLocked`; `core/host/master/observation_snapshot.go` `nodeHeartbeat`; `core/lifecycle/verified_placement.go` `VerifyPlacementIntent` | `TestUnchangedNodeRestartDoesNotRefreshAStaleObservation`, `TestChangedNodeImportDoesNotRefreshAStaleObservation` (`core/lifecycle/node_import_freshness_test.go`); `TestObservationNodesReportTheNewestHeartbeat` (`core/host/master/observation_heartbeat_test.go`); live-holder process restart qualification pending | Observation time is evidence, not authority; a declaration is not an observation | STUB |
|
||||
| `INV-LIFECYCLE-STORE-DURABLE-001` | A successful record put/import publishes only after complete replacement records and their directory are durable. Open syncs the records directory before publication. A possibly-applied failure blocks mutations until reopen; recovery reconciles complete old/new records. | M2 lifecycle record publication | `core/lifecycle/record_file.go` `writeRecordDurably`, `writeRecordBatchDurably`; `node_inventory.go` `ImportNodes`; `placement_intent.go` `ImportPlans`; `node_inventory.go`, `store.go`, `placement_intent.go` `putLocked` | `TestNodeInventoryCrashKeepsCompleteRegistration` (`core/lifecycle/node_inventory_crash_test.go`); `TestFileStoreCrashKeepsCompleteRecord`, `TestPlacementStoreCrashKeepsCompleteRecord`, `TestLifecyclePutSyncOrderAndFailure` (`core/lifecycle/store_crash_test.go`); `TestLifecycleStoreParentSync` (`core/lifecycle/store_parent_sync_test.go`); `TestImportStepSyncsChangedFilesThenOneDirectory` (`core/lifecycle/import_step_sync_test.go`); `TestImportSyncfsFailureAndOrdering`, `TestImportSyncfsReturnedFailurePolicyAndReplay`, `TestImportSyncfsCrashBoundaries`, `TestSyncfsKernelGate`, `TestSyncfsFilesystemGate` (`core/lifecycle/import_syncfs_test.go`); `TestRecordEqualityRequiresRecoveredDirectoryAndConsistentDisk` (`core/lifecycle/import_recovery_test.go`); `TestVolumeEqualityRequiresRecovery` (`core/lifecycle/volume_recovery_test.go`); `TestNodeMarshalErrorDoesNotRequireRecovery` (`core/lifecycle/remove_retry_test.go`) | Lifecycle record publication, including startup-step durability barrier | ACTIVE |
|
||||
| `INV-LIFECYCLE-STORE-DURABLE-001` | A successful record put/import publishes only after complete replacement records and their directory are durable. Open syncs the records directory before publication. A possibly-applied failure blocks mutations until reopen; recovery reconciles complete old/new records. | M2 lifecycle record publication | `core/lifecycle/record_file.go` `writeRecordDurably`, `writeRecordBatchDurably`; `node_inventory.go` `ImportNodes`; `placement_intent.go` `ImportPlans`; `node_inventory.go`, `store.go`, `placement_intent.go` `putLocked` | `TestNodeInventoryCrashKeepsCompleteRegistration` (`core/lifecycle/node_inventory_crash_test.go`); `TestFileStoreCrashKeepsCompleteRecord`, `TestPlacementStoreCrashKeepsCompleteRecord`, `TestLifecyclePutSyncOrderAndFailure` (`core/lifecycle/store_crash_test.go`); `TestLifecycleStoreParentSync` (`core/lifecycle/store_parent_sync_test.go`); `TestImportStepSyncsChangedFilesThenOneDirectory` (`core/lifecycle/import_step_sync_test.go`); `TestImportSyncfsFailureAndOrdering`, `TestImportSyncfsReturnedFailurePolicyAndReplay`, `TestImportSyncfsCrashBoundaries`, `TestSyncfsKernelGate`, `TestSyncfsFilesystemGate`, `TestImportBatchSelectsSyncfsByFilesystem`, `TestImportDurabilityModeProbesEachStoreDirectory` (`core/lifecycle/import_syncfs_test.go`); `TestRecordEqualityRequiresRecoveredDirectoryAndConsistentDisk` (`core/lifecycle/import_recovery_test.go`); `TestVolumeEqualityRequiresRecovery` (`core/lifecycle/volume_recovery_test.go`); `TestNodeMarshalErrorDoesNotRequireRecovery` (`core/lifecycle/remove_retry_test.go`) | Lifecycle record publication, including startup-step durability barrier | ACTIVE |
|
||||
| `INV-LIFECYCLE-FAILSTOP-001` | A supervised master exits nonzero within one second of a lifecycle put/import or open-barrier persistence failure, independently of logging. It attempts one ERROR; restart completes recovery barriers and import before serving. | Lifecycle process ready/recovering → faulted → exited → recovering | `core/host/master/lifecycle_failure.go` `lifecycleFailStop`; `host.go` `New`; `cmd/blockmaster/main.go` `run`; lifecycle store failure handlers | `TestMasterImportPersistenceFailureExitsAndRecovers` (`cmd/blockmaster/persist_exit_test.go`); `TestLifecyclePersistenceFailureStopsTheProcess`, `TestLifecycleFailStopExitsWithBlockedLogger` (`core/host/master/lifecycle_failure_test.go`) | Manual process-fault/recovery projection of lifecycle record durability; no new wire or format state | ACTIVE |
|
||||
| `INV-VOL-ID-NO-REUSE-001` | A deleted volume id is never created or attached again. | M2 Deleting; M6 purging → deleted | `core/host/master/services.go` `MarkVolumeDeleting`; `core/frontend/chunkstore/layout/create.go` `createVolume` | `TestMarkVolumeDeleting_ReservesUnknownIdsAndSurvivesDeleteAndRestart` (`core/host/master/volume_deleting_test.go`); `TestCreateVolume_OverAnExistingHeadByState` (`core/frontend/chunkstore/layout/create_test.go`) | `ChunkLifecycleFixed` `NoIdReuse` | ACTIVE |
|
||||
| `INV-MASTER-JOURNAL-ISOLATION-001` | Under strict journal isolation, blockmaster gives no new work to a node whose durable root shares the authority store's file system: it refuses that node's heartbeat while it serves no volume, a new placement on it and a move onto it; work the node already has is kept. | M2 workspace move: Acked or Expired → (move refused, nothing written); workspace placement admission; node heartbeat | `core/host/master/journal_isolation.go` `refuseColocatedHeartbeat`, `colocatedTargetRefused`, `reconcilePlacements`, `nodeServesVolumes`; `core/host/master/workspace_service.go` `workspaceMoveCheckLocked`; `core/host/master/workspace_binding.go` `PlaceWorkspace` | `TestColocatedNodeIsAlarmedButAcceptedByDefault`, `TestStrictRefusesColocatedNodeWithoutVolumes`, `TestStrictAcceptsColocatedNodeThatAlreadyServes`, `TestStrictRefusesPlacementAndMoveOntoColocatedNode`, `TestStrictProductLoopSkipsColocatedNodeForNewPlacement` (`core/host/master/journal_isolation_test.go`); `TestStrictReplaysAnIssuedMoveToANowColocatedTarget`, `TestStrictKeepsAnIdempotentPlacementOnANowColocatedNode` (`core/host/master/journal_isolation_fold_test.go`) | — | ACTIVE |
|
||||
@@ -1099,7 +1101,7 @@ Notes:
|
||||
| `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-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 turns the chunk guard on only if the filer definitely refuses a mismatched chunk-condition update of the 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 the guard. | M4 startup | `core/frontend/chunkstore/startup_head_probe.go` `probeChunkCondition`; `catalog_b.go` `Store`, `MetadataGuard`, `Usage` | `TestTheStartupProbeTurnsTheChunkGuardOnOnlyForAFilerThatEnforcesIt` (`core/frontend/chunkstore/startup_chunk_condition_probe_test.go`), `TestCatalogStartupRequiresWrongGenerationHeadRefusal` (`core/frontend/chunkstore/startup_head_probe_test.go`), `TestStatusServer_StatusChunkUsage` (`core/host/volume/status_chunk_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 |
|
||||
| `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 |
|
||||
| `INV-WS-SINGLE-FILER-001` | Startup requires all configured masters to answer and agree on a leader; only that leader listing exactly the target filer and confirming leadership afterward admits. Followers' lists do not decide. Unknown views retry within 60 s. This census does not fence later filer registration. | M4 (startup) → Refused | `core/frontend/chunkstore/single_filer.go` `CheckSingleFiler`; `cmd/blockvolume/chunk_remote.go` `newChunkWiring`; `cmd/sw-block/chunk.go` `refuseUnlessSingleFiler` | `TestSingleFilerCensusUsesTheAgreedLeader`; `TestCheckSingleFilerRefusesAnotherOrSeveralFilers`, `TestCheckSingleFilerFailsClosed`, `TestCheckSingleFilerNeedsEveryMasterToAnswer`, `TestIsTargetComparesScopedAddresses`, `TestCheckSingleFilerPasses` (`core/frontend/chunkstore/single_filer_test.go`), `TestChunkWiringRefusesAMultiFilerGroup` (`cmd/blockvolume/single_filer_test.go`), `TestOpsChunk_WritingCommandsRunTheSingleFilerCheck` (`cmd/sw-block/chunk_start_check_test.go`), `TestOpsChunk_VerifyRunsTheSingleFilerCheck` (`cmd/sw-block/chunk_verify_test.go`) | — | ACTIVE |
|
||||
| `INV-CLI-SINGLE-FILER-CLIENT-001` | Chunk metadata commands refuse missing, typed-nil and non-SWFS clients before catalog access; only a live SWFS client can run the census. | M4 startup client admission | `cmd/sw-block/chunk.go` `checkSingleFiler`, `refuseUnlessSingleFiler` | `TestSingleFilerCheckRefusesUnsupportedClients`, `TestOpsChunkWritingRefusesUnsupportedFilerBeforeCatalogAccess` | — (client capability guard) | ACTIVE |
|
||||
| `INV-WS-LEASE-REGRANT-001` | Re-grant after expiry keeps the same holder and epoch, with no pending move or revocation, a certain store, and one durable write after the horizon/deadline plus skew barrier. Restart begins a new session and voids the old; ordinary reopen keeps HEAD identity (epoch, holder, claim) unchanged. | M2 Expired → Granted; M9 Start | `core/authority/workspace_lease_view.go` `regrantWorkspaceLease`; `core/authority/workspace.go` `forcedMoveBarrierLocked`; `core/frontend/chunkstore/layout/start.go` `Start` | `TestWorkspaceLeaseExpiredSameHolderRegrantIsDurable`, `TestWorkspaceLeaseRegrantWaitsForFullSkew`, `TestWorkspaceLeaseRegrantDefeatsAlreadyPassedForcedPreflight`, `TestWorkspaceLeaseForcedIssueDefeatsOldHolderRegrant`, `TestWorkspaceLeaseRegrantWaitsForDurabilityAndLatchesFailure` (`core/authority/workspace_regrant_test.go`); `TestWorkspaceLeaseRegrantPreservesLocalLogThroughFirstCut` (`core/authority/workspace_regrant_storage_test.go`); `TestStart_OwnEpochFreshRootRefusedBeforeClaim`, `TestStart_OwnEpochSameRootContinues` (`core/frontend/chunkstore/layout/start_test.go`); `TestClaim_WritesItsClaimID`, `TestRunClaim_VoidsTheOldSession` (`core/frontend/chunkstore/layout/claim_test.go`); `TestLocalReopenClaimsBeforeServing` (`core/frontend/durable/provider_reopen_belt_test.go`) | `WorkspaceRegrant` `NoDualServingInc`, `RegrantNoLoss`, `DiskCoversMemory`; `INV-SNAPK-START-ROOT-001` | ACTIVE |
|
||||
@@ -1553,7 +1555,7 @@ Notes:
|
||||
| `INV-SNAPSHOT-DELETE-CONSUME-001` | Only current persisted delete intent authorizes offline reclamation; live roots remain protected, failed effects retain the cursor, and receipt retirement cannot erase work. | M9 idle intent continuation | `core/frontend/chunkstore/layout/delete_intent.go` `RunConsumeSnapshotDeleteIntent`; `core/frontend/chunkstore/layout/remove.go` `Cleaner.removePlanned`; `core/frontend/chunkstore/layout_remote.go` `LayoutRemote.Clean` | `TestConsumeSnapshotDeleteIntent_Closure`, `TestDeleteIntentOfflineAndReplacementPreserved`, `TestDeleteIntentMarkConflictKeepsUnfinishedPage`, `TestLayoutSnapshotDeleteIntentResumesWithoutReceipt`, `TestCatalogDeleteIntentResumesOnePageWithoutNamespaceScan`, `TestCatalogIntentCursorInterruptAndLostReply`, `TestHolderMaintenanceResumesThePersistedDeleteIntent`, `TestHolderMaintenanceIntentIsCancelledBeforeTheCutJoins` | PageChain r2 246,251-253 (az1 13/13); StaleClean 159-161 | ACTIVE |
|
||||
| `INV-SNAPSHOT-DELETE-ADOPT-001` | Publication adopts every intent page with a fresh CAS-base tag and checks it is present, this attempt's and unmarked; stale cleaners/adopters cannot remove or retag a published page, and staging never restores old tags. | M9 delete intent publication | `delete_intent.go` `adoptDeleteIntentPage`, `RunDeleteSnapshotWithIntent`, `StageSnapshotDeletePage` | `TestDeleteIntentRefreshedBaseFencesDelayedCleanerMark`, `TestDeleteIntentRefreshedBaseFencesDelayedCleanerDelete`, `TestDeleteIntentAdoptionCannotRestoreStaleTags`, `TestDeleteIntentStagingNeverRevertsPublishedTags`, `TestDeleteIntentPublicationChecksAdoptedPageMetadata`, `TestGenericIntentStagingCannotUndoRefreshedPublication` | StaleClean 159-161; exact-head refinement read required | DORMANT |
|
||||
| `INV-SNAPSHOT-DELETE-ADOPT-002` | After adopting an intent page under its own tag, publication reads the page again and authenticates it; a page that no longer reads or holds other bytes refuses the publication. The filer frees chunks from a deletion queue, so a reference whose chunk is still queued reads intact and publishes. | M9 delete intent publication | `delete_intent.go` `RunDeleteSnapshotWithIntent`, `readListPage` | `TestASnapshotDeleteIsNotPublishedOverAPageWhoseDataWasFreed` (`core/frontend/chunkstore/layout/delete_intent_reread_test.go`); store witness `TestWithoutTheChunkGuardAStaleMetadataChangeOverwritesARecreatedObject` (`core/frontend/chunkstore/layout_change_meta_recreated_test.go`) | MetaABA r2, checked outside the repository: the re-read alone does not hold `PublishedReadable` once the filer frees chunks later from a queue (`mut_reread_delayed`); with the chunk guard it holds (`safe_chunks_equal`). r1's `safe_reread_only` held only for immediate frees (historical scope) | ACTIVE |
|
||||
| `INV-LAYOUT-META-CHUNKS-001` | With the chunk guard on, an adoption or mark writes its looked-up entry back only while the entry's chunk fids are unchanged, so it cannot land on an object deleted and created again since its lookup; a cleaner's delete expects its own mark, so it follows. | M9 delete intent publication | `core/frontend/chunkstore/layout_store.go` `changeMeta`; `swfs.go` `UpdateEntryIfChunks` | `TestAStaleMetadataChangeDoesNotOverwriteARecreatedObject`, `TestAStaleCleanerMarkDoesNotDeleteARecreatedObject`, `TestWithTheChunkGuardAnUnchangedObjectIsStillAdoptedMarkedAndDeleted` (`core/frontend/chunkstore/layout_change_meta_recreated_test.go`) | MetaABA r2, checked outside the repository: `PublishedReadable` (`safe_chunks_equal`, `safe_legacy_chunks_equal`) | ACTIVE |
|
||||
| `INV-LAYOUT-META-CHUNKS-001` | With the chunk guard on, an adoption or mark writes its looked-up entry back only while the entry's chunk fids are unchanged, so it cannot land on an object deleted and created again since its lookup; a cleaner's delete expects its own mark, so it follows. | M9 delete intent publication; M9 clean(c) removal | `core/frontend/chunkstore/layout_store.go` `changeMeta`, `chunkCondition`; `swfs.go` `UpdateEntryIfChunks` | `TestAStaleMetadataChangeDoesNotOverwriteARecreatedObject`, `TestAStaleCleanerMarkDoesNotDeleteARecreatedObject`, `TestWithTheChunkGuardAnUnchangedObjectIsStillAdoptedMarkedAndDeleted` (`core/frontend/chunkstore/layout_change_meta_recreated_test.go`); `TestChunkGuardReportsOnlyAConditionTheFilerCanCarry` (`core/frontend/chunkstore/chunk_guard_report_test.go`); `TestOpsChunkStaleCLIAdoptionDoesNotOverwriteARecreatedObject` (`cmd/sw-block/chunk_guard_probe_test.go`) | MetaABA r2, checked outside the repository: `PublishedReadable` (`safe_chunks_equal`, `safe_legacy_chunks_equal`) | ACTIVE |
|
||||
|
||||
The snapshot-delete consumer and list-page retirement above are reachable through holder maintenance and covered by Go assertions. Their ACTIVE status describes that reachability and test coverage, not fresh Linux, composed-operation or release qualification. Cut and upload-intent producers remain deferred; their dormant publication rows are not activated by this consumer slice.
|
||||
|
||||
|
||||
@@ -117,7 +117,25 @@ systemd and root access.
|
||||
|
||||
## 1. Install the binaries and units
|
||||
|
||||
After creating and mounting a dedicated blockmaster state filesystem, run `sync` before starting blockmaster. This commits the installer's mount-point entry on its parent filesystem. Startup syncs the state filesystem through its mount root; it does not commit mount-point entries on another filesystem. See [directory recovery](design/lifecycle-directory-sync.md).
|
||||
**Plan blockmaster's state storage before starting it.** Keep the holders' local data off blockmaster's state
|
||||
filesystem. With the shipped unit, the state directory is `/var/lib/sw-block-master`, including the authority and
|
||||
lifecycle stores. A different directory on the same filesystem is not enough.
|
||||
|
||||
v1.1.2 stops the startup's ancestor sync at the state filesystem's boundary, so a dedicated state filesystem
|
||||
isolates the startup syncs; run `sync` after creating and mounting it. This commits the installer's mount-point
|
||||
entry on its parent filesystem. A failed device lookup logs a fallback to the full ancestor walk. See
|
||||
[directory recovery](design/lifecycle-directory-sync.md).
|
||||
|
||||
Under heavy writes on the state filesystem, an `fsync` when blockmaster opens its state directory can wait for the
|
||||
filesystem journal. In v1.1.2, startup also runs a `syncfs` for each store with changed import records on ext4, XFS,
|
||||
btrfs or tmpfs (Linux 5.8 or later), which waits for every pending write on that filesystem, including any holders'
|
||||
data there. Starts took from about 20 seconds to over 150 seconds in our shared-filesystem tests (one start was not
|
||||
ready after 2 minutes); this is not an upper bound. A volume whose lease expires stops serving until blockmaster is
|
||||
back; it is then granted again on the same holder, with its data. A forced move during that time can lose writes
|
||||
after the last published HEAD (see [forced move](volume-lifecycle.md#after-a-crash)). Restart blockmaster at low
|
||||
write load on the state filesystem, including when the cluster spec has not changed. v1.1.1 still syncs ancestors
|
||||
through `/`; its [restart known issue](releases/v1.1.1.md#known-issue-blockmaster-restart-can-stall-on-a-busy-filesystem)
|
||||
retains the earlier isolation guidance.
|
||||
|
||||
1. **Get the repository at the release tag, then the binaries.** The repository holds the units in `deploy/`. The
|
||||
binaries are `blockmaster`, `blockvolume` and `sw-block`, all three from the same release. `TAG` is the release,
|
||||
@@ -242,7 +260,8 @@ with its size and home placement. A volume's record comes from the cluster spec:
|
||||
```
|
||||
|
||||
blockmaster reads the cluster spec only when it starts. After editing the spec, run
|
||||
`sudo systemctl restart sw-blockmaster`. Serving volumes keep serving across that restart.
|
||||
`sudo systemctl restart sw-blockmaster`. A restart that outlasts the running volumes' leases makes them fence;
|
||||
follow the state-storage and low-write-load guidance in section 1 before restarting.
|
||||
|
||||
blockmaster must run under systemd or an equivalent restart supervisor. A node, placement
|
||||
or volume lifecycle record write or recovery-directory sync failure attempts one `ERROR` naming the store,
|
||||
@@ -581,7 +600,9 @@ writing the v1.0 format until you finalize. Until then you can go back.
|
||||
sw-block cluster format-level --master 127.0.0.1:9180 # format level 0
|
||||
```
|
||||
|
||||
Volumes keep serving.
|
||||
Volumes keep serving only if the restart completes before their leases expire; otherwise they fence.
|
||||
Follow the [state-storage and low-write-load restart guidance](#1-install-the-binaries-and-units), including
|
||||
during upgrades.
|
||||
|
||||
4. **Each holder.** Install the new binary once per host, then restart each volume on that host:
|
||||
|
||||
|
||||
@@ -24,6 +24,12 @@ v1.1.1 is a fix release of the v1.1 line. None of its changes alters a stored fo
|
||||
- **Where it starts:** we estimate around 150 declared volumes; it depends on the disk under blockmaster's state directory.
|
||||
- **What to do:** restart blockmaster in a maintenance window if a cluster declares more than about 150 volumes. A fix is planned for v1.1.2; in our test with it, 999 volumes restarted in under 6 s including the stop, and no volume stopped.
|
||||
|
||||
## Known issue: blockmaster restart can stall on a busy filesystem
|
||||
|
||||
- **Trigger:** blockmaster's state directory or its ancestors share a filesystem with heavy writes, such as the holders' local data.
|
||||
- **Effect:** opening the state directory calls `fsync`, which can wait for the filesystem journal. In v1.1.2, when the import has changed records, startup also runs a `syncfs` for each store with changed records on ext4, XFS, btrfs or tmpfs (Linux 5.8 or later), which waits for every pending write on that filesystem, including the holders' data. Starts took from about 20 seconds to over 150 seconds in our tests (one start was not ready after 2 minutes); this is not an upper bound. A volume whose lease expires stops serving until blockmaster is back; it is then granted again on the same holder, with its data. A forced move during that time can lose writes after the last published HEAD (see [forced move](../volume-lifecycle.md#after-a-crash)).
|
||||
- **What to do:** keep the holders' data off both the state directory's filesystem and the filesystem holding its ancestor directories. In practice, put the holders' data on its own filesystem, not the root filesystem. A different directory on the same filesystem is not enough. A dedicated state-directory mount alone does not isolate every startup sync: opening the store also syncs ancestors up to `/`, including `/var/lib` and `/var` with the shipped layout. Restart blockmaster at low write load on all those filesystems. This limitation also applies when the cluster spec has not changed.
|
||||
|
||||
## Known issue: blockmaster needs its filer to start
|
||||
|
||||
- blockmaster checks that its SeaweedFS filer answers before it starts. If the filer is unreachable, blockmaster stops with an error after about 60 s instead of starting.
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
# v1.1.2
|
||||
|
||||
v1.1.2 is not yet released.
|
||||
|
||||
## Known issue: blockmaster restart can stall on a busy filesystem
|
||||
|
||||
- **Trigger:** blockmaster's state filesystem also holds heavy writes, such as the holders' local data.
|
||||
- **Effect:** blockmaster's start syncs its state directories, which can wait for the filesystem journal. When the import has changed records, it also runs a `syncfs` for each store with changed records on ext4, XFS, btrfs or tmpfs (Linux 5.8 or later), which waits for every pending write on that filesystem, including the holders' data. Starts took from about 20 seconds to over 150 seconds in our tests (one start was not ready after 2 minutes); this is not an upper bound. A volume whose lease expires stops serving until blockmaster is back; it is then granted again on the same holder, with its data. A forced move during that time can lose writes after the last published HEAD (see [forced move](../volume-lifecycle.md#after-a-crash)).
|
||||
- **What to do:** v1.1.2 stops the startup's ancestor sync at the state filesystem's boundary, so a dedicated state filesystem isolates the startup syncs; run `sync` after creating and mounting it. Keep holders' data off that filesystem; a different directory on it is not enough. Restart blockmaster at low write load on the state filesystem, including when the cluster spec has not changed. If device lookup fails, a logged fallback retains the full ancestor walk.
|
||||
@@ -468,7 +468,7 @@ Chunk store usage of a walstore-chunk volume (only with --chunk-control-endpoint
|
||||
| `dependents` | int | — |
|
||||
| `own_chunks` | int | — |
|
||||
| `foreign_chunks` | int | — |
|
||||
| `metadata_guard` | string | MetadataGuard names the protection of the volume's metadata changes: filer_chunk_condition (the startup probe saw the filer enforce the chunk condition) or page_reread_only (enforcement was not established at startup; delete intent pages are re-read). |
|
||||
| `metadata_guard` | string | MetadataGuard names the protection of the volume's metadata changes: filer_chunk_condition (the startup probe saw the filer enforce the chunk condition) or page_reread_only (enforcement was not established at startup; delete intent pages are re-read). Absent when the catalog ran no probe. (omitted when empty) |
|
||||
|
||||
### `GET /status/nvme`
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ cmd/sw-block/chunk.go refuseUnlessSingleFilerWithin context.WithTimeoutCause 1 p
|
||||
cmd/sw-block/chunk.go chunkPost time.Now().Add 1 pending-fix CutTime.Poll remaining snapshot/detach HTTP waiter bound; fix #979 (manual cuts use chunkObserveCut)
|
||||
cmd/sw-block/chunk.go chunkPostUntil context.WithDeadline 1 pending-fix CutTime.Poll remaining snapshot/detach HTTP waiter bound; fix #979 (manual cuts use chunkObserveCut)
|
||||
cmd/sw-block/chunk.go chunkSnapshot time.Now().Add 1 control-timer CutTime.Poll snapshot expiry: a timestamp (validity, expiry or due time), not a wait
|
||||
cmd/sw-block/chunk_b.go bCatalog context.WithTimeout 1 per-call NONE: no model row maps this file yet the chunk condition probe of a writing command (operator --timeout; the probe's own 10 s and cleanup 5 s still apply)
|
||||
cmd/sw-block/chunk_b.go volumeFlags.ref context.WithTimeout 1 per-call NONE: no model row maps this file yet one CLI request (operator --timeout)
|
||||
cmd/sw-block/chunk_b.go bCommand.run context.WithTimeout 1 pending-fix NONE: no model row maps this file yet unmeasured: applies each catalog command's own budget (its newBCommand row); open while snapshot delete and retain are unmeasured
|
||||
cmd/sw-block/chunk_b.go chunkSnapshots newBCommand 1 per-call NONE: no model row maps this file yet lists one volume's snapshot names from one HEAD read (30 s)
|
||||
|
||||
|
@@ -694,7 +694,9 @@ func (fs *FilerServer) moveSelfEntry(ctx context.Context, stream filer_pb.Seawee
|
||||
IsFromOtherCluster: false,
|
||||
Signatures: nil,
|
||||
},
|
||||
TsNs: time.Now().UnixNano(),
|
||||
// The stamp of the event that covers the move: the wall clock can
|
||||
// trail the log's stamps, and the client versions its cache by them.
|
||||
TsNs: newEntry.CommitTsNs,
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -754,7 +756,7 @@ func (fs *FilerServer) moveSelfEntry(ctx context.Context, stream filer_pb.Seawee
|
||||
IsFromOtherCluster: false,
|
||||
Signatures: nil,
|
||||
},
|
||||
TsNs: time.Now().UnixNano(),
|
||||
TsNs: newEntry.CommitTsNs,
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/weed/filer"
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
|
||||
@@ -92,3 +93,57 @@ func TestStreamRenameEndsItsTransaction(t *testing.T) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// The client applies each response at its TsNs over versions its own writes
|
||||
// left at their log stamps. Where the wall clock is coarse (Windows), those
|
||||
// stamps run ahead of it: a response stamped from the clock lands below the
|
||||
// source's last write, and the client keeps the name the rename took away.
|
||||
func TestStreamRenameResponsesStampAboveEarlierEvents(t *testing.T) {
|
||||
cases := []struct {
|
||||
name string
|
||||
store func() *renameTestStore
|
||||
oldName, newName string
|
||||
}{
|
||||
{"file over a file", func() *renameTestStore {
|
||||
store := newRenameTestStore()
|
||||
store.entries["/dir"] = newDirectoryEntry("/dir", 100)
|
||||
store.entries["/dir/src.txt"] = newFileEntry("/dir/src.txt", 101)
|
||||
store.entries["/dir/dst.txt"] = newFileEntry("/dir/dst.txt", 102)
|
||||
return store
|
||||
}, "src.txt", "dst.txt"},
|
||||
{"file over a file in place", func() *renameTestStore {
|
||||
store := newInPlaceRenameStore()
|
||||
store.entries["/dir/dst.txt"] = fileEntryWithChunk("/dir/dst.txt", 202, "2,0b02")
|
||||
return store
|
||||
}, "src.txt", "dst.txt"},
|
||||
{"directory with a child", func() *renameTestStore {
|
||||
store := newRenameTestStore()
|
||||
store.entries["/dir"] = newDirectoryEntry("/dir", 100)
|
||||
store.entries["/dir/a"] = newDirectoryEntry("/dir/a", 101)
|
||||
store.entries["/dir/a/x.txt"] = newFileEntry("/dir/a/x.txt", 102)
|
||||
return store
|
||||
}, "a", "b"},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
f := newRenameTestFiler(t, tc.store())
|
||||
earlier := f.LocalDeliveredThroughTsNs(time.Now().Add(time.Hour).UnixNano())
|
||||
server := &FilerServer{filer: f, entryLockTable: util.NewLockTable[util.FullPath]()}
|
||||
stream := &renameTestStream{}
|
||||
if err := server.StreamRenameEntry(&filer_pb.StreamRenameEntryRequest{
|
||||
OldDirectory: "/dir", OldName: tc.oldName, NewDirectory: "/dir", NewName: tc.newName,
|
||||
}, stream); err != nil {
|
||||
t.Fatalf("StreamRenameEntry: %v", err)
|
||||
}
|
||||
if len(stream.sent) == 0 {
|
||||
t.Fatal("no responses")
|
||||
}
|
||||
for i, resp := range stream.sent {
|
||||
if resp.TsNs <= earlier {
|
||||
t.Errorf("response %d (%s -> %s) stamped %d, not above %d stamped before the rename", i,
|
||||
resp.EventNotification.GetOldEntry().GetName(), resp.EventNotification.GetNewEntry().GetName(), resp.TsNs, earlier)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user