MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / run

Method run

pkg/management/postgres/backup.go:146–165  ·  view source on GitHub ↗

run executes the barman-cloud-backup command and updates the status This method will take long time and is supposed to run inside a dedicated goroutine.

(ctx context.Context)

Source from the content-addressed store, hash-verified

144// This method will take long time and is supposed to run inside a dedicated
145// goroutine.
146func (b *BackupCommand) run(ctx context.Context) {
147 ctx = log.IntoContext(
148 ctx,
149 log.FromContext(ctx).
150 WithValues(
151 "backupName", b.Backup.Name,
152 "backupNamespace", b.Backup.Namespace,
153 ),
154 )
155
156 if err := b.takeBackup(ctx); err != nil {
157 // record the failure
158 b.Log.Error(err, "Backup failed")
159 b.Recorder.Event(b.Backup, "Normal", "Failed", "Backup failed")
160
161 _ = status.FlagBackupAsFailed(ctx, b.Client, b.Backup, b.Cluster, err)
162 }
163
164 b.backupMaintenance(ctx)
165}
166
167func (b *BackupCommand) takeBackup(ctx context.Context) error {
168 backupStatus := b.Backup.GetStatus()

Callers 2

StartMethod · 0.95
backup_test.goFile · 0.80

Calls 5

takeBackupMethod · 0.95
backupMaintenanceMethod · 0.95
FlagBackupAsFailedFunction · 0.92
WithValuesMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected