diff --git a/seaweed-block/core/host/volume/status_server_test.go b/seaweed-block/core/host/volume/status_server_test.go index 50fffb65d1..cbdf18d3eb 100644 --- a/seaweed-block/core/host/volume/status_server_test.go +++ b/seaweed-block/core/host/volume/status_server_test.go @@ -7,6 +7,7 @@ import ( "bytes" "context" "encoding/json" + "github.com/seaweedfs/seaweed-block/core/storage" "net/http" "net/http/httptest" "strings" @@ -981,15 +982,16 @@ func TestStatusServer_DurableStatusEndpoint_EnabledAfterStart_ReturnsLineage(t * } defer func() { _ = s.Close(context.Background()) }() s.SetDurableStatusSource(stubDurableStatusSource{vols: []durable.VolumeStatus{{ - VolumeID: "v1", - Path: "/tmp/v1.bin", - Impl: "smartwal", - ReplicaID: "r1", - Epoch: 1, - EndpointVersion: 1, - Latched: true, - Operational: true, - Evidence: "recovered LSN=0", + VolumeID: "v1", + Path: "/tmp/v1.bin", + Impl: "smartwal", + ReplicaID: "r1", + Epoch: 1, + EndpointVersion: 1, + Latched: true, + Operational: true, + Evidence: "recovered LSN=0", + CheckpointPersistence: &storage.CheckpointPersistenceStatus{Successes: 3, Refusals: 2, Failures: 1}, }}}) resp, err := http.Get("http://" + addr + "/status/durable?volume=v1") @@ -1015,6 +1017,10 @@ func TestStatusServer_DurableStatusEndpoint_EnabledAfterStart_ReturnsLineage(t * if len(body.Volumes) != 1 || !body.Volumes[0].Latched || !body.Volumes[0].Operational || body.Volumes[0].Epoch != 1 { t.Fatalf("unexpected durable volume body: %+v", body.Volumes) } + checkpoint := body.Volumes[0].CheckpointPersistence + if checkpoint == nil || checkpoint.Successes != 3 || checkpoint.Refusals != 2 || checkpoint.Failures != 1 { + t.Fatalf("checkpoint counters missing from HTTP response: %+v", checkpoint) + } } func TestG9B_StatusProjection_ReturnedReplicaCanBeDurableReadyButFrontendNotReady(t *testing.T) { diff --git a/seaweed-block/core/storage/descriptor_v3.go b/seaweed-block/core/storage/descriptor_v3.go index 1300ef199a..62310d03a4 100644 --- a/seaweed-block/core/storage/descriptor_v3.go +++ b/seaweed-block/core/storage/descriptor_v3.go @@ -332,7 +332,7 @@ func mergeDescriptorV3Mode(cur, next *descriptorV3, reset bool) error { next.MapLineage != cur.MapLineage || next.MapFormatID != cur.MapFormatID { if next.MapGeneration <= cur.MapGeneration { return fmt.Errorf("%w: %w: map root change without a higher generation (%d -> %d)", - ErrMapCoverageStale, errDescriptorTransition, cur.MapGeneration, next.MapGeneration) + mapCoverageRefusal("map_generation_not_increasing"), errDescriptorTransition, cur.MapGeneration, next.MapGeneration) } if next.MapLineage != cur.MapLineage { return fmt.Errorf("%w: map lineage change outside an install or reset", errDescriptorTransition) diff --git a/seaweed-block/core/storage/walstore_v3.go b/seaweed-block/core/storage/walstore_v3.go index 7cd2bd4045..a4d2542241 100644 --- a/seaweed-block/core/storage/walstore_v3.go +++ b/seaweed-block/core/storage/walstore_v3.go @@ -1111,7 +1111,7 @@ func (f *flusher) readDirtyRecordV3Cached(e snapshotEntry, cache *flushRecordCac store := f.store d := store.v3.pub.current() if cache != nil && !store.v3.flushLifetimeValidV3(cache.recoveryGen) { - return nil, 0, ErrMapCoverageStale + return nil, 0, mapCoverageRefusal("recovery_lifetime_changed") } var entry walEntryV3 var size uint64 @@ -1180,7 +1180,7 @@ func (s *WALStore) persistCheckpointV3(highestLSN, recoveryGen uint64) error { v.syncMu.Lock() defer v.syncMu.Unlock() if !v.flushLifetimeValidV3(recoveryGen) { - return ErrMapCoverageStale + return mapCoverageRefusal("recovery_lifetime_changed") } wack := v.wack.Load() if wack < checkpoint {