mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 10:07:28 +01:00
storage: test the chunk record's BASE-completion event
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
570b884018
commit
8db613cb01
1 file changed
+42
@@ -409,3 +409,45 @@ func TestShadowRecoverChangesOnlyTheRecoveredChunks(t *testing.T) {
|
||||
t.Fatalf("after Recover the checker missed %v", misses)
|
||||
}
|
||||
}
|
||||
|
||||
// M3: a BASE install completing makes the local image authoritative for
|
||||
// every chunk: before the checkpoint passes it, each chunk gets Changed with
|
||||
// coverage all, so no chunk the record held clean stays clean, and the next
|
||||
// cut's checker finds every engine candidate named. Mutant (the completion
|
||||
// event removed): the formerly clean chunk stays HP and the checker
|
||||
// reports it.
|
||||
func TestShadowBaseInstallCompletingChangesEveryChunk(t *testing.T) {
|
||||
s, _, l := mappedBASELayerV3(t)
|
||||
writeSynced(t, s, 5, 5)
|
||||
if _, err := l.Cut(ctTimeout(t)); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
const clean = 9
|
||||
if k := shadowKind(l, clean); k != chunkkernel.HashPublished {
|
||||
t.Fatalf("setup: chunk %d is %s after the first cut, want HP", clean, k)
|
||||
}
|
||||
h, err := s.BeginBaseInstall(7, idA)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := h.WriteBase(5, blk(0x55)); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := h.MarkBaseComplete(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if k := shadowKind(l, clean); k != chunkkernel.Unknown {
|
||||
t.Fatalf("after the BASE install completed: chunk %d is %s, want U", clean, k)
|
||||
}
|
||||
var misses []uint64
|
||||
l.testShadowCheck = func(miss, _ []uint64) { misses = append(misses, miss...) }
|
||||
if _, err := l.Cut(ctTimeout(t)); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(misses) != 0 {
|
||||
t.Fatalf("after the BASE install the checker missed %v", misses)
|
||||
}
|
||||
if n := shadowDefects(l); n != 0 {
|
||||
t.Fatalf("%d shell events refused", n)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user