mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 10:07:28 +01:00
storage: distinguish recovery and map generation refusals
This commit is contained in:
1 parent
a1209b2d90
commit
2ed15f2c03
3 files changed
+18
-12
No files matched your search
@@ -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) {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user