diff --git a/seaweed-block/cmd/blockvolume/chunk_remote.go b/seaweed-block/cmd/blockvolume/chunk_remote.go index b8f545c63c..52cc013570 100644 --- a/seaweed-block/cmd/blockvolume/chunk_remote.go +++ b/seaweed-block/cmd/blockvolume/chunk_remote.go @@ -19,9 +19,13 @@ import ( ) const ( - defaultChunkPath = "/swblock/chunks" - defaultChunkCaptureInterval = 30 * time.Second - defaultChunkDirtyThreshold = 64 // chunks, 256 MiB at 4 MiB chunks + defaultChunkPath = "/swblock/chunks" + // The remote holds snapshots, not live data: cuts are published at + // snapshots, at detach/stop and on explicit request. The timer is off + // by default (an operator may set one, e.g. 15m, as a host-loss safety + // net); the dirty threshold only bounds how large one cut can grow. + defaultChunkCaptureInterval = 0 + defaultChunkDirtyThreshold = 512 // chunks, 2 GiB at 4 MiB chunks ) type chunkFlags struct { diff --git a/seaweed-block/cmd/blockvolume/chunk_remote_test.go b/seaweed-block/cmd/blockvolume/chunk_remote_test.go index b3c2817477..8fe091a483 100644 --- a/seaweed-block/cmd/blockvolume/chunk_remote_test.go +++ b/seaweed-block/cmd/blockvolume/chunk_remote_test.go @@ -31,8 +31,8 @@ func TestWALStoreChunkFlags(t *testing.T) { if err != nil { t.Fatal(err) } - if d.chunk.captureInterval != 30*time.Second || d.chunk.dirtyThreshold != 64 { - t.Fatalf("scheduler defaults interval %s threshold %d, want 30s and 64", d.chunk.captureInterval, d.chunk.dirtyThreshold) + if d.chunk.captureInterval != 0 || d.chunk.dirtyThreshold != 512 { + t.Fatalf("scheduler defaults interval %s threshold %d, want timer off and 512", d.chunk.captureInterval, d.chunk.dirtyThreshold) } off, err := parseFlags(base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--chunk-filer=x:1", "--chunk-capture-interval=0", "--chunk-dirty-threshold=0")) diff --git a/seaweed-block/cmd/blockvolume/main.go b/seaweed-block/cmd/blockvolume/main.go index 2cc98f3ac0..5410403f2d 100644 --- a/seaweed-block/cmd/blockvolume/main.go +++ b/seaweed-block/cmd/blockvolume/main.go @@ -174,8 +174,8 @@ func parseFlags(args []string) (flags, error) { fs.StringVar(&f.chunk.path, "chunk-path", defaultChunkPath, "walstore-chunk: filer directory holding one directory per volume (HEAD and chunk key bindings)") fs.StringVar(&f.chunk.collection, "chunk-collection", "", "walstore-chunk: collection for chunk needles (empty = filer default / storage rule)") fs.StringVar(&f.chunk.replication, "chunk-replication", "", "walstore-chunk: replication for chunk needles (empty = filer default / storage rule)") - fs.DurationVar(&f.chunk.captureInterval, "chunk-capture-interval", defaultChunkCaptureInterval, "walstore-chunk: automatic cut once this long has passed since the last successful cut; 0 disables the timer") - fs.IntVar(&f.chunk.dirtyThreshold, "chunk-dirty-threshold", defaultChunkDirtyThreshold, "walstore-chunk: automatic cut once this many chunks are dirty since the last HEAD; 0 disables the threshold") + fs.DurationVar(&f.chunk.captureInterval, "chunk-capture-interval", defaultChunkCaptureInterval, "walstore-chunk: automatic cut once this long has passed since the last successful cut; 0 (default) disables the timer, e.g. 15m as a host-loss safety net") + fs.IntVar(&f.chunk.dirtyThreshold, "chunk-dirty-threshold", defaultChunkDirtyThreshold, "walstore-chunk: bound on one cut's size: automatic cut once this many chunks are dirty since the last HEAD; 0 disables the bound") fs.BoolVar(&f.chunk.controlEndpoint, "chunk-control-endpoint", false, "walstore-chunk: expose the /chunk/* control routes (cut, snapshot, snapshots, snapshot/delete, detach) on the status HTTP listener; off by default; loopback-only like the listener") fs.UintVar(&f.durableBlocks, "durable-blocks", 2048, "number of blocks per volume on first create (ignored when opening existing)") fs.UintVar(&f.durableBlockSize, "durable-blocksize", 4096, "block size in bytes on first create") diff --git a/seaweed-block/core/frontend/durable/provider.go b/seaweed-block/core/frontend/durable/provider.go index 6ebd419794..7247e340d6 100644 --- a/seaweed-block/core/frontend/durable/provider.go +++ b/seaweed-block/core/frontend/durable/provider.go @@ -148,7 +148,9 @@ type ProviderConfig struct { // disables the timer. ChunkCaptureInterval time.Duration // ChunkDirtyThreshold: an automatic cut is due once this many chunks - // are dirty since the last HEAD. Zero disables the threshold. With + // are dirty since the last HEAD; it bounds one cut's size rather than + // keeping the remote fresh (the remote holds snapshots). Zero disables + // the threshold. With // both zero there are no automatic cuts (only CaptureVolume and // MakeVolumeRemoteDurable). ChunkDirtyThreshold int