From 519c8499464d91b6a97b9cf6999ba4e5f680d933 Mon Sep 17 00:00:00 2001 From: pingqiu Date: Sat, 4 Apr 2026 00:45:43 -0700 Subject: [PATCH] =?UTF-8?q?refactor:=20Task=20F+G=20=E2=80=94=20remove=20p?= =?UTF-8?q?inner=20shim,=20executor=20already=20clean?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task F (Pinner): - block_recovery.go: removed pinnerShimForRecovery (11 lines of pure pass-through). v2bridge.Pinner structurally satisfies bridge.BlockVolPinner (same method signatures), so it's passed directly. Task G (Executor): - Already clean. v2bridge.Executor is used directly without any shim — structurally satisfies engine.CatchUpIO and engine.RebuildIO. No code changes needed. After Task E+F+G: zero shim types remain in block_recovery.go. v2bridge Reader/Pinner/Executor all satisfy sw-block contracts directly. Validation: - go test ./weed/storage/blockvol/v2bridge/ -run "TestPinner_|TestExecutor_|TestBridge_" → PASS - go test ./weed/server/ -run "TestP4_|TestP16B_" → PASS (8 tests) - go test ./sw-block/bridge/blockvol/... → PASS Co-Authored-By: Claude Opus 4.6 (1M context) --- weed/server/block_recovery.go | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/weed/server/block_recovery.go b/weed/server/block_recovery.go index 8f815fa27..e70225a5f 100644 --- a/weed/server/block_recovery.go +++ b/weed/server/block_recovery.go @@ -252,7 +252,7 @@ func (rm *RecoveryManager) runCatchUp(ctx context.Context, replicaID, rebuildAdd pinner := v2bridge.NewPinner(vol) sa = bridge.NewStorageAdapter( reader, - &pinnerShimForRecovery{pinner}, + pinner, ) if s := bs.v2Orchestrator.Registry.Sender(replicaID); s != nil { if snap := s.SessionSnapshot(); snap != nil { @@ -332,7 +332,7 @@ func (rm *RecoveryManager) runRebuild(ctx context.Context, replicaID, rebuildAdd pinner := v2bridge.NewPinner(vol) sa = bridge.NewStorageAdapter( reader, - &pinnerShimForRecovery{pinner}, + pinner, ) executor = v2bridge.NewExecutor(vol, rebuildAddr) return nil @@ -521,14 +521,3 @@ func (rm *RecoveryManager) volumePathForReplica(replicaID string) string { // --- Bridge shims --- -type pinnerShimForRecovery struct{ p *v2bridge.Pinner } - -func (s *pinnerShimForRecovery) HoldWALRetention(startLSN uint64) (func(), error) { - return s.p.HoldWALRetention(startLSN) -} -func (s *pinnerShimForRecovery) HoldSnapshot(checkpointLSN uint64) (func(), error) { - return s.p.HoldSnapshot(checkpointLSN) -} -func (s *pinnerShimForRecovery) HoldFullBase(committedLSN uint64) (func(), error) { - return s.p.HoldFullBase(committedLSN) -}