From 1474ae792c036a0ad118090a5a0bef99354d8350 Mon Sep 17 00:00:00 2001 From: Shreyas S Date: Mon, 25 Nov 2024 15:25:01 +0530 Subject: [PATCH] Prevent skipping scheduled full snapshots when there are no new updates (#804) * skip scheduled full snapshots only if the previous was final * modified check for full snapshot * addressed review comments from @shreyas-s-rao --- pkg/snapshot/snapshotter/snapshotter.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkg/snapshot/snapshotter/snapshotter.go b/pkg/snapshot/snapshotter/snapshotter.go index bac30f99b..f7b462c02 100644 --- a/pkg/snapshot/snapshotter/snapshotter.go +++ b/pkg/snapshot/snapshotter/snapshotter.go @@ -344,9 +344,8 @@ func (ssr *Snapshotter) takeFullSnapshot(isFinal bool) (*brtypes.Snapshot, error } } lastRevision := resp.Header.Revision - - if ssr.PrevSnapshot.Kind == brtypes.SnapshotKindFull && ssr.PrevSnapshot.LastRevision == lastRevision && ssr.PrevSnapshot.IsFinal == isFinal { - ssr.logger.Infof("There are no updates since last snapshot, skipping full snapshot.") + if isFinal && ssr.PrevSnapshot.IsFinal && ssr.PrevSnapshot.Kind == brtypes.SnapshotKindFull && ssr.PrevSnapshot.LastRevision == lastRevision { + ssr.logger.Infof("There are no new updates since previous final full snapshot, skipping new final full snapshot.") } else { // Note: As FullSnapshot size can be very large, so to avoid context timeout use "SnapshotTimeout" in context.WithTimeout() ctx, cancel = context.WithTimeout(context.TODO(), ssr.etcdConnectionConfig.SnapshotTimeout.Duration)