mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 02:27:26 +01:00
storage: recovery's fence progress keeps a fence hook already set
Recovery replaced any fenceSliceHook for the fence and then cleared it, so a hook set by its caller saw nothing. It now calls that hook first and restores it afterwards. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6bf0445fcd
commit
009e9bb188
1 file changed
+10
-3
@@ -744,11 +744,18 @@ func (s *WALStore) recoverV3(ctx context.Context) (uint64, error) {
|
||||
// The drop fence, then the recovered head, then the writer and admission.
|
||||
floor, sameNonce := v.pub.reuseFloor()
|
||||
// Each synced fence slice is recovery progress. The hook runs under the
|
||||
// store lock and only records a frontier (the watchdog's leaf lock).
|
||||
// store lock and only records a frontier (the watchdog's leaf lock); a
|
||||
// hook already set keeps being called and is restored afterwards.
|
||||
fence := newRecoveryReporter(ctx, RecoveryFence)
|
||||
v.fenceSliceHook = fence.advance
|
||||
prevHook := v.fenceSliceHook
|
||||
v.fenceSliceHook = func(n uint64) {
|
||||
if prevHook != nil {
|
||||
prevHook(n)
|
||||
}
|
||||
fence.advance(n)
|
||||
}
|
||||
err = s.fenceV3(o.E, floor, d.WALSize, sameNonce, d.WALOffset)
|
||||
v.fenceSliceHook = nil
|
||||
v.fenceSliceHook = prevHook
|
||||
fence.finish()
|
||||
if err != nil {
|
||||
s.dm.clear()
|
||||
|
||||
Reference in new issue
Block a user