Compare commits

...
Author SHA1 Message Date
pingqiuandClaude Opus 5.5 ccbec4f273 test(block): the chunk-size guard has a control spec that must pass
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-05 22:52:17 -08:00
pingqiuandClaude Opus 5.5 c9481250c5 test(block): the largest creatable volume fits one snapshot delete
A snapshot delete stages its root, one segment per shard and one entry
per chunk in at most MaxListPages pages of MaxListPageEntries. The test
derives the largest creatable volume's count (MaxVolumeBytes, the lab
limit, at the only chunk size a spec takes) from the same constants and
requires it within that cap. The operations manual states the cap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-05 21:55:53 -08:00
2 changed files with 44 additions and 0 deletions

No files matched your search

@@ -0,0 +1,42 @@
package lifecycle
import (
"testing"
"github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout"
"github.com/seaweedfs/seaweed-block/core/geometry"
)
// One snapshot delete stages its candidates (the snapshot's root, one segment
// per shard, one entry per chunk) in at most MaxListPages pages of
// MaxListPageEntries; past that the staging refuses ("snapshot-delete intent
// exceeds page limit") and the snapshot cannot be deleted. Every volume this
// code can create must fit: the largest size any build accepts (MaxVolumeBytes,
// the lab tag's limit, at or above a release's MaxNewVolumeBytes) at the only
// chunk size a volume spec takes. Shrinking the page limits or raising the
// size limit past the cap fails here.
func TestLargestCreatableVolumeFitsOneSnapshotDelete(t *testing.T) {
chunkBytes := normalizeVolumeSpec(VolumeSpec{}).ChunkBytes
if chunkBytes == 0 {
t.Fatal("no default chunk size")
}
spec := VolumeSpec{VolumeID: "v1", SizeBytes: 1 << 30, ReplicationFactor: 1}
if err := validateSpec(normalizeVolumeSpec(spec)); err != nil {
t.Fatalf("the control spec is refused, so the chunk-size check below proves nothing: %v", err)
}
spec.ChunkBytes = chunkBytes / 2
if err := validateSpec(normalizeVolumeSpec(spec)); err == nil {
t.Fatal("a smaller chunk size is accepted: the largest chunk count is no longer at the default chunk size")
}
capacity := uint64(layout.MaxListPages) * uint64(layout.MaxListPageEntries)
for _, size := range []uint64{geometry.MaxNewVolumeBytes, geometry.MaxVolumeBytes} {
chunks := (size + uint64(chunkBytes) - 1) / uint64(chunkBytes)
shards := (chunks + layout.ShardSize - 1) / layout.ShardSize
candidates := 1 + shards + chunks
t.Logf("size %d: %d chunks, %d shards, %d candidates of %d", size, chunks, shards, candidates, capacity)
if candidates > capacity {
t.Fatalf("a %d-byte volume stages %d snapshot-delete candidates, over the %d (%d pages x %d entries) one delete can hold",
size, candidates, capacity, layout.MaxListPages, layout.MaxListPageEntries)
}
}
}
+2
View File
@@ -914,6 +914,8 @@ marked "v1.1.0 only" are lifted in v1.1.1 ([v1.1.1 notes](releases/v1.1.1.md)):
In every v1.1.x:
- **Volume size** is at most 1 TiB, and start time grows with size (section 3).
- **One snapshot delete** stages at most 16,777,216 objects: the snapshot's root, one segment per 10,000 chunks, and
its chunks. Every supported volume size fits: a 1 TiB volume stages 262,172.
- **The first restart right after a large fill** can take seconds longer than later restarts, while the kernel writes
back the fill.
- **One filer per chunk store.** It is a single point of availability for cuts, snapshots and moves.