From c90aa01bfe7cf2e315b1155ec8534ea1dda8819d Mon Sep 17 00:00:00 2001 From: Alex Vest Date: Tue, 14 Nov 2023 15:48:05 +0000 Subject: [PATCH] Do not check ssr state in handleSsrStopRequest 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. --- pkg/server/backuprestoreserver.go | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/pkg/server/backuprestoreserver.go b/pkg/server/backuprestoreserver.go index 12001da0b..e09895072 100644 --- a/pkg/server/backuprestoreserver.go +++ b/pkg/server/backuprestoreserver.go @@ -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