Skip to content

Commit

Permalink
Do not check ssr state in handleSsrStopRequest
Browse files Browse the repository at this point in the history
The snapshotter is not set to active state until an initial delta
snapshot or a fullsnapshot has been taken. If a leadership election
takes place while the snapshot is being taken and the current leader
loses that election, then handleSsrRequest does not send on the
ssrStopCh. This in turn causes ssr.snapshotEventHandler to never return
and snapshots would continue to be taken.
  • Loading branch information
Alex Vest committed Mar 25, 2024
1 parent 600cceb commit c90aa01
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions pkg/server/backuprestoreserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,15 +523,9 @@ func handleSsrStopRequest(ctx context.Context, handler *HTTPHandler, ssr *snapsh
logger.Infof("handleSsrStopRequest: %v", ctx.Err())
}

ssr.SsrStateMutex.Lock()
if ssr.SsrState == brtypes.SnapshotterActive {
ssr.SsrStateMutex.Unlock()
close(ssrStopCh)
} else {
ssr.SsrState = brtypes.SnapshotterInactive
ssr.SsrStateMutex.Unlock()
ackCh <- emptyStruct
}
ackCh <- emptyStruct
close(ssrStopCh)

if !ok {
logger.Info("Stopping handleSsrStopRequest handler...")
return
Expand Down

0 comments on commit c90aa01

Please sign in to comment.