Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tsm1): "snapshot in progress" error during backup: restore loop with backoff #20063

Merged
merged 2 commits into from
Nov 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion tsdb/engine/tsm1/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -1941,7 +1941,13 @@ func (e *Engine) WriteSnapshot() (err error) {
// skipCacheOk controls whether it is permissible to fail writing out
// in-memory cache data when a previous snapshot is in progress
func (e *Engine) CreateSnapshot(skipCacheOk bool) (string, error) {
if err := e.WriteSnapshot(); (err == ErrSnapshotInProgress) && skipCacheOk {
err := e.WriteSnapshot()
for i := 0; (i < 3) && (err == ErrSnapshotInProgress); i += 1 {
backoff := time.Duration(math.Pow(32, float64(i))) * time.Millisecond
time.Sleep(backoff)
err = e.WriteSnapshot()
}
if (err == ErrSnapshotInProgress) && skipCacheOk {
e.logger.Warn("Snapshotter busy: proceeding without cache contents.")
} else if err != nil {
return "", err
Expand Down