From 998a50adc68dac71a60015136edac3d6299b1a62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Leszczy=C5=84ski?= <2000michal@wp.pl> Date: Wed, 28 Feb 2024 14:20:26 +0100 Subject: [PATCH] fix(backup): allow for empty snapshot dirs on reindexing Fixes #3733 --- pkg/service/backup/service.go | 1 + pkg/service/backup/worker.go | 1 + pkg/service/backup/worker_index.go | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/service/backup/service.go b/pkg/service/backup/service.go index 0533fe1a02..481986e56c 100644 --- a/pkg/service/backup/service.go +++ b/pkg/service/backup/service.go @@ -786,6 +786,7 @@ func (s *Service) Backup(ctx context.Context, clusterID, taskID, runID uuid.UUID Config: s.config, Client: client, }, + PrevStage: run.Stage, Metrics: s.metrics, Units: run.Units, OnRunProgress: s.putRunProgressLogError, diff --git a/pkg/service/backup/worker.go b/pkg/service/backup/worker.go index d7c49b4e39..cdede6daeb 100644 --- a/pkg/service/backup/worker.go +++ b/pkg/service/backup/worker.go @@ -64,6 +64,7 @@ type workerTools struct { type worker struct { workerTools + PrevStage Stage Metrics metrics.BackupMetrics Units []Unit Schema *bytes.Buffer diff --git a/pkg/service/backup/worker_index.go b/pkg/service/backup/worker_index.go index 9fa5d18bde..ab8d3322c2 100644 --- a/pkg/service/backup/worker_index.go +++ b/pkg/service/backup/worker_index.go @@ -147,7 +147,9 @@ func (w *worker) indexSnapshotDirs(ctx context.Context, h hostInfo) ([]snapshotD } } - if len(dirs) == 0 { + // In case of reindexing, it's possible that all snapshot dirs + // were already uploaded and deleted in the previous run (#3733). + if w.PrevStage != StageUpload && len(dirs) == 0 { return nil, errors.New("could not find any files") }