mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-06 19:17:28 +01:00
* perf(blockmaster): retire deleted metadata outside the serving path * docs(block): cite the post-start retirement progress model * test(block): drop the retirement layout identity probe site The retirement pass no longer reads the record's LayoutID (the deferred HEAD read log now goes through the pass skip summary), so the guard's allowlist entry is stale and TestLayoutIdentityWriterAndReaders fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(block): keep INV-SPEC-DELETE-RETRY-001 under the statement limit The rewritten statement was 586 characters, over the 300 that TestInvariantStatementsAreShort allows. Keep the property in the statement and move the visit bound to the DeleteReserved transition row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(blockmaster): keep idle retirement passes silent The worker runs a pass every freshness window (10 s by default), and each pass logged a start and an end line even with nothing to retire: two lines every 10 s on every idle master. Report a pass only when it has pending eligible records. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(block): align retirement traces with the current model * test(block): pin retirement recovery and complete slow-pass evidence * test(block): resume restore setup after filer reconnects * fix(block): isolate retirement catalog connection * test(block): remove unused restore retry import * docs(block): describe retirement guards per attempt --------- Co-authored-by: pingqiu <pingqiu@users.noreply.github.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
90 lines
3.0 KiB
Go
90 lines
3.0 KiB
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/seaweedfs/seaweed-block/core/frontend/chunkstore"
|
|
"github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout"
|
|
"github.com/seaweedfs/seaweed-block/core/lifecycle"
|
|
)
|
|
|
|
// layoutVolumeCreator writes only the master's initial VOLUME and unclaimed
|
|
// HEAD. layout.CreateVolume performs exclusive writes and heals a replay
|
|
// stopped between them without minting another identity.
|
|
func layoutVolumeCreator(cat *chunkstore.BCatalog) func(context.Context, lifecycle.VolumeSpec) error {
|
|
return func(ctx context.Context, spec lifecycle.VolumeSpec) error {
|
|
if cat == nil {
|
|
return fmt.Errorf("master: layout catalog is unavailable")
|
|
}
|
|
id, err := layout.ParseVolumeID(spec.LayoutID)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
_, err = cat.CreateVolume(ctx, chunkstore.VolumeRef{Name: spec.VolumeID, ID: id}, layout.Geometry{
|
|
SizeBytes: spec.SizeBytes, BlockSize: spec.BlockSize, ChunkBytes: spec.ChunkBytes,
|
|
})
|
|
return err
|
|
}
|
|
}
|
|
|
|
func layoutVolumeReader(cat *chunkstore.BCatalog) func(context.Context, lifecycle.VolumeSpec) (layout.Volume, error) {
|
|
return func(ctx context.Context, spec lifecycle.VolumeSpec) (layout.Volume, error) {
|
|
id, err := layout.ParseVolumeID(spec.LayoutID)
|
|
if err != nil {
|
|
return layout.Volume{}, err
|
|
}
|
|
return cat.ReadVolume(ctx, chunkstore.VolumeRef{Name: spec.VolumeID, ID: id})
|
|
}
|
|
}
|
|
|
|
func layoutHeadReader(cat *chunkstore.BCatalog) func(context.Context, lifecycle.VolumeSpec) (layout.Head, error) {
|
|
return func(ctx context.Context, spec lifecycle.VolumeSpec) (layout.Head, error) {
|
|
id, err := layout.ParseVolumeID(spec.LayoutID)
|
|
if err != nil {
|
|
return layout.Head{}, err
|
|
}
|
|
h, found, err := cat.ReadHead(ctx, chunkstore.VolumeRef{Name: spec.VolumeID, ID: id})
|
|
if err != nil {
|
|
return layout.Head{}, err
|
|
}
|
|
if !found {
|
|
return layout.Head{}, layout.ErrHeadAbsent
|
|
}
|
|
return h, nil
|
|
}
|
|
}
|
|
|
|
func layoutTargetCreator(cat *chunkstore.BCatalog) func(context.Context, lifecycle.VolumeSpec, lifecycle.VolumeSpec, string) error {
|
|
return func(ctx context.Context, source, target lifecycle.VolumeSpec, snapshot string) error {
|
|
sid, err := layout.ParseVolumeID(source.LayoutID)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
tid, err := layout.ParseVolumeID(target.LayoutID)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
_, err = cat.Restore(ctx,
|
|
chunkstore.VolumeRef{Name: source.VolumeID, ID: sid}, snapshot,
|
|
chunkstore.VolumeRef{Name: target.VolumeID, ID: tid})
|
|
return err
|
|
}
|
|
}
|
|
|
|
// newRetirementHeadReader opens only a read transport. The serving catalog has
|
|
// already validated the endpoint; retirement must not repeat its write probes
|
|
// or start another probe-cleanup worker.
|
|
func newRetirementHeadReader(cfg chunkstore.SWFSConfig) (func(context.Context, lifecycle.VolumeSpec) (layout.Head, error), *chunkstore.SWFS, error) {
|
|
client, err := chunkstore.DialSWFS(cfg)
|
|
if err != nil {
|
|
return nil, nil, err
|
|
}
|
|
cat, err := chunkstore.NewBCatalog(client, client, cfg.AssignPath)
|
|
if err != nil {
|
|
_ = client.Close()
|
|
return nil, nil, err
|
|
}
|
|
return layoutHeadReader(cat), client, nil
|
|
}
|