pingcap / pingcap/tidb

BR: Add comprehensive CLI parameter validation

Open
#66,279 0 comments 0 reactions 0 assignees View on GitHub
type/enhancement
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Enhancement

### Background
BR (Backup & Restore) currently lacks comprehensive validation for CLI parameters, allowing users to provide illegal or semantically invalid values that may lead to confusing behavior or silent failures.

### Proposed Changes
Add validation for BR CLI parameters to reject invalid inputs early with clear error messages. This tracking issue will coordinate multiple sub-issues for different parameter validation problems.

### Known Issues

#### 1. --backupts accepts future timestamps without validation
- **Status:** Identified
- **Affected versions:** 6.5.3, current master
- **Issue:** #66280
- **Code location:**
- \`br/pkg/backup/client.go\` - GetTS() function (lines 458-497)
- \`br/pkg/task/backup.go\` - ParseTSString() function (lines 789-814)

#### 2. [Future discoveries]
Additional parameter validation issues will be added here as they are discovered.

### Related Files
- \`br/pkg/task/backup.go\` - Parameter parsing and validation
- \`br/pkg/backup/client.go\` - Timestamp validation logic
- \`br/pkg/task/common.go\` - Common parameter handling

### References
- Flag definitions: \`br/pkg/task/backup.go\` lines 110-145
- Error types: \`br/pkg/errors/errors.go\`

Contributor guide

Open the contributing guide

Research direction

Start with br/pkg/task/backup.go, br/pkg/backup/client.go, and br/pkg/task/common.go, reviewing the flag definitions and the GetTS() and ParseTSString() functions. Check issue #66280 for the known future-timestamp case; done means invalid CLI parameter values are rejected early with clear errors and the remaining validation gaps are coordinated as sub-issues.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.