mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 18:47:20 +01:00
Compare commits
31
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f52c0960ce | ||
|
|
a1219cd304 | ||
|
|
98c8e3938d | ||
|
|
63ca9b2883 | ||
|
|
559f69e955 | ||
|
|
15129d39c0 | ||
|
|
489f6d2696 | ||
|
|
6ccd3bfd2e | ||
|
|
8e3c2b81a6 | ||
|
|
5e224c4057 | ||
|
|
58df877faa | ||
|
|
aa16ffa7a5 | ||
|
|
77fa10070e | ||
|
|
64eddb3484 | ||
|
|
3a5de69079 | ||
|
|
031312357b | ||
|
|
9790c07bfd | ||
|
|
3759fae784 | ||
|
|
ebf6b8010a | ||
|
|
50d5cdcf18 | ||
|
|
efb91181e0 | ||
|
|
dcfc41445a | ||
|
|
aec98979c7 | ||
|
|
ac18390a51 | ||
|
|
e4e9e57e9b | ||
|
|
55294a9835 | ||
|
|
8719e9cace | ||
|
|
330797ba8b | ||
|
|
5c1c1c75b4 | ||
|
|
e883ade9be | ||
|
|
5c679df1cf |
No files matched your search
+32
-27
@@ -3,8 +3,6 @@ name: Publish alpha images
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
tags:
|
||||
- "v*"
|
||||
|
||||
@@ -19,10 +17,14 @@ env:
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
# Publish only from a version tag; a manual run from a branch must not move :alpha.
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # the tag list decides whether :alpha moves
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
@@ -39,33 +41,36 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
# vX.Y.Z-pre (a release candidate) publishes only its own version tag. A stable vX.Y.Z also
|
||||
# publishes sha-*, and moves :alpha only when it is the highest stable version tag, so a later
|
||||
# patch on an older line never moves :alpha back.
|
||||
short_sha="${GITHUB_SHA::12}"
|
||||
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
|
||||
version="${GITHUB_REF_NAME}"
|
||||
{
|
||||
echo "block_tags<<EOF"
|
||||
echo "${BLOCK_IMAGE}:${version}"
|
||||
echo "${BLOCK_IMAGE}:alpha"
|
||||
echo "${BLOCK_IMAGE}:sha-${short_sha}"
|
||||
echo "EOF"
|
||||
echo "csi_tags<<EOF"
|
||||
echo "${CSI_IMAGE}:${version}"
|
||||
echo "${CSI_IMAGE}:alpha"
|
||||
echo "${CSI_IMAGE}:sha-${short_sha}"
|
||||
echo "EOF"
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
{
|
||||
echo "block_tags<<EOF"
|
||||
echo "${BLOCK_IMAGE}:alpha"
|
||||
echo "${BLOCK_IMAGE}:sha-${short_sha}"
|
||||
echo "EOF"
|
||||
echo "csi_tags<<EOF"
|
||||
echo "${CSI_IMAGE}:alpha"
|
||||
echo "${CSI_IMAGE}:sha-${short_sha}"
|
||||
echo "EOF"
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
version="${GITHUB_REF_NAME}"
|
||||
if [[ ! "${version}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.]+)?$ ]]; then
|
||||
echo "refusing to publish: tag ${version} is not vX.Y.Z or vX.Y.Z-pre" >&2
|
||||
exit 1
|
||||
fi
|
||||
stable=false
|
||||
move_alpha=false
|
||||
if [[ "${version}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
stable=true
|
||||
highest="$(git tag -l 'v*' | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -n 1)"
|
||||
if [[ "${version}" == "${highest}" ]]; then
|
||||
move_alpha=true
|
||||
fi
|
||||
fi
|
||||
{
|
||||
echo "block_tags<<EOF"
|
||||
echo "${BLOCK_IMAGE}:${version}"
|
||||
if [[ "${stable}" == true ]]; then echo "${BLOCK_IMAGE}:sha-${short_sha}"; fi
|
||||
if [[ "${move_alpha}" == true ]]; then echo "${BLOCK_IMAGE}:alpha"; fi
|
||||
echo "EOF"
|
||||
echo "csi_tags<<EOF"
|
||||
echo "${CSI_IMAGE}:${version}"
|
||||
if [[ "${stable}" == true ]]; then echo "${CSI_IMAGE}:sha-${short_sha}"; fi
|
||||
if [[ "${move_alpha}" == true ]]; then echo "${CSI_IMAGE}:alpha"; fi
|
||||
echo "EOF"
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Build and push block image
|
||||
uses: docker/build-push-action@v6
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ jobs:
|
||||
# train/* of this repository, a few a day) also runs on the team's runners:
|
||||
# it is the merge gate, and the organization's shared GitHub-hosted queue held
|
||||
# it 30-55 minutes before it started. A PR from a fork never runs there.
|
||||
runs-on: ${{ (github.event_name == 'push' || (github.event.pull_request.head.repo.full_name == github.repository && startsWith(github.head_ref, 'train/'))) && 'tp04-seaweed-block' || 'ubuntu-latest' }}
|
||||
runs-on: ${{ (github.event_name == 'push' || (github.event.pull_request.head.repo.full_name == github.repository)) && 'tp04-seaweed-block' || 'ubuntu-latest' }}
|
||||
# process: 44 tests in 4 parallel shards of about 13 min each (55 min in sequence).
|
||||
timeout-minutes: ${{ matrix.suite == 'unit' && 40 || 90 }}
|
||||
env:
|
||||
|
||||
+8
-16
@@ -46,12 +46,12 @@ not format or write the attached device; it only creates local backing files
|
||||
and logs. It needs Linux, bash, `nvme-cli`, `sudo` and the binaries
|
||||
above. To format and write, use the [write test](docs/standalone-deployment.md#write-test-scratch-host-only) (scratch host only).
|
||||
|
||||
### On main, coming in v1.0.1: `sw-block mini`
|
||||
### `sw-block mini`
|
||||
|
||||
`main` is unreleased: use it for a trial on a scratch host, not for data you keep. One command starts a single-host
|
||||
A trial on a scratch host, not for data you keep. One command starts a single-host
|
||||
trial on loopback, with SeaweedFS's `weed mini` as the chunk store (run against SeaweedFS 4.53). Build all three
|
||||
binaries from `main` and run the one you built, so that `mini` finds its matching `blockmaster` and `blockvolume`
|
||||
next to it:
|
||||
binaries from the same checkout and run the one you built, so that `mini` finds its matching `blockmaster` and
|
||||
`blockvolume` next to it:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/seaweedfs/seaweed-block && cd seaweed-block
|
||||
@@ -144,21 +144,13 @@ measured.
|
||||
Seaweed Block is block storage for AI agent workspaces: one local-speed disk per sandbox or microVM, with its history
|
||||
(snapshots, restores, moves) in your own SeaweedFS. The same core serves Kubernetes block volumes (alpha).
|
||||
|
||||
- **Works today (v1.0.0):** single-replica volumes up to 256 GiB over NVMe/TCP or iSCSI; scheduled and manual
|
||||
- **Works today (v1.0.1):** single-replica volumes up to 256 GiB over NVMe/TCP or iSCSI; scheduled and manual
|
||||
snapshots; restore into a new volume; a planned hand-over to another machine (run across two machines on the
|
||||
release candidate); a forced move after a host is lost, from the volume's last cut (tested with two server
|
||||
identities on one machine); volume delete. Each is a documented sequence of `sw-block ops` commands and systemd
|
||||
units.
|
||||
- **Next, planned for v1.0.1** (still single replica):
|
||||
- `sw-block mini`: one command that starts a single-host trial;
|
||||
- whole-job volume commands, each one command: `sw-block volume start`, `stop` (it publishes the volume's changes
|
||||
first), `backup` and `restore`;
|
||||
- `sw-block shell` for inspection: status, lists, and `cluster.check`, a fixed list of checks whose troubleshooting
|
||||
page says what to do for each;
|
||||
- a log bundle without secrets, for bug reports;
|
||||
- a working `ops chunk verify`.
|
||||
|
||||
The recovery point above does not change in v1.0.1.
|
||||
units. v1.0.1 adds `sw-block mini`, a single-host trial; whole-job volume commands (`sw-block volume start`,
|
||||
`stop`, `backup`, `restore`); `sw-block shell` for inspection, with `cluster.check` and a troubleshooting page; a
|
||||
log bundle without secrets; and a working `ops chunk verify` (see the [v1.0.1 note](docs/releases/v1.0.1.md)).
|
||||
- **After that, planned:** volumes up to 1 TiB (v1.1); replicated volumes beyond the preview; export of a snapshot to another object store, and
|
||||
import from it; `volume fork` and `volume move` commands.
|
||||
|
||||
|
||||
@@ -4,12 +4,16 @@ package main_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"syscall"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout"
|
||||
)
|
||||
|
||||
// Power loss on a chunk volume (INV-FE-FLUSH-SYNC-001),
|
||||
@@ -27,7 +31,7 @@ import (
|
||||
// 2. image B over the same LBAs, flushed, one more write without a flush,
|
||||
// then a power cut (image A in HEAD must not show through);
|
||||
// 3. a new image flushed, a cut started, a power cut while it uploads (the
|
||||
// delay adapts until chunk objects reached the filer but HEAD did not move).
|
||||
// first applied object-create reply is held until the holder is killed).
|
||||
//
|
||||
// Environment: SWBLOCK_REPLAY_ROOT and SWBLOCK_REPLAY_CUT as for
|
||||
// TestPowerLossReplayAckedWritesSurvive; CHUNKSTORE_WEED; optional
|
||||
@@ -40,7 +44,19 @@ func TestPowerLossReplayChunkVolume(t *testing.T) {
|
||||
if root == "" || cutTool == "" {
|
||||
t.Fatalf("SWBLOCK_REPLAY_ROOT=%q and SWBLOCK_REPLAY_CUT=%q must be set together", root, cutTool)
|
||||
}
|
||||
env := startHandoffEnvWith(t, 1, []string{"v2"})
|
||||
if testListenHost() != "127.0.0.1" {
|
||||
t.Fatal("causal filer fixture requires loopback")
|
||||
}
|
||||
var boundary *snapshotFilerBoundary
|
||||
cluster := startWorkspaceWeedWith(t, t.TempDir(), w4WeedOpts{VolumeSizeLimitMB: 256, VolumeMax: 32,
|
||||
FilerBind: "127.0.0.2", FilerFront: func(c *w4WeedCluster) { boundary = newSnapshotFilerBoundary(t, c) }})
|
||||
env := startHandoffEnvOnCluster(t, 1, []string{"v2"}, procedureTLSConfig(), false, cluster)
|
||||
id, err := layout.ParseVolumeID(env.layoutID("v1"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
boundary.id = id
|
||||
boundary.dir = path.Join(env.chunkPath, layout.VolumeDir("v1", id))
|
||||
if d := os.Getenv("SWBLOCK_REPLAY_LOGS"); d != "" {
|
||||
t.Cleanup(func() { copyLogs(t, env.h.dir, d) })
|
||||
}
|
||||
@@ -49,7 +65,7 @@ func TestPowerLossReplayChunkVolume(t *testing.T) {
|
||||
env.hosts["s1"] = h
|
||||
env.volExtra = []string{"--chunk-capture-interval", "0", "--chunk-snapshot-schedule", "off"}
|
||||
cut := []string{"ops", "chunk", "cut", "--volume", "v1", "--status-addr", env.hosts["s1"].status}
|
||||
verify := []string{"ops", "chunk", "verify", "--volume", "v1", "--chunk-filer", env.cluster.filerGRPC, "--chunk-path", env.chunkPath, "--depth", "data", "--timeout", "5m"}
|
||||
verify := []string{"ops", "chunk", "verify", "--master", env.h.masterAddr, "--volume", "v1", "--chunk-filer", env.cluster.filerGRPC, "--chunk-path", env.chunkPath, "--depth", "data", "--timeout", "5m"}
|
||||
headGen := func() uint64 {
|
||||
out, _ := env.h.command(t, env.chunkShow()...)
|
||||
hd, err := parseLayoutHead(out)
|
||||
@@ -67,13 +83,16 @@ func TestPowerLossReplayChunkVolume(t *testing.T) {
|
||||
// a new generation (a cut that uploads nothing would leave it). frozenGen,
|
||||
// when not 0, is the HEAD generation seen while frozen: it must still hold
|
||||
// after the kill, so no HEAD write from before the freeze landed later.
|
||||
powerCut := func(phase string, img byte, frozenGen uint64, advance bool) {
|
||||
powerCut := func(phase string, img byte, frozenGen uint64, advance bool, afterKill func()) {
|
||||
t.Helper()
|
||||
if err := holder.proc.Signal(syscall.SIGSTOP); err != nil {
|
||||
t.Fatalf("%s: freeze the holder: %v", phase, err)
|
||||
}
|
||||
runReplayCut(t, cutTool, "mark")
|
||||
holder.kill(t)
|
||||
if afterKill != nil {
|
||||
afterKill()
|
||||
}
|
||||
if frozenGen != 0 {
|
||||
if g := headGen(); g != frozenGen {
|
||||
t.Fatalf("%s: HEAD moved from gen %d to %d after the freeze: the cut was not in progress at the mark", phase, frozenGen, g)
|
||||
@@ -99,10 +118,8 @@ func TestPowerLossReplayChunkVolume(t *testing.T) {
|
||||
|
||||
// Phase 1: a committed cut before the power cut.
|
||||
env.writeCutCrashImage(t, 'A')
|
||||
cutStart := time.Now()
|
||||
env.h.command(t, cut...)
|
||||
cutTook := time.Since(cutStart)
|
||||
powerCut("phase 1 (after a committed cut)", 'A', 0, false)
|
||||
powerCut("phase 1 (after a committed cut)", 'A', 0, false, nil)
|
||||
|
||||
// Phase 2: overwrite with B; then a write the guest never flushed.
|
||||
env.writeCutCrashImage(t, 'B')
|
||||
@@ -117,7 +134,7 @@ func TestPowerLossReplayChunkVolume(t *testing.T) {
|
||||
defer c.close()
|
||||
c.write(t, extra, cutCrashBlock('x', extra))
|
||||
}()
|
||||
powerCut("phase 2 (between a write and its flush)", 'B', 0, true)
|
||||
powerCut("phase 2 (between a write and its flush)", 'B', 0, true, nil)
|
||||
func() {
|
||||
c := dialNVMe(t, env.hosts["s1"].nvme, plannedHandoffNQN)
|
||||
defer c.close()
|
||||
@@ -127,50 +144,37 @@ func TestPowerLossReplayChunkVolume(t *testing.T) {
|
||||
}
|
||||
}()
|
||||
|
||||
// Phase 3: a power cut while a cut uploads.
|
||||
delay := cutTook / 2
|
||||
img, landed := byte('B'), false
|
||||
for attempt := 1; attempt <= cutCrashAttempts && !landed; attempt++ {
|
||||
img++
|
||||
env.writeCutCrashImage(t, img)
|
||||
gen, entries := headGen(), f1FilerEntries(t, env)
|
||||
done := make(chan int, 1)
|
||||
go func() {
|
||||
_, _, code := env.h.run(t, cut...)
|
||||
done <- code
|
||||
}()
|
||||
time.Sleep(delay)
|
||||
if err := holder.proc.Signal(syscall.SIGSTOP); err != nil {
|
||||
t.Fatalf("phase 3: freeze the holder: %v", err)
|
||||
}
|
||||
time.Sleep(time.Second) // a HEAD write already on the wire lands before the reading
|
||||
uploaded, after := f1FilerEntries(t, env)-entries, headGen()
|
||||
switch {
|
||||
case after != gen:
|
||||
t.Logf("phase 3 attempt %d: the cut committed before %s (HEAD gen %d -> %d); shorter", attempt, delay, gen, after)
|
||||
delay /= 2
|
||||
case uploaded <= 0:
|
||||
t.Logf("phase 3 attempt %d: nothing uploaded by %s; longer", attempt, delay)
|
||||
delay *= 2
|
||||
default:
|
||||
landed = true
|
||||
t.Logf("phase 3 attempt %d: frozen at %s mid-upload: %d new filer entries, HEAD still gen %d", attempt, delay, uploaded, gen)
|
||||
}
|
||||
if landed {
|
||||
// Still frozen mid-upload: the power cut starts from here (its
|
||||
// SIGSTOP is a no-op on a stopped process).
|
||||
powerCut(fmt.Sprintf("phase 3 attempt %d (cut in progress)", attempt), img, gen, true)
|
||||
<-done
|
||||
break
|
||||
}
|
||||
if err := holder.proc.Signal(syscall.SIGCONT); err != nil {
|
||||
t.Fatalf("phase 3: resume: %v", err)
|
||||
}
|
||||
// Phase 3: hold the stock filer's first applied object-create answer.
|
||||
// Begin itself advances HEAD; generation movement is not proof of Commit.
|
||||
// Observe an open session and unchanged Current at the actual object boundary.
|
||||
img := byte('C')
|
||||
env.writeCutCrashImage(t, img)
|
||||
beforeHead := boundary.head(t)
|
||||
reached := boundary.arm("OBJECT", "")
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 150*time.Second)
|
||||
defer cancel()
|
||||
done := make(chan struct{})
|
||||
go func() { defer close(done); _, _, _, _ = runCLI(ctx, env.h, cut...) }()
|
||||
t.Cleanup(func() { cancel(); boundary.unblock(); <-done })
|
||||
select {
|
||||
case <-reached:
|
||||
case <-time.After(30 * time.Second):
|
||||
cancel()
|
||||
boundary.unblock()
|
||||
<-done
|
||||
t.Fatal("inconclusive: cut never reached applied object boundary")
|
||||
}
|
||||
if !landed {
|
||||
t.Fatalf("no power cut landed while a cut uploaded, in %d attempts", cutCrashAttempts)
|
||||
if err := holder.proc.Signal(syscall.SIGSTOP); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
frozen := boundary.head(t)
|
||||
if frozen.Activity.Kind != layout.ActSnap || frozen.Activity.Session == "" || frozen.Current == nil || beforeHead.Current == nil || *frozen.Current != *beforeHead.Current {
|
||||
t.Fatalf("object boundary is not an open unpublished cut: before=%+v frozen=%+v", beforeHead, frozen)
|
||||
}
|
||||
t.Logf("phase 3: applied object held, HEAD gen=%d open session=%s Current unchanged", frozen.Gen, frozen.Activity.Session)
|
||||
// Mark and kill while the holder is stopped, then release the old RPC before
|
||||
// checking the exact frozen HEAD and restarting from the replayed device.
|
||||
powerCut("phase 3 (cut in progress)", img, frozen.Gen, true, func() { boundary.unblock(); <-done })
|
||||
// What the filer holds is the image: a snapshot restored into a new volume.
|
||||
env.snapshot(t, "s1", "v1", "after-power-cuts")
|
||||
env.restoreInto(t, "v1", "after-power-cuts", "v2")
|
||||
|
||||
@@ -361,6 +361,13 @@ func chunkErrorCode(err error) (int, string, bool) {
|
||||
return http.StatusServiceUnavailable, codeHostSlotBusy, true
|
||||
case errors.Is(err, storage.ErrChunkCaptureRefused):
|
||||
return http.StatusServiceUnavailable, "capture_refused", true
|
||||
case errors.Is(err, layout.ErrPrecondition):
|
||||
// Last before default: a catalog transition (a snapshot delete) lost
|
||||
// its conditional HEAD write to another writer (a cleaning's begin);
|
||||
// nothing of it applied, and a retry reads HEAD again. Every other
|
||||
// cause an error also carries (terminal, uncertain or retryable)
|
||||
// decides first.
|
||||
return http.StatusConflict, codeHeadConflict, true
|
||||
default:
|
||||
return http.StatusInternalServerError, codeInternal, false
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
|
||||
"github.com/seaweedfs/seaweed-block/core/engine"
|
||||
"github.com/seaweedfs/seaweed-block/core/frontend/chunkstore"
|
||||
"github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout"
|
||||
"github.com/seaweedfs/seaweed-block/core/frontend/durable"
|
||||
"github.com/seaweedfs/seaweed-block/core/storage"
|
||||
)
|
||||
@@ -218,6 +219,14 @@ func TestStatusServer_ChunkErrorBodyIsTyped(t *testing.T) {
|
||||
{fmt.Errorf("%w: %w", storage.ErrChunkReconciling, context.DeadlineExceeded), "reconciling", 409, true},
|
||||
{fmt.Errorf("x: %w", storage.ErrChunkCASOutcomeUnknown), "outcome_unknown", 503, true},
|
||||
{fmt.Errorf("x: %w", storage.ErrChunkHeadPrecondition), "head_conflict", 409, true},
|
||||
{fmt.Errorf("x: %w", layout.ErrPrecondition), "head_conflict", 409, true}, // a raced catalog transition (snapshot delete)
|
||||
// The precondition is the last cause to decide: joined with any
|
||||
// terminal one, that one is reported.
|
||||
{errors.Join(storage.ErrChunkLayerClosed, layout.ErrPrecondition), "closing", 503, false},
|
||||
{errors.Join(storage.ErrChunkLayerDetached, layout.ErrPrecondition), "closing", 409, false},
|
||||
{errors.Join(errFrozenDetachUnsupported, layout.ErrPrecondition), "frozen_detach_unsupported", 409, false},
|
||||
{errors.Join(storage.ErrInvalidFreezeBudget, layout.ErrPrecondition), "invalid_freeze_budget", 400, false},
|
||||
{errors.Join(durable.ErrNotChunkVolume, layout.ErrPrecondition), "not_chunk_volume", 409, false},
|
||||
{fmt.Errorf("save: %w", storage.ErrCutCOWAborted), "cut_aborted", 503, true},
|
||||
// Local capacity abort cancels the in-flight remote PUT.
|
||||
{errors.Join(storage.ErrCutCOWAborted, storage.ErrChunkRemoteUnavailable, context.Canceled, errors.New("storage: saver capacity")), "cut_aborted", 503, true},
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
package volume
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"github.com/seaweedfs/seaweed-block/core/frontend/chunkstore"
|
||||
"github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/filerpb"
|
||||
"github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout"
|
||||
)
|
||||
|
||||
// racingHeadFiler runs between, before each HEAD update it forwards, while
|
||||
// armed: another writer's HEAD update landing between a transition's HEAD
|
||||
// read and its conditional write. times bounds how many updates it races
|
||||
// (-1: every one).
|
||||
type racingHeadFiler struct {
|
||||
*adapterManifestFiler
|
||||
mu sync.Mutex
|
||||
times int
|
||||
between func()
|
||||
busy bool
|
||||
}
|
||||
|
||||
func (f *racingHeadFiler) UpdateEntry(ctx context.Context, dir string, e *filerpb.Entry, expected map[string][]byte) error {
|
||||
f.mu.Lock()
|
||||
run := !f.busy && f.times != 0 && e.GetName() == layout.HeadName && f.between != nil
|
||||
if run {
|
||||
f.busy = true
|
||||
if f.times > 0 {
|
||||
f.times--
|
||||
}
|
||||
}
|
||||
f.mu.Unlock()
|
||||
if run {
|
||||
f.between() // its own HEAD update is forwarded unraced (busy)
|
||||
f.mu.Lock()
|
||||
f.busy = false
|
||||
f.mu.Unlock()
|
||||
}
|
||||
return f.adapterManifestFiler.UpdateEntry(ctx, dir, e, expected)
|
||||
}
|
||||
|
||||
// deleteRaceFixture is a live volume, held by me, with snapshot "a", and a
|
||||
// filer that can race its HEAD updates.
|
||||
func deleteRaceFixture(t *testing.T) (context.Context, *racingHeadFiler, *chunkstore.BCatalog, chunkstore.VolumeRef, layout.HolderID) {
|
||||
t.Helper()
|
||||
ctx := context.Background()
|
||||
f := &racingHeadFiler{adapterManifestFiler: &adapterManifestFiler{Filer: chunkstore.NewMemFiler(), blobs: map[string][]byte{}}}
|
||||
cat, err := chunkstore.NewBCatalog(f, f, "/chunks")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
id, _ := layout.ParseVolumeID("00112233445566778899aabbccddeeff")
|
||||
ref := chunkstore.VolumeRef{Name: "v1", ID: id}
|
||||
if _, err := cat.CreateVolume(ctx, ref, layout.Geometry{SizeBytes: 64 * 4096, BlockSize: 4096, ChunkBytes: 4 * 4096}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
h, _, err := cat.ReadHead(ctx, ref)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
me := layout.HolderID{Epoch: 1, Holder: "a", ClaimID: "k"}
|
||||
h.Epoch, h.Holder, h.ClaimID, h.State = me.Epoch, me.Holder, me.ClaimID, layout.StateLive
|
||||
h.Snapshots = map[string]layout.Snapshot{"a": {Root: layout.RootName{Hash: layout.Sum([]byte("root"))}}}
|
||||
s, _ := cat.Store(ref)
|
||||
if err := s.UpdateHead(ctx, h.Gen, h, layout.CauseCommit); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
return ctx, f, cat, ref, me
|
||||
}
|
||||
|
||||
// The holder's cleaning begins (a HEAD update) between a snapshot delete's
|
||||
// HEAD read and its conditional write. The delete is refused as
|
||||
// head_conflict (409, retryable), never internal; HEAD keeps the snapshot
|
||||
// (nothing of the delete applied); a retry completes the delete.
|
||||
func TestSnapshotDeleteRacedByACleanBeginIsAHeadConflict(t *testing.T) {
|
||||
ctx, f, cat, ref, me := deleteRaceFixture(t)
|
||||
s, _ := cat.Store(ref)
|
||||
f.mu.Lock()
|
||||
f.times, f.between = 1, func() {
|
||||
if _, err := layout.RunBeginClean(ctx, s, me, "clean-1"); err != nil {
|
||||
t.Errorf("the racing clean-begin: %v", err)
|
||||
}
|
||||
}
|
||||
f.mu.Unlock()
|
||||
p := &fakeChunkProvider{}
|
||||
ctl := NewChunkControl(p, cat, ref)
|
||||
_, err := ctl.DeleteSnapshot(ctx, "v1", "a")
|
||||
if !errors.Is(err, layout.ErrPrecondition) {
|
||||
t.Fatalf("setup: the raced delete: %v; want the HEAD precondition", err)
|
||||
}
|
||||
if status, code, retryable := chunkErrorCode(err); status != http.StatusConflict || code != codeHeadConflict || !retryable {
|
||||
t.Fatalf("a raced delete maps to %d %q retryable=%v; want 409 head_conflict retryable", status, code, retryable)
|
||||
}
|
||||
h, _, err := cat.ReadHead(ctx, ref)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, ok := h.Snapshots["a"]; !ok || h.Activity.Kind != layout.ActClean || len(p.kicks) != 0 {
|
||||
t.Fatalf("after the refused delete: snapshots %v, activity %v, kicks %v; want the snapshot kept, the cleaning's activity, no kick", h.Snapshots, h.Activity, p.kicks)
|
||||
}
|
||||
if _, err := ctl.DeleteSnapshot(ctx, "v1", "a"); err != nil {
|
||||
t.Fatalf("the retry: %v", err)
|
||||
}
|
||||
h, _, err = cat.ReadHead(ctx, ref)
|
||||
if _, still := h.Snapshots["a"]; err != nil || still {
|
||||
t.Fatalf("after the retry: %v %v; want the snapshot gone", h.Snapshots, err)
|
||||
}
|
||||
}
|
||||
|
||||
// A conflict that persists (every attempt raced) stays head_conflict: the
|
||||
// operator sees a retryable conflict, never an internal error.
|
||||
func TestSnapshotDeleteUnderAPersistentConflictIsNeverInternal(t *testing.T) {
|
||||
ctx, f, cat, ref, _ := deleteRaceFixture(t)
|
||||
s, _ := cat.Store(ref)
|
||||
f.mu.Lock()
|
||||
f.times, f.between = -1, func() {
|
||||
h, _, err := s.ReadHead(ctx)
|
||||
if err != nil {
|
||||
t.Errorf("racing read: %v", err)
|
||||
return
|
||||
}
|
||||
if err := s.UpdateHead(ctx, h.Gen, h, layout.CauseCommit); err != nil {
|
||||
t.Errorf("racing write: %v", err)
|
||||
}
|
||||
}
|
||||
f.mu.Unlock()
|
||||
ctl := NewChunkControl(&fakeChunkProvider{}, cat, ref)
|
||||
for attempt := 0; attempt < 3; attempt++ {
|
||||
_, err := ctl.DeleteSnapshot(ctx, "v1", "a")
|
||||
if status, code, retryable := chunkErrorCode(err); err == nil || status != http.StatusConflict || code != codeHeadConflict || !retryable {
|
||||
t.Fatalf("attempt %d under a persistent conflict: %v -> %d %q retryable=%v; want 409 head_conflict retryable", attempt, err, status, code, retryable)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,411 @@
|
||||
package storage
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"syscall"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
const k3ReplayPath = "SWBLOCK_TEST_START_REPLAY_PATH"
|
||||
const k3ReplayPoint = "SWBLOCK_TEST_START_REPLAY_POINT"
|
||||
const k3ReplayBlocks = 128
|
||||
|
||||
type k3ReplayRecord struct {
|
||||
lba uint32
|
||||
blocks int
|
||||
first, last uint64
|
||||
}
|
||||
type k3ReplayCut struct {
|
||||
Record int
|
||||
Block int
|
||||
} // Block 0 = completed record; >0 = inside batch
|
||||
// A private typed IPC witness, not a product log line or a timed guess.
|
||||
type k3ReplayWitness struct {
|
||||
Record, Block int
|
||||
AppliedLSN, BlockedLSN uint64
|
||||
}
|
||||
|
||||
func k3ReplayRecords() []k3ReplayRecord {
|
||||
var out []k3ReplayRecord
|
||||
var lsn uint64
|
||||
for i := 0; i < 10; i++ {
|
||||
r := k3ReplayRecord{lba: 7, blocks: 1, first: lsn + 1}
|
||||
if i%2 != 0 {
|
||||
r.lba, r.blocks = uint32((i/2)%3)*16, 8
|
||||
}
|
||||
lsn += uint64(r.blocks)
|
||||
r.last = lsn
|
||||
out = append(out, r)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func k3ReplayData(record int, lba uint32) []byte {
|
||||
b := make([]byte, 4096)
|
||||
for i := range b {
|
||||
b[i] = byte((record+1)*37 + int(lba)*11 + i*13 + i/251)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func k3ReplaySeed(t *testing.T, path string, mode WMode) ([][]byte, uint64) {
|
||||
t.Helper()
|
||||
s, err := createMappedWALStoreV3ForTest(path, k3ReplayBlocks, 4096, 1<<20, mode, 8)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
owned := true
|
||||
t.Cleanup(func() {
|
||||
if !owned {
|
||||
return
|
||||
}
|
||||
checkpoint := s.CheckpointLSN()
|
||||
crashRecoveryHardeningStore(t, s)
|
||||
owned = false
|
||||
if os.Getenv("SWBLOCK_TEST_REPLAY_SEED_FAILURE") == "1" {
|
||||
_, err := s.fd.WriteAt([]byte{0}, 0)
|
||||
if !errors.Is(err, os.ErrClosed) || s.v3.ownedMap != nil || checkpoint != 0 {
|
||||
t.Errorf("failed seed still owns resources or checkpointed: %v cp=%d", err, checkpoint)
|
||||
return
|
||||
}
|
||||
fmt.Println("seed failure resources released; checkpoint=0")
|
||||
}
|
||||
})
|
||||
// Stopping the flusher does not remove a production replay interleaving:
|
||||
// RecoverContext holds s.mu for writing throughout replay; a flusher must
|
||||
// acquire its read lock before taking the dirty-map snapshot. Chunk startup
|
||||
// also keeps draining held until the chunk layer attaches.
|
||||
s.DisableAutoFlushForRecoveryTest() // stop before any write; the image must need replay
|
||||
expected := make([][]byte, k3ReplayBlocks)
|
||||
for i := range expected {
|
||||
expected[i] = make([]byte, 4096)
|
||||
}
|
||||
var ack uint64
|
||||
for i, r := range k3ReplayRecords() {
|
||||
blocks := make([][]byte, r.blocks)
|
||||
for j := range blocks {
|
||||
blocks[j] = k3ReplayData(i, r.lba+uint32(j))
|
||||
}
|
||||
if r.blocks == 1 {
|
||||
_, err = s.Write(r.lba, blocks[0])
|
||||
} else {
|
||||
_, err = s.WriteBatch(r.lba, blocks)
|
||||
}
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if ack, err = s.Sync(); err != nil || ack != r.last {
|
||||
t.Fatalf("ack=%d want=%d: %v", ack, r.last, err)
|
||||
}
|
||||
if os.Getenv("SWBLOCK_TEST_REPLAY_SEED_FAILURE") == "1" {
|
||||
t.Fatal("forced seed failure after acknowledged write")
|
||||
}
|
||||
for j, b := range blocks {
|
||||
expected[int(r.lba)+j] = b
|
||||
}
|
||||
}
|
||||
if s.CheckpointLSN() != 0 {
|
||||
t.Fatal("seed checkpointed: the test would not prove WAL replay")
|
||||
}
|
||||
crashRecoveryHardeningStore(t, s) // no clean stop, no extent drain
|
||||
owned = false
|
||||
return expected, ack
|
||||
}
|
||||
|
||||
func k3ReplayCopy(t *testing.T, source, target string) {
|
||||
t.Helper()
|
||||
for _, suffix := range []string{"", ".chunkmap"} {
|
||||
in, err := os.Open(source + suffix)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
out, err := os.OpenFile(target+suffix, os.O_CREATE|os.O_EXCL|os.O_WRONLY, 0600)
|
||||
if err != nil {
|
||||
in.Close()
|
||||
t.Fatal(err)
|
||||
}
|
||||
_, err = io.Copy(out, in)
|
||||
if err == nil {
|
||||
err = out.Sync()
|
||||
}
|
||||
err = errors.Join(err, in.Close(), out.Close())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func k3ReplayChild(t *testing.T, path string, cut k3ReplayCut) {
|
||||
t.Helper()
|
||||
s, err := OpenWALStore(path)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
s.DisableAutoFlushForRecoveryTest()
|
||||
if s.CheckpointLSN() != 0 {
|
||||
t.Fatal("child has no WAL-only image")
|
||||
}
|
||||
records := k3ReplayRecords()
|
||||
target := records[cut.Record]
|
||||
if cut.Block < 0 || cut.Block >= target.blocks {
|
||||
t.Fatal("invalid replay cut", cut)
|
||||
}
|
||||
emit := func(w k3ReplayWitness) {
|
||||
if err := json.NewEncoder(os.Stdout).Encode(w); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
now := time.Unix(0, 0)
|
||||
ctx := context.WithValue(context.Background(), recoveryClockKey{}, func(RecoveryPhase) time.Time {
|
||||
now = now.Add(2 * time.Second) // expose every completed record, without sleeping
|
||||
return now
|
||||
})
|
||||
ctx = WithRecoveryProgress(ctx, func(phase RecoveryPhase, done uint64) {
|
||||
if phase != RecoveryReplay || os.Getenv("SWBLOCK_TEST_START_REPLAY_SKIP_POINT") == "1" {
|
||||
return
|
||||
}
|
||||
if cut.Block == 0 && done == uint64(cut.Record+1) {
|
||||
var applied uint64
|
||||
for _, e := range s.dm.snapshot() {
|
||||
applied = max(applied, e.LSN)
|
||||
}
|
||||
if applied != target.last {
|
||||
panic("record progress does not match the applied WAL prefix")
|
||||
}
|
||||
emit(k3ReplayWitness{Record: cut.Record, AppliedLSN: applied})
|
||||
select {} // parent kills this process before recovery can publish/serve
|
||||
}
|
||||
if cut.Block == 0 || done != uint64(cut.Record) {
|
||||
return
|
||||
}
|
||||
blocked := target.lba + uint32(cut.Block)
|
||||
prior := blocked - 1
|
||||
// The preceding record's progress callback runs AFTER dirty-map clear.
|
||||
// Hold only the shard the target block will enter; the earlier blocks of
|
||||
// this multi-block record can still be replayed by the real product loop.
|
||||
shard := s.dm.shard(uint64(blocked))
|
||||
if shard == s.dm.shard(uint64(prior)) {
|
||||
panic("mid-record witness shares blocked shard")
|
||||
}
|
||||
shard.mu.Lock()
|
||||
old := shard.m[uint64(blocked)].lsn
|
||||
if old >= target.first {
|
||||
panic("batch interruption armed after its target block was applied")
|
||||
}
|
||||
go func() {
|
||||
watchdog := time.NewTimer(5 * time.Second)
|
||||
defer watchdog.Stop()
|
||||
for {
|
||||
_, _, lsn, _, ok := s.dm.get(uint64(prior))
|
||||
if ok && lsn == target.first+uint64(cut.Block)-1 {
|
||||
emit(k3ReplayWitness{Record: cut.Record, Block: cut.Block, AppliedLSN: lsn, BlockedLSN: old})
|
||||
return // shard remains held until the parent kills the child
|
||||
}
|
||||
select {
|
||||
case <-watchdog.C:
|
||||
panic("replay never reached the batch prefix")
|
||||
default:
|
||||
runtime.Gosched()
|
||||
}
|
||||
}
|
||||
}()
|
||||
})
|
||||
if _, err := s.RecoverContext(ctx); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Fatal("replay completed without reaching the requested interruption")
|
||||
}
|
||||
|
||||
func k3ReplayKill(t *testing.T, path string, cut k3ReplayCut) {
|
||||
t.Helper()
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
|
||||
defer cancel()
|
||||
cmd := exec.CommandContext(ctx, os.Args[0], "-test.run=^TestStartWALReplayInterruptionsConverge$", "-test.timeout=12s")
|
||||
raw, err := json.Marshal(cut)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
cmd.Env = append(os.Environ(), k3ReplayPath+"="+path, k3ReplayPoint+"="+string(raw))
|
||||
var stderr bytes.Buffer
|
||||
cmd.Stderr = &stderr
|
||||
stdout, err := cmd.StdoutPipe()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err = cmd.Start(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
waited := false
|
||||
defer func() {
|
||||
if !waited {
|
||||
_ = cmd.Process.Kill()
|
||||
_ = cmd.Wait()
|
||||
}
|
||||
}()
|
||||
var witness k3ReplayWitness
|
||||
if err := json.NewDecoder(stdout).Decode(&witness); err != nil {
|
||||
_ = cmd.Process.Kill()
|
||||
_ = cmd.Wait()
|
||||
waited = true
|
||||
t.Fatalf("interruption not reached: %v (deadline=%v): %s", err, ctx.Err(), stderr.String())
|
||||
}
|
||||
wantLSN := k3ReplayRecords()[cut.Record].last
|
||||
if cut.Block != 0 {
|
||||
wantLSN = k3ReplayRecords()[cut.Record].first + uint64(cut.Block) - 1
|
||||
}
|
||||
if witness.Record != cut.Record || witness.Block != cut.Block || witness.AppliedLSN != wantLSN || (cut.Block != 0 && witness.BlockedLSN >= wantLSN) {
|
||||
t.Fatalf("wrong typed replay witness: %+v for %+v", witness, cut)
|
||||
}
|
||||
if err = cmd.Process.Kill(); err != nil {
|
||||
t.Fatal(err)
|
||||
} // SIGKILL on Linux
|
||||
err = cmd.Wait()
|
||||
waited = true
|
||||
var exited *exec.ExitError
|
||||
if ctx.Err() != nil || !errors.As(err, &exited) || !k3ReplayKilled(exited.ProcessState) {
|
||||
t.Fatalf("child not killed at replay witness: %v deadline=%v: %s", err, ctx.Err(), stderr.String())
|
||||
}
|
||||
}
|
||||
|
||||
func k3ReplayVerify(t *testing.T, s *WALStore, expected [][]byte, ack uint64) {
|
||||
t.Helper()
|
||||
if s.NextLSN() != ack+1 || s.CheckpointLSN() != 0 {
|
||||
t.Fatalf("frontier next=%d cp=%d ack=%d", s.NextLSN(), s.CheckpointLSN(), ack)
|
||||
}
|
||||
for lba, want := range expected {
|
||||
got, err := s.Read(uint32(lba))
|
||||
if err != nil || !bytes.Equal(got, want) {
|
||||
t.Fatalf("acknowledged image differs at LBA %d: %v", lba, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Kill the actual startup store replay, not a clean stop or a torn WAL write.
|
||||
// The mid-record points interrupt application of a validated multi-block WAL
|
||||
// record after a proved prefix, while its next block is causally blocked.
|
||||
func TestStartWALReplayInterruptionsConverge(t *testing.T) {
|
||||
if path := os.Getenv(k3ReplayPath); path != "" {
|
||||
var cut k3ReplayCut
|
||||
if err := json.Unmarshal([]byte(os.Getenv(k3ReplayPoint)), &cut); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
k3ReplayChild(t, path, cut)
|
||||
return
|
||||
}
|
||||
for _, mode := range []struct {
|
||||
name string
|
||||
mode WMode
|
||||
}{{"lagged", WModeLagged}, {"strict", WModeStrict}} {
|
||||
t.Run(mode.name, func(t *testing.T) {
|
||||
seed := filepath.Join(t.TempDir(), "seed")
|
||||
expected, ack := k3ReplaySeed(t, seed, mode.mode)
|
||||
var cuts []k3ReplayCut
|
||||
for i, r := range k3ReplayRecords() {
|
||||
cuts = append(cuts, k3ReplayCut{Record: i})
|
||||
if r.blocks > 1 {
|
||||
for _, block := range []int{1, 4, 7} {
|
||||
cuts = append(cuts, k3ReplayCut{Record: i, Block: block})
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, cut := range cuts {
|
||||
name := "record-" + fmt.Sprintf("%02d", cut.Record)
|
||||
if cut.Block != 0 {
|
||||
name = "batch-" + fmt.Sprintf("%02d", cut.Record) + "-block-" + strconv.Itoa(cut.Block)
|
||||
}
|
||||
t.Run(name, func(t *testing.T) {
|
||||
path := filepath.Join(t.TempDir(), "volume")
|
||||
k3ReplayCopy(t, seed, path)
|
||||
k3ReplayKill(t, path, cut)
|
||||
s, err := OpenWALStore(path)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
s.DisableAutoFlushForRecoveryTest()
|
||||
defer func() { _ = s.Close() }()
|
||||
// The first attempt was killed; the restarted replay must finish with
|
||||
// exactly the last acknowledged image, including every untouched zero.
|
||||
if frontier, err := s.Recover(); err != nil || frontier != ack {
|
||||
t.Fatalf("restart frontier=%d want=%d: %v", frontier, ack, err)
|
||||
}
|
||||
k3ReplayVerify(t, s, expected, ack)
|
||||
beforeR, beforeS, beforeH := s.Boundaries()
|
||||
if frontier, err := s.Recover(); err != nil || frontier != ack {
|
||||
t.Fatalf("second replay frontier=%d: %v", frontier, err)
|
||||
}
|
||||
k3ReplayVerify(t, s, expected, ack)
|
||||
if r, tail, h := s.Boundaries(); r != beforeR || tail != beforeS || h != beforeH {
|
||||
t.Fatalf("replay did not converge: %d/%d/%d -> %d/%d/%d", beforeR, beforeS, beforeH, r, tail, h)
|
||||
}
|
||||
if err := s.Close(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
next, err := OpenWALStore(path)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
next.DisableAutoFlushForRecoveryTest()
|
||||
defer next.Close()
|
||||
if frontier, err := next.Recover(); err != nil || frontier != ack {
|
||||
t.Fatalf("physical reopen frontier=%d: %v", frontier, err)
|
||||
}
|
||||
k3ReplayVerify(t, next, expected, ack)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Keep an unrelated child failure distinct from a proved replay interruption.
|
||||
func k3ReplayKilled(state *os.ProcessState) bool {
|
||||
if runtime.GOOS == "linux" {
|
||||
status, ok := state.Sys().(syscall.WaitStatus)
|
||||
return ok && status.Signaled() && status.Signal() == syscall.Signal(9)
|
||||
}
|
||||
// Go's Windows Process.Kill uses TerminateProcess with exit code 1.
|
||||
// Ordinary test failures/timeouts use 2; this is not a SIGKILL claim.
|
||||
return runtime.GOOS == "windows" && state.ExitCode() == 1
|
||||
}
|
||||
|
||||
func TestStartWALReplayRejectsUnrelatedExit(t *testing.T) {
|
||||
if os.Getenv("SWBLOCK_TEST_REPLAY_ORDINARY_EXIT") == "1" {
|
||||
fmt.Println("witness reached")
|
||||
os.Exit(2)
|
||||
}
|
||||
cmd := exec.Command(os.Args[0], "-test.run=^TestStartWALReplayRejectsUnrelatedExit$")
|
||||
cmd.Env = append(os.Environ(), "SWBLOCK_TEST_REPLAY_ORDINARY_EXIT=1")
|
||||
output, err := cmd.Output()
|
||||
var exited *exec.ExitError
|
||||
if !errors.As(err, &exited) || !bytes.Contains(output, []byte("witness reached")) {
|
||||
t.Fatalf("ordinary-exit control failed: %s %v", output, err)
|
||||
}
|
||||
if k3ReplayKilled(exited.ProcessState) {
|
||||
t.Fatal("ordinary exit after a witness counted as a kill")
|
||||
}
|
||||
}
|
||||
|
||||
func TestStartWALReplaySeedFailureCleansUp(t *testing.T) {
|
||||
if os.Getenv("SWBLOCK_TEST_REPLAY_SEED_FAILURE") == "1" {
|
||||
k3ReplaySeed(t, filepath.Join(t.TempDir(), "seed"), WModeLagged)
|
||||
return
|
||||
}
|
||||
cmd := exec.Command(os.Args[0], "-test.run=^TestStartWALReplaySeedFailureCleansUp$")
|
||||
cmd.Env = append(os.Environ(), "SWBLOCK_TEST_REPLAY_SEED_FAILURE=1")
|
||||
output, err := cmd.CombinedOutput()
|
||||
var exited *exec.ExitError
|
||||
if !errors.As(err, &exited) || !bytes.Contains(output, []byte("seed failure resources released; checkpoint=0")) {
|
||||
t.Fatalf("seed failure did not release its resources: %s %v", output, err)
|
||||
}
|
||||
}
|
||||
@@ -950,6 +950,7 @@ Notes:
|
||||
| `INV-CUT-PAYLOAD-SPILL-SOURCE-001` | Only a COW save made before a store mutation (`WriteContext`, `WriteBatchContext` or `applyEntryV3`) consumes side-file bytes; copy and upload workers never write the side file. | M5 Copy (COW save) | `core/storage/chunk_cut_cow.go` `beforeCOWMutation`, `copyCOWEntry`; `core/storage/walstore.go` `WriteContext`, `WriteBatchContext`; `core/storage/base_install_v3.go` `applyEntryV3` | `TestCutCOWV3_SpillWithinCapIsAccounted` (`core/storage/chunk_cut_cow_spillcap_test.go`) | — | ACTIVE |
|
||||
| `INV-CUT-PAYLOAD-JOIN-001` | Every upload worker of a cut or staging round has returned before that round's intents are cleaned up or its outcome is settled, also after an upload failure or cancellation. | M5 Upload → Closed, Aborted | `core/storage/chunk_upload.go` `uploadBatch`; `core/storage/chunk_layer.go` `captureLocked` | `TestChunkUploads_FailureJoinsBeforeIntentCleanup` (`core/storage/chunk_upload_parallel_test.go`) | — | ACTIVE |
|
||||
| `INV-CUT-ERROR-PRECEDENCE-001` | A chunk-control error body reports `cut_aborted` for a local cut abort even when the abort cancelled a remote upload, but an unknown CAS outcome, a fence or a closed or detached layer joined to it keeps its own code (`outcome_unknown`, `fenced`, `closing`). | M5 Copy, Upload → Aborted (HTTP error body) | `core/host/volume/chunk_control.go` `chunkErrorCode` | `TestStatusServer_ChunkErrorBodyIsTyped` (`core/host/volume/chunk_control_test.go`) | — | ACTIVE |
|
||||
| `INV-CATALOG-HEAD-CONFLICT-001` | A catalog transition that lost its conditional HEAD write (`layout.ErrPrecondition`, such as a snapshot delete raced by a cleaning's begin) reports `head_conflict` (409, retryable), never `internal`; it decides last, so any other cause joined to it keeps its own code. | M6 snapshot delete (HTTP error body) | `core/host/volume/chunk_control.go` `chunkErrorCode` | `TestSnapshotDeleteRacedByACleanBeginIsAHeadConflict`, `TestSnapshotDeleteUnderAPersistentConflictIsNeverInternal` (`core/host/volume/chunk_delete_head_conflict_test.go`); `TestStatusServer_ChunkErrorBodyIsTyped` (`core/host/volume/chunk_control_test.go`) | — | ACTIVE |
|
||||
| `INV-HOST-CUT-BUDGET-001` | A cooperating cut process holds a host OS slot from its admission, before staging or the capture barrier: see M7 free → admitted. | M7 free → admitted | `core/hostlimit/limiter.go` `Admit`; `core/storage/chunk_cut_budget.go`; blockvolume host-limit flags | `TestSlotsUrgentAndJoinedRelease` (`core/hostlimit/limiter_test.go`); `TestHostCutLimitDoesNotGateGuestIO` (`core/frontend/durable/host_limit_test.go`) | `HostBudget` HeldUntilJoined/PayloadBound/SpillBound (bounded OS-lock abstraction; fallback excluded) | ACTIVE |
|
||||
| `INV-HOST-CUT-BUDGET-RESERVE-001` | Each admitted slot, urgent included, carries at most PayloadBytes of cut payload and at most COWBytes of COW side bytes; a reservation beyond COWBytes revokes the slot and aborts its cut. | M7 admitted | `core/hostlimit/limiter.go` `Admit`, `ReserveCOW`; `core/storage/chunk_cut_budget.go` | `TestHostCOWCapAbortsCutAndRetainsPermitUntilJoin` (`core/storage/chunk_host_budget_test.go`); `TestSlotsUrgentAndJoinedRelease` (`core/hostlimit/limiter_test.go`) | `HostBudget` PayloadBound/SpillBound | ACTIVE |
|
||||
| `INV-HOST-CUT-BUDGET-SETTLE-001` | A slot's OS lock is released only after its cut's workers settle and Release is called; cancellation, hold expiry and limiter Close abort the cut but keep the slot until then. | M7 draining → joined → released | `core/hostlimit/limiter.go` `Release`, `releaseLoop`, `revoke`, `Close`; `core/storage/chunk_layer.go` `captureLocked` | `TestCOWAbortHoldsSlotUntilWorkerSettlement`, `TestHoldExpiryAndCloseDoNotSteal`, `TestKilledProcessReleasesButLiveHolderDoesNot` (`core/hostlimit/limiter_test.go`); `TestHostCOWCapAbortsCutAndRetainsPermitUntilJoin` (`core/storage/chunk_host_budget_test.go`) | `HostBudget` HeldUntilJoined | ACTIVE |
|
||||
|
||||
@@ -352,12 +352,11 @@ that never served (step 4 of
|
||||
delete means this case; retrying the delete alone does not help. Until the release, the source's delete answers
|
||||
`snapshot_has_dependents` ("has 1").
|
||||
|
||||
Deleting a restore target: its first cut compares every restored chunk locally (about 1.4 GiB/s measured). The
|
||||
default `--timeout` of 120 s covers up to about 84 GiB; above that, pass `--timeout 5m` (the server's limit for one
|
||||
request). At the 256 GiB maximum the first cut takes about 3 min. An `outcome_unknown` answer there means the volume
|
||||
Deleting a restore target: its first cut compares every restored chunk locally, so it reads the target's whole filled
|
||||
size. The server bounds one request at 5 minutes: pass `--timeout 5m` for a large target. An `outcome_unknown` answer there means the volume
|
||||
has stopped I/O while its holder settles the outcome in the background; it resumes serving when that settles (the
|
||||
holder logs it), and nothing acknowledged is lost. Then retry the delete with `--timeout 5m`. A restore target's
|
||||
filled size must be at most about 4 min x your disk's read rate for its first cut to finish. On disks slower than NVMe the 256 GiB figure does not hold; see the v1.0.0 Known limits.
|
||||
holder logs it), and nothing acknowledged is lost. Then retry the delete with `--timeout 5m`. The first cut must read the filled size within one
|
||||
5-minute request, so the filled size divided by your disk's read rate must fit in it; see the v1.0.1 Known limits.
|
||||
|
||||
|
||||
[Standalone deployment: snapshots, restore and space](standalone-deployment.md#snapshots-restore-and-space-walstore-chunk):
|
||||
@@ -387,8 +386,11 @@ the snapshot name exists only after a request for it succeeds (check with `sw-bl
|
||||
(`TestKnownDefectSnapshotRetryAfterAGenuineConflictCommitsTheDataUnnamed`). A retry that names the snapshot at once is
|
||||
planned for a later release.
|
||||
|
||||
A snapshot's time grows with the data changed since the volume's last cut: 64 GiB changed took 122 s (about 2 s
|
||||
per GiB). `sw-block ops chunk snapshot` waits 60 s by default, so pass `--timeout` above the expected time; the
|
||||
A snapshot delete can answer `head_conflict` (HTTP 409, retryable) too: another write to the volume's HEAD, such as the
|
||||
holder's cleaning beginning, landed between the delete's read of HEAD and its write. Nothing of the delete applied;
|
||||
retry it (`TestSnapshotDeleteRacedByACleanBeginIsAHeadConflict`).
|
||||
|
||||
A snapshot's time grows with the data changed since the volume's last cut. `sw-block ops chunk snapshot` waits 60 s by default, so pass `--timeout` above the expected time; the
|
||||
server bounds one request at 5 minutes whatever `--timeout` says. A request that runs
|
||||
out of time answers a retryable code: `remote_unavailable` or `deadline_exceeded` when it ran out before its commit,
|
||||
`outcome_unknown` when it ran out during the commit. Before the commit, the name is withdrawn and no later cut
|
||||
@@ -396,10 +398,11 @@ publishes it; the volume's data is unchanged and stays queued for the next cut.
|
||||
After `outcome_unknown`, the commit may have landed with the name.
|
||||
Rerun the snapshot with the same name and a larger `--timeout`: a name already in HEAD is answered with the
|
||||
snapshot it names, so a rerun never takes a second one. A rerun keeps what a timed-out request already
|
||||
uploaded: it finds those chunks and sends only the rest. More than about 150 GiB changed needs more than one 5-minute
|
||||
request: at the 256 GiB maximum a snapshot published on its second request, after about 9 minutes in all, so rerun
|
||||
until it answers. A scheduled snapshot retries by itself (after 1 minute, doubling to 1 hour). A longer or derived
|
||||
default is planned for a later release.
|
||||
uploaded: it finds those chunks and sends only the rest. A large change can need more than one 5-minute
|
||||
request. With a
|
||||
`--timeout` above 5 minutes (for example `--timeout 15m`), `sw-block ops chunk snapshot`, `cut` and `detach` repeat
|
||||
the 5-minute request with the same body until it answers or the timeout ends; with a shorter one, rerun until it
|
||||
answers. A scheduled snapshot retries by itself (after 1 minute, doubling to 1 hour).
|
||||
|
||||
With `--host-limit-dir` set (it is off by default), uploads are paced at `--host-limit-upload-bytes-sec` (64 MiB/s by
|
||||
default) shared by the host's 4 slots, about 16 MiB/s per volume. Only the bytes a cut sends are paced: a chunk
|
||||
|
||||
@@ -4,8 +4,9 @@ Seaweed Block release notes use narrow product claims. Each alpha version names
|
||||
what a user or reviewer can actually run, what QA evidence backs it, and what
|
||||
is still outside the supported boundary.
|
||||
|
||||
- [v1.0.1](v1.0.1.md)
|
||||
- [v1.0.0](v1.0.0.md)
|
||||
- [Planned cleaning convergence after v1.0.0](cleaning-convergence.md)
|
||||
- [Cleaning changes in v1.0.1](cleaning-convergence.md)
|
||||
- [Diagnostic log format](log-format.md)
|
||||
- [Typed refusal codes of the chunk CLI](cli-refusal-codes.md)
|
||||
- [Holder identity and pre-release upgrades](holder-identity.md)
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
# Planned cleaning changes after v1.0.0
|
||||
# Cleaning changes in v1.0.1
|
||||
|
||||
These changes are proposed for v1.0.1. They are not a claim about v1.0.0 or
|
||||
qualification of a published binary. The v1.0.0 release note's cleaning limits
|
||||
describe that release; this change replaces those limits when it is released.
|
||||
These changes are in v1.0.1. They replace the v1.0.0 release note's cleaning
|
||||
limits.
|
||||
|
||||
- Cleaning removes unreferenced roots, then segments, then chunks. It no longer
|
||||
waits for volume deletion to reclaim abandoned roots and segments.
|
||||
@@ -19,8 +18,7 @@ describe that release; this change replaces those limits when it is released.
|
||||
through the existing worker. Queued is not completed; an ended worker refuses.
|
||||
|
||||
See [cleaning and the schedule command](../standalone-deployment.md#resuming-cleaning-passes).
|
||||
Linux/race qualification and the production-layout CLI verifier evidence remain
|
||||
separate gates. A live graph/count check is not a `verify`-clean result.
|
||||
A live graph/count check is not a `verify`-clean result.
|
||||
|
||||
### Last holder maintenance pass
|
||||
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
# v1.0.1
|
||||
|
||||
A maintenance release of v1.0.0. The supported configuration is still the **single-replica volume**
|
||||
(`--durable-impl walstore-chunk`), new volumes are still at most 256 GiB, and the recovery point does not change:
|
||||
the loss of a whole host loses what was acknowledged since the volume's last successful snapshot or cut. Replicated
|
||||
volumes remain a preview: see [replicated volumes in v1.0: a preview](replicated-volumes-preview.md).
|
||||
|
||||
v1.0.1 adds whole-job volume commands, a single-host trial (`sw-block mini`), an inspection shell with
|
||||
`cluster.check` and a troubleshooting page, a support bundle, and a working `ops chunk verify`; it fixes the cleaning
|
||||
limits and the rare holder crash listed in v1.0.0's Known limits.
|
||||
|
||||
## Upgrade
|
||||
- In place, with no format change in any store (see [persisted state](../persisted-state.md)) and no flag to set:
|
||||
blockmaster first, then each volume host one at a time, the `sw-block` CLI last. Follow
|
||||
[upgrade from v1.0.0 to v1.0.1](../upgrade-v1.0.1.md).
|
||||
- While some hosts still run v1.0.0: create no volume above 256 GiB (as in v1.0.0); a restore's target must be in the
|
||||
cluster spec before the restore, unless blockmaster's product loop is on (`--lifecycle-product-loop-interval`);
|
||||
`cluster.check` against a v1.0.0 holder reports its version as unavailable, never `ok`. A v1.0.0 blockmaster with
|
||||
a v1.0.1 volume host is not supported.
|
||||
- Downgrade is not supported.
|
||||
|
||||
## New
|
||||
- **Volume commands** (run as root): `sw-block volume start <volume>` writes the volume's settings to
|
||||
`/etc/sw-block/volumes/<volume>.env` and starts the unit `sw-blockvolume@<volume>.service`;
|
||||
`sw-block volume stop <volume>` cuts and stops it, and refuses while a guest is connected (`--force` to stop anyway,
|
||||
`--no-cut` to skip the cut); `sw-block volume backup <volume> --name S` takes a snapshot;
|
||||
`sw-block volume restore <volume> --snapshot S --as <new> ...` creates and starts a restored volume (`--abort` undoes
|
||||
a restore that did not finish). See [standalone deployment](../standalone-deployment.md) and
|
||||
[volume backup and restore](volume-backup-restore.md).
|
||||
- **`sw-block mini`**: a single-host trial on loopback with SeaweedFS's `weed mini` as the chunk store. Snapshots work
|
||||
at once; a restore into a new volume is refused inside the trial (blockmaster's product loop is off).
|
||||
- **`sw-block shell`**: inspection commands (`cluster.status`, `volume.list`, `volume.status`, `volume.explain`,
|
||||
`snapshot.list`, `store.show`, `store.usage`, `volume.verify`), each with `-o json`, and `cluster.check [volume]`:
|
||||
fourteen checks in the order a start-up fails, one line each (`ok`, `FAIL`, `not checked here`, `not applicable`).
|
||||
A `FAIL` prints its cure and names its section of the [troubleshooting page](../troubleshooting.md). The checks of a
|
||||
volume's holder run only on its host (`-server-id`); elsewhere they say `not checked here`.
|
||||
- **Support bundle**: `log.collect -out DIR` in `sw-block shell` gathers versions, the cluster and `cluster.check`
|
||||
results, the holder's status pages, a HEAD summary, the start-up arguments and the last `-since` (default 15 min) of
|
||||
logs into a new directory. Credentials in what it collects are redacted; it reads no environment, configuration tree
|
||||
or key file. Exit 0 means every source was collected, not that the cluster is healthy.
|
||||
- **`ops chunk verify` works on production volumes**: `--master MASTER --volume NAME` resolves the volume's directory
|
||||
through blockmaster (or give the `<name>-<id8>` directory). It checks every named snapshot in turn; `--orphans` lists
|
||||
unreferenced objects. See [verify on the production layout](verify-production-layout.md).
|
||||
- **Status and logs**: `/status/durable` shows the phase of the running cut, the volume's HEAD writes and unknown
|
||||
outcomes by cause, and the cleaning passes (see [status schema](../status-schema.md)); each HEAD write is logged with
|
||||
its cause; `--log-level info|debug` and UTC timestamps (see [log format](log-format.md)).
|
||||
- **Forced move answers in JSON**: `sw-block ops workspace force-move --json` (with or without `--dry-run`) reports
|
||||
whether the move is admitted, the barrier time, a typed refusal code, and for an issued move the new epoch, host and
|
||||
replica and the kept HEAD position. `--dry-run` exits 0 whenever the check ran, admitted or not: read `admitted`.
|
||||
- **Long requests repeat**: `ops chunk snapshot`, `cut` and `detach` with a `--timeout` above 5 minutes repeat the
|
||||
server's 5-minute request with the same body until it answers or the timeout ends. The defaults (60 s, 60 s, 120 s)
|
||||
send one request.
|
||||
|
||||
## Changed at start
|
||||
- **`--workspace-lease` is required** for every `--durable-impl walstore-chunk` volume: `blockvolume` refuses to start
|
||||
without it (without a lease, two holders could both acknowledge writes). Plain `walstore` volumes are unchanged.
|
||||
- **The filer must refuse a stale conditional HEAD update**: `blockmaster` and `blockvolume` check at start, in a
|
||||
disposable `.startup-head-probe-<id>` directory under the chunk path, that the filer refuses an update with the
|
||||
wrong generation and leaves the object unchanged; a filer that does not, or an unknown outcome, refuses the start.
|
||||
- **The single-filer check is stricter**: it passes only when every master answered, and the leader's list decides.
|
||||
`sw-block ops chunk` commands that write metadata refuse a filer client that cannot run the check (one that is not
|
||||
SeaweedFS).
|
||||
- **A revoked holder stays stopped**: a holder started again after its revocation was already recorded exits once
|
||||
with status 79, which the shipped units do not restart (as for 78). Update the units before the binary (see the
|
||||
upgrade page). A revocation acknowledgement retried after its deadline is answered from the record.
|
||||
|
||||
## Fixed
|
||||
- **Holder crash on first reads**: v1.0.0's rare `fatal error: concurrent map writes` during the first reads of a
|
||||
volume opened from the object store (after a move, a takeover, or as a restore target).
|
||||
- **Cleaning reaches the whole store**: a pass continues where the previous pass of the same process stopped, instead
|
||||
of starting at the first shard, so its space is reclaimed whatever the store's size (after a restart the first pass
|
||||
starts again from the beginning). Cleaning now also removes roots and segments that no snapshot names, so a cut no
|
||||
longer keeps metadata until the volume is deleted. This replaces two v1.0.0 Known limits.
|
||||
- **Commit of a large volume**: the check of the chunks a cut names runs before the HEAD update, within the cut's own
|
||||
time, and the HEAD update does constant work. The v1.0.0 limit tying the 256 GiB size to the filer's round-trip
|
||||
time is gone (the 256 GiB maximum stays).
|
||||
- **A refused restore leaves no target**: a restore refused for good (for example from a snapshot of a restored
|
||||
volume) no longer leaves the target name bound, and answers `restore_source_not_own` without the misleading
|
||||
`layout store not ready:` prefix. An unknown volume now answers `volume_not_found` (exit 1) instead of
|
||||
`bad_request` (exit 2). See [CLI refusal codes](cli-refusal-codes.md).
|
||||
- **Cuts keep their progress**: a cut that fails or runs out of time keeps the chunks it already compared and the
|
||||
uploads it already made; the next cut compares and sends only the rest. A chunk filled from the source snapshot is not
|
||||
sent again while unchanged. With `--host-limit-dir`, only the bytes a cut sends are paced, so a rerun converges.
|
||||
- **A snapshot holds every write acknowledged before its request**: its name is recorded only by a cut at or after
|
||||
the request's log position, never by a cut that was already past its barrier when the request arrived.
|
||||
- **Scheduled snapshots survive restarts**: a restarted holder takes the next due time from the volume's newest
|
||||
scheduled snapshot in HEAD, instead of placing the next daily attempt again (up to a day away); a missed time stays
|
||||
due.
|
||||
- **Uploads do not block HEAD reads**: a cut's uploads run concurrently, and reads of the volume's HEAD proceed while
|
||||
they do.
|
||||
- **A failed fsync stays failed**: the save of a volume's chunk presence follows the store's rule that a failed fsync
|
||||
is never retried as if it had succeeded.
|
||||
- **Plain detach** keeps time inside the caller's `--timeout` to settle: it answers aborted or unknown within the
|
||||
timeout instead of after it.
|
||||
- **Connections to SeaweedFS volume servers are reused**, instead of leaving a burst of closed sockets per cut.
|
||||
- **A status server closed right after its start** no longer panics.
|
||||
|
||||
## Replicated volumes (preview)
|
||||
- No support claim changes: replicated volumes remain a preview (see
|
||||
[replicated volumes in v1.0: a preview](replicated-volumes-preview.md)).
|
||||
- Preview fix: a primary's session exchanges with a replica now go through one queue per replica, in order, and are
|
||||
refused cleanly when that replica's worker stops.
|
||||
|
||||
## Limits
|
||||
- New volumes are at most 256 GiB, as in v1.0.0.
|
||||
- Tested with up to 200 volumes on one 8-vCPU host; at that density the host CPU is saturated and per-volume latency
|
||||
is not qualified.
|
||||
- Restoring needs room: the target's full size plus its WAL (64 MiB) free on the restoring host; the create is refused
|
||||
with a message that names both numbers.
|
||||
- Up to 10 snapshots per volume; up to 4 restore targets per snapshot and 16 per volume; snapshot names up to 64
|
||||
bytes; up to 4 labels. A volume's geometry is fixed at creation.
|
||||
- A snapshot's time grows with the data changed since the last cut; see the operator guide for `--timeout`.
|
||||
- `ops chunk verify` checks the current image and each named snapshot one after another, and the chunks of each
|
||||
snapshot one at a time, so its time grows with the volume's size times the number of snapshots. The default
|
||||
`--timeout` (10 min) is not enough for a 256 GiB volume with the default snapshot schedule: raise `--timeout`.
|
||||
`--depth data` reads every chunk's bytes and needs an explicit `--timeout`. There is no option to verify only some
|
||||
snapshots.
|
||||
|
||||
## Advance notice: removed in v1.1
|
||||
- The experimental engines `--durable-impl smartwal` and `--durable-impl parallel-walstore` are removed in v1.1, and
|
||||
their volumes will not open there. Before upgrading such a volume to v1.1, copy its data to a `walstore` volume with
|
||||
v1.0.x.
|
||||
|
||||
## Known limits
|
||||
- On a freshly restored volume each cut pauses guest writes while it looks up the block entries of every chunk not
|
||||
yet local; the pause falls as the volume's chunks become local.
|
||||
- A restored volume never becomes independent: its source snapshot stays pinned and counts toward the source's 10
|
||||
while the target exists, and the source cannot be deleted before it. Independence is planned for a later release.
|
||||
- While a large restore is being created, do not move or detach other volumes; a move that fails then is retried after
|
||||
the restore completes.
|
||||
- A restored volume takes no scheduled snapshots while any of its chunks is still only in the source snapshot.
|
||||
- A snapshot of a restored volume cannot itself be a restore source (`restore_source_not_own`).
|
||||
- Node Ready/Schedulable in the observation report and the Kubernetes operator status are always true in v1.0.1; use
|
||||
cluster.check for node state.
|
||||
- sw-block does not authenticate to SeaweedFS; run SeaweedFS on a trusted network.
|
||||
- An upload whose outcome is unknown may leave an unreferenced object that cleaning does not reclaim;
|
||||
`weed shell volume.fsck -collection <block collection> -v` lists such objects; do not use its delete option on
|
||||
block data.
|
||||
- blockmaster reads its cluster spec only at start.
|
||||
- One SeaweedFS filer per chunk store.
|
||||
- A restore target's first cut reads every filled byte, so its time grows with the target's filled size and the
|
||||
disk's read rate; on a slow disk or a large target its detach and delete may not finish within the server's
|
||||
5-minute bound for one request. See the operator guide.
|
||||
- A volume created at run time and not in the cluster spec is served only with `--lifecycle-product-loop-interval` set.
|
||||
- A volume-delete refused with `snapshot_has_dependents` has already reserved the volume; delete or release the
|
||||
restored volume first, then run the same delete again.
|
||||
- A snapshot that meets a concurrent HEAD change answers `head_conflict`: retry it (and once more if the retry answers
|
||||
`snapshot "NAME" of VOL is not in HEAD after its commit`). A snapshot delete that meets one (for example the
|
||||
holder's cleaning beginning) answers `head_conflict` too, where it answered `internal` before: nothing applied, retry it.
|
||||
- A restored volume that has only been read fetches all of its chunks again after any restart; writing to it, or its
|
||||
next checkpoint, records what it has fetched (no data is lost).
|
||||
- A guest's NVMe/TCP connection waits about 181 s (holder stopped, host up) or about 464 s (holder's host powered off)
|
||||
for a stopped target; see [host connect settings](../operator-guide.md#host-connect-settings).
|
||||
- Every deleted volume leaves one small record in blockmaster's deletion store; the name cannot be reused.
|
||||
- replicated (preview): a replica whose rebuild was refused is not reported unhealthy; fixed in a later release.
|
||||
- replicated volumes are a preview: a primary cut off from the block master is not stopped by a lease and may serve
|
||||
stale reads to a guest still connected to it; do not use replicated volumes for data you cannot lose.
|
||||
@@ -947,7 +947,7 @@ A restore makes a new volume from a snapshot. The new volume reads every chunk i
|
||||
3. **Start v2's blockvolume** with the normal standalone command, its own volume id, endpoints and local root, the source's geometry (`--durable-blocks` and `--durable-blocksize`, for example `65536` and `4096`), and the same chunk settings as the source (`--chunk-filer`, `--chunk-path`, `--chunk-control-endpoint`). v2 serves at once. A start with other geometry flags is refused with `geometry_mismatch` and exits 78, creating no local store; the refusal names the record's values.
|
||||
4. **Reads fill v2.** A block in a chunk that v2 does not hold yet is read from the source's snapshot; the read waits for that chunk, which is then kept locally. There is no background copy: a chunk that is never read stays in the source's snapshot.
|
||||
- Progress is the volume's count of chunks still absent: `Chunk.Stats.AbsentChunks` in `GET http://STATUS_OF_V2/status/durable?volume=v2` (0 means every chunk is local).
|
||||
- That progress is written to v2's local store at its next checkpoint. If v2's blockvolume is killed before then, the chunks it made local since are absent again after the restart and are fetched again from the source's snapshot on their next read. No data is lost: the source's snapshot still holds them.
|
||||
- That progress is written to v2's local store when v2 is written to, or at its next checkpoint; a volume that has only been read takes none. After any restart of v2's blockvolume before then, clean or not, the chunks it made local are absent again and are fetched again from the source's snapshot on their next read. No data is lost: the source's snapshot still holds them.
|
||||
- To make every chunk local, read the whole device once (for example with `dd` to `/dev/null`).
|
||||
- **A restored volume takes no scheduled snapshot until its whole device has been read once**: while any chunk is absent, each scheduled snapshot is skipped and counted as `restoring`.
|
||||
- A manual snapshot (`ops chunk snapshot`) is taken in that state too. It names the source's chunks for every chunk v2 has not made local, so, like any snapshot of v2, it cannot be restored (below).
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Troubleshooting
|
||||
|
||||
**Coming in v1.0.1 (on `main`, not in v1.0.0).** `cluster.check` in `sw-block shell` runs the checks below in the order a start-up fails and prints
|
||||
`cluster.check` in `sw-block shell` runs the checks below in the order a start-up fails and prints
|
||||
one line per check: `ok`, `FAIL`, `not checked here` or `not applicable`. A `FAIL` line names its section on this page. Each section
|
||||
begins with the same one-sentence cure the command prints, then says what you see and how to fix it.
|
||||
|
||||
@@ -131,7 +131,8 @@ prove a new failure, so read the holder's log. Off the host: `not checked here:
|
||||
local-engine volume: `not applicable: no chunk store`.
|
||||
|
||||
**Fix:** a retryable code (`remote_unavailable`) clears when SeaweedFS answers again; keep free capacity in
|
||||
SeaweedFS. See [recovery point and sync policy](operator-guide.md#recovery-point-and-sync-policy).
|
||||
SeaweedFS. `remote_unavailable` also follows a request that ran out of its own 5-minute bound while SeaweedFS was
|
||||
still answering (a long first cut); rerun it: the work already done is kept. See [recovery point and sync policy](operator-guide.md#recovery-point-and-sync-policy).
|
||||
|
||||
## volume.cleaning
|
||||
|
||||
|
||||
Reference in new issue
Block a user