pingcap / pingcap/tidb-operator

BackupSchedule: support automatic `backup log truncate` when only `maxBackups` is supplied

Open
#6,068 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/backup tools/br
Dominant language
Go
Stars
1.3k
Forks
540
Avg merge
3d 2h
Merged PRs (30d)
18

Description

Feature Request

Is your feature request related to a problem? Please describe:

In a BackupSchedule CR, if logBackupTemplate is setup, it will run log backup. According to the docs, the streaming logs will be truncated only according to maxReservedTime.

Expiry of snapshot backup can be configured with either maxBackups or maxReservedTime. Because the schedule may be irregular, it is not always possible to use maxReservedTime to reproduce the effect of maxBackups.

(internal - see GTOC-7367 for details)

Describe the feature you'd like:

When some snapshots are deleted by maxBackups, additionally use that oldest snapshot's CommitTS has the TruncateTSO and perform br log truncate.

Describe alternatives you've considered:
Keep the status quo? 🤔

Teachability, Documentation, Adoption, Migration Strategy:

In the BackupSchedule CR documentation, change this sentence:

- The log backup is created and deleted along with `backupSchedule` and recycled according to `.spec.maxReservedTime`.
+ The log backup is created and deleted along with `backupSchedule` and recycled according to `.spec.maxReservedTime` or `.spec.maxBackups`.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in pkg/backup/backupschedule/backup_schedule_manager.go around lines 995-1025, where snapshots deleted by maxBackups are handled, and review the existing log-backup flow. Then update the BackupSchedule CR documentation at the linked backup-restore-cr-fields page. Done means maxBackups supplies the oldest deleted snapshot's CommitTS for log truncation and the documentation describes both retention settings.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes
Domain
databases, devops
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.