pingcap / pingcap/tidb-operator
BackupSchedule: support automatic `backup log truncate` when only `maxBackups` is supplied
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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