mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 18:17:16 +01:00
Merge pull request #760 from seaweedfs/fix/volume-status-chunk
fix: preserve chunk diagnostics in volume status reports
This commit is contained in:
commit
41337eed22
4 files changed
+50
No files matched your search
@@ -116,6 +116,9 @@ type DurableReport struct {
|
||||
HeadLSN uint64 `json:"head_lsn"`
|
||||
Closed bool `json:"closed"`
|
||||
Evidence string `json:"evidence,omitempty"`
|
||||
|
||||
// Chunk preserves the holder's chunk-layer status for walstore-chunk volumes.
|
||||
Chunk *durable.ChunkStatus `json:"chunk,omitempty"`
|
||||
}
|
||||
|
||||
type ResidueReport struct {
|
||||
@@ -287,6 +290,7 @@ func durableSnapshots(statuses []durable.VolumeStatus) []DurableReport {
|
||||
HeadLSN: st.HeadLSN,
|
||||
Closed: st.Closed,
|
||||
Evidence: st.Evidence,
|
||||
Chunk: st.Chunk,
|
||||
})
|
||||
}
|
||||
return out
|
||||
|
||||
@@ -534,3 +534,42 @@ func firstMapFromSlice(t *testing.T, v any) map[string]any {
|
||||
}
|
||||
return asMap(t, items[0])
|
||||
}
|
||||
|
||||
func TestBuildVolumeStatusReport_PreservesChunkStatus(t *testing.T) {
|
||||
for _, tc := range []struct {
|
||||
name string
|
||||
chunk *durable.ChunkStatus
|
||||
}{
|
||||
{name: "walstore-chunk", chunk: &durable.ChunkStatus{Attached: true, RemoteLSN: 42}},
|
||||
{name: "walstore"},
|
||||
} {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
report := BuildVolumeStatusReport(VolumeStatusReportInput{
|
||||
Durable: []durable.VolumeStatus{{VolumeID: "v1", Impl: tc.name, Chunk: tc.chunk}},
|
||||
})
|
||||
data, err := json.Marshal(report)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var decoded struct {
|
||||
Durable []struct {
|
||||
Chunk *durable.ChunkStatus `json:"chunk"`
|
||||
} `json:"durable"`
|
||||
}
|
||||
if err := json.Unmarshal(data, &decoded); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(decoded.Durable) != 1 {
|
||||
t.Fatalf("durable entries = %d, want 1", len(decoded.Durable))
|
||||
}
|
||||
got := decoded.Durable[0].Chunk
|
||||
if tc.chunk == nil {
|
||||
if got != nil {
|
||||
t.Fatalf("plain walstore has chunk status: %+v", got)
|
||||
}
|
||||
} else if got == nil || !got.Attached || got.RemoteLSN != 42 {
|
||||
t.Fatalf("chunk status lost from report: %s", data)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -122,6 +122,12 @@ These are narrow alpha claims tied to documented gates. See
|
||||
|
||||
## Known issues
|
||||
|
||||
- The master's node evidence currently sets `ready` and `schedulable` to true
|
||||
for registered nodes. Without a Kubernetes node-evidence overlay, these values
|
||||
and the derived node-ready status do not prove host readiness or scheduling
|
||||
eligibility; check the Kubernetes Node itself. Tracked for v1.1.0 in
|
||||
[issue #762](https://github.com/seaweedfs/seaweed-block/issues/762).
|
||||
|
||||
- In v1.0.0, cleanup evidence without `cleanup_observed_at` can incorrectly
|
||||
report a `SwBlockVolume` deletion as releasable despite the status projection's
|
||||
15-minute evidence age bound ([#188](https://github.com/seaweedfs/seaweed-block/issues/188)).
|
||||
|
||||
@@ -152,6 +152,7 @@ The contract should produce an append-only JSON object with these sections.
|
||||
- `operational`
|
||||
- `closed`
|
||||
- `evidence`
|
||||
- `chunk` (optional): the holder's chunk-layer status for `walstore-chunk` volumes; absent for plain `walstore`.
|
||||
|
||||
### Residue
|
||||
|
||||
|
||||
Reference in new issue
Block a user