-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
This issue is part of the ongoing flag refactor project: Flag renaming: replace underscores with dashes (#17880). Vitess is moving toward standardizing all CLI flags to use hyphen (-) instead of underscore (_) delimiters. The vtctld binary currently uses a mix of these conventions.
Plan:
- Both underscore and hyphen forms must be supported in v23 and v24
- Underscore versions will be removed in v25
This issue focuses on migrating the flags in the vtctld binary to the new format.
Note: Related PR should be based off branch flags-refactor and not main.
Affected Binary
vtctld
Goal
Refactor all flags in vtctld to use dashed (-) notation instead of underscored (_), while continuing to support the old names during the deprecation period. Ensure codebase-wide consistency by updating flag usage in all references
Scope of Work
1. Flag Refactoring
Update the registration of the flags with (_) notation in the vtctld binary
Examples:
--action_timeout
--backup_storage_block_size
--tablet_manager_grpc_concurrency
--vtctld_sanitize_log_messages Total flags: ~76
For each, convert from:
--backup_storage_block_sizeto:
--backup-storage-block-sizeUse the helpers from go/vt/utils/flags.go (already available):
SetFlagStringVar,SetFlagBoolVar, etc.- These helpers already register both dashed and underscored variants:
- Marks the
_form as deprecated - Hides the
_form from help output
- Marks the
Use these helpers instead of direct pflag calls.
2. Codebase-wide Usage
Replace all underscored versions (--flag_name) with dashed versions (--flag-name) wherever they are used.
Do NOT Modify
.difffiles- changelogs
Note: Upgrade/downgrade tests should continue using flags with underscores (--some_flag_example) to ensure backward compatibility. Add a comment in these places (if not already present) indicating that these should be replaced with dashed notation in v25.
3. Test File Handling
If any test files set these flags programmatically, replace code like:
flags["--backup_storage_block_size"] = "4096"with:
SetFlagVariantsForTests(flags, "--backup_storage_block_size", "4096")Or if accessing:
GetFlagVariantForTests("--backup_storage_block_size")This ensures both variants are tested.
If needed, create more helper functions accordingly.
Flag Source Reference
The full list of current flags in vtctld is found here:
go/flags/endtoend/vtctld.txt
Use this to locate the exact flags that need renaming. All flags following the underscore (_) naming convention in this file should be refactored.
Testing
Ensure tests pass in both forms by:
- Running unit and integration tests
- Verifying that test code uses
SetFlagVariantsForTestsorGetFlagVariantForTestsor other helper functions where applicable
📎 Related References
- Parent Issue: #17880
- Related PRs:
- Refactor Helpers:
[go/vt/utils/flags.go](https://github.com/vitessio/vitess/blob/main/go/vt/utils/flags.go)