Unverified Commit 36b954d3 authored by Lemon-miaow's avatar Lemon-miaow
Browse files

docs(backupjob): the backup Job name is not deterministic anymore

The comment described a deterministic-name collision that the unique random
suffix made near-impossible; align it with Backuper.Backup and jobspec's
contract (ErrAlreadyExists survives only as the defensive no-op).
parent 30857df5
Loading
Loading
Loading
Loading
+4 −4
Changes for internal/backupjob/k8sjobs.go: 4 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -24,10 +24,10 @@ func NewK8sJobs(c client.Client) *K8sJobs {
	return &K8sJobs{c: c}
}

// CreateBackupJob renders and applies the backup Job. Its name is a deterministic
// function of the server (BackupJobName), so a concurrent backup of the same server
// collides on Create; that collision is mapped to ErrAlreadyExists, which the
// Backuper treats as success (idempotent enqueue).
// CreateBackupJob renders and applies the backup Job. Its name carries a fresh
// random suffix (see Backuper.Backup), so a repeated backup never collides with a
// just-finished Job inside its TTL window; ErrAlreadyExists survives only as the
// defensive no-op for the astronomically unlikely suffix collision.
func (k *K8sJobs) CreateBackupJob(ctx context.Context, p JobParams) error {
	job, err := BackupJob(p)
	if err != nil {