Skip to content

Commit

Permalink
Prevent skipping scheduled full snapshots when there are no new updat…
Browse files Browse the repository at this point in the history
…es (#804)

* skip scheduled full snapshots only if the previous was final

* modified check for full snapshot

* addressed review comments from @shreyas-s-rao
  • Loading branch information
Shreyas-s14 authored Nov 25, 2024
1 parent 474a509 commit 1474ae7
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pkg/snapshot/snapshotter/snapshotter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1474ae7

Please sign in to comment.