|
7 | 7 | "os" |
8 | 8 | "os/exec" |
9 | 9 | "path" |
| 10 | + "time" |
10 | 11 |
|
11 | 12 | "github.com/cloudnative-pg/barman-cloud/pkg/api" |
12 | 13 | barmanArchiver "github.com/cloudnative-pg/barman-cloud/pkg/archiver" |
@@ -358,10 +359,12 @@ func loadBackupObjectFromExternalCluster( |
358 | 359 | return nil, nil, err |
359 | 360 | } |
360 | 361 |
|
| 362 | + contextLogger.Info("Downloading backup catalog") |
361 | 363 | backupCatalog, err := barmanCommand.GetBackupList(ctx, recoveryObjectStore, serverName, env) |
362 | 364 | if err != nil { |
363 | 365 | return nil, nil, err |
364 | 366 | } |
| 367 | + contextLogger.Info("Downloaded backup catalog", "backupCatalog", shortenedCatalog(backupCatalog)) |
365 | 368 |
|
366 | 369 | // We are now choosing the right backup to restore |
367 | 370 | var targetBackup *barmanCatalog.BarmanBackup |
@@ -408,3 +411,34 @@ func loadBackupObjectFromExternalCluster( |
408 | 411 | }, |
409 | 412 | }, env, nil |
410 | 413 | } |
| 414 | + |
| 415 | +// ShortBackupCatalogEntry is used when logging the downloaded backup |
| 416 | +// catalog and contains only the fields used for debugging |
| 417 | +type ShortBackupCatalogEntry struct { |
| 418 | + // BackupID is the backup ID |
| 419 | + BackupID string `json:"backupID"` |
| 420 | + |
| 421 | + // StartTime is the backup time |
| 422 | + StartTime time.Time `json:"startTime"` |
| 423 | + |
| 424 | + // EndTime is the end time |
| 425 | + EndTime time.Time `json:"endTime"` |
| 426 | +} |
| 427 | + |
| 428 | +// shortenedCatalog creates a structure containing the debug information |
| 429 | +// of a backup catalog. |
| 430 | +func shortenedCatalog(catalog *barmanCatalog.Catalog) []ShortBackupCatalogEntry { |
| 431 | + if catalog == nil { |
| 432 | + return nil |
| 433 | + } |
| 434 | + |
| 435 | + result := make([]ShortBackupCatalogEntry, len(catalog.List)) |
| 436 | + |
| 437 | + for i, v := range catalog.List { |
| 438 | + result[i].BackupID = v.BackupName |
| 439 | + result[i].StartTime = v.BeginTime |
| 440 | + result[i].EndTime = v.EndTime |
| 441 | + } |
| 442 | + |
| 443 | + return result |
| 444 | +} |
0 commit comments