Skip to content

Commit

Permalink
broker: tear down a stale append pipeline before proxying
Browse files Browse the repository at this point in the history
This can happen if we were primary, but have been re-assigned as a
replica without an observed cancellation of our assignment in between.

We must tear down the stale pipeline to release replica spools before we
return it.
  • Loading branch information
jgraettinger committed Jan 16, 2025
1 parent 19bd20f commit ad2a8c9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion broker/append_fsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,11 @@ func (b *appendFSM) onResolve() {
b.state = stateError
} else if b.resolved.ProcessId != b.resolved.localID {
// If we hold the pipeline from a previous resolution but are no longer
// primary, we must release it.
// primary, we must tear it down to release replica spools.
if b.pln != nil {
go b.pln.shutdown(false)
b.pln = nil
}
b.returnPipeline()
b.state = stateAwaitDesiredReplicas // We must proxy.
} else if b.plnReturnCh != nil {
Expand Down

0 comments on commit ad2a8c9

Please sign in to comment.