Skip to content

Conversation

@mounicasruthi
Copy link
Collaborator

@mounicasruthi mounicasruthi commented May 20, 2025

Description

This PR merges the changes from previous flag refactor PRs as part of the ongoing effort to standardize CLI flag naming conventions across Vitess by replacing underscores (_) with dashes (-).

The motivation for this change is tracked in #17880, and the standardization helps improve consistency and align with the best practices.

This merge includes the following completed PRs:

#17964Refactor vstream_dynamic_packet_size and vstream_packet_size flags to use dashes

  • Migrated 4 flags from _ to -
  • Count before: 1488 (_) / 572 (-) → after: 1484 (_) / 576 (-)

#17975Standardize topo flags to use hyphen-based naming

  • Migrated all topology-related flags (e.g., --topo-global-server-address, --topo-zk-tls-key, etc.).
  • Count before: 1484 (_) / 576 (-) → after: 1366 (_) / 694 (-)
  • 118 flags migrated.

#18009Refactor grpc flags for standardized naming

  • Migrated all GRPC-related flags to the dashed format.
  • Count before: 1366 (_) / 694 (-) → after: 1132 (_) / 948 (-)
  • 234 flags migrated

#18064Refactor flags - Part 3

  • Migrated a set of commonly reused flags across multiple components (appearing in ≥3 binaries).
  • Count before: 1132 (_) / 948 (-) → after: 738 (_) / 1342 (-)
  • 394 flags migrated

#18095Refactor flags - Part 4

  • Migrated another set of commonly reused flags across multiple components (appearing in ≥3 binaries).
  • Count before: 738 (_) / 1342 (-) → after: 465 (_) / 1615 (-)
  • 273 flags migrated

Helper File

To support this migration, a new utility file go/vt/utils/flags.go was created.

  • Wraps flag registration (SetFlagIntVar, SetFlagBoolVar, etc.)
  • Automatically registers both dashed and underscored versions.
  • Marks the underscored version as deprecated and hidden, while encouraging the dashed variant.
  • Includes testing utilities to validate that both forms are handled correctly in tests.

Future Plan

As mentioned in the original proposal:

  • v23 and v24 will support both _ and - variants of flags to give users time to adapt.
  • v25 will remove support for underscores in flag names entirely.
  • This phased approach ensures backward compatibility while allowing Vitess to make its flag usage consistent.

Related Issue(s)

#17880

Checklist

  • "Backport to:" labels have been added if this change should be back-ported to release branches
  • If this change is to be back-ported to previous releases, a justification is included in the PR description
  • Tests were added or are not required
  • Did the new or modified tests pass consistently locally and on CI?
  • Documentation was added or is not required

Deployment Notes

mounicasruthi and others added 5 commits May 20, 2025 23:49
… use dashes (vitessio#17964)

Signed-off-by: mounicasruthi <[email protected]>
Signed-off-by: Mounica Sruthi <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
Co-authored-by: Deepthi Sigireddi <[email protected]>
Co-authored-by: Rohit Nayak <[email protected]>
Signed-off-by: mounicasruthi <[email protected]>
Signed-off-by: Mounica Sruthi <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
Co-authored-by: Deepthi Sigireddi <[email protected]>
Co-authored-by: Rohit Nayak <[email protected]>
@vitess-bot
Copy link
Contributor

vitess-bot bot commented May 20, 2025

Review Checklist

Hello reviewers! 👋 Please follow this checklist when reviewing this Pull Request.

General

  • Ensure that the Pull Request has a descriptive title.
  • Ensure there is a link to an issue (except for internal cleanup and flaky test fixes), new features should have an RFC that documents use cases and test cases.

Tests

  • Bug fixes should have at least one unit or end-to-end test, enhancement and new features should have a sufficient number of tests.

Documentation

  • Apply the release notes (needs details) label if users need to know about this change.
  • New features should be documented.
  • There should be some code comments as to why things are implemented the way they are.
  • There should be a comment at the top of each new or modified test to explain what the test does.

New flags

  • Is this flag really necessary?
  • Flag names must be clear and intuitive, use dashes (-), and have a clear help text.

If a workflow is added or modified:

  • Each item in Jobs should be named in order to mark it as required.
  • If the workflow needs to be marked as required, the maintainer team must be notified.

Backward compatibility

  • Protobuf changes should be wire-compatible.
  • Changes to _vt tables and RPCs need to be backward compatible.
  • RPC changes should be compatible with vitess-operator
  • If a flag is removed, then it should also be removed from vitess-operator and arewefastyet, if used there.
  • vtctl command output order should be stable and awk-able.

@vitess-bot vitess-bot bot added NeedsBackportReason If backport labels have been applied to a PR, a justification is required NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsIssue A linked issue is missing for this Pull Request NeedsWebsiteDocsUpdate What it says labels May 20, 2025
@github-actions github-actions bot added this to the v23.0.0 milestone May 20, 2025
@mounicasruthi mounicasruthi added Type: Enhancement Logical improvement (somewhere between a bug and feature) Component: General Changes throughout the code base and removed NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsWebsiteDocsUpdate What it says NeedsIssue A linked issue is missing for this Pull Request NeedsBackportReason If backport labels have been applied to a PR, a justification is required labels May 20, 2025
@codecov
Copy link

codecov bot commented May 20, 2025

Codecov Report

Attention: Patch coverage is 78.44828% with 75 lines in your changes missing coverage. Please review.

Project coverage is 67.47%. Comparing base (c3daef3) to head (49333a0).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
go/vt/vttest/vtprocess.go 50.00% 9 Missing ⚠️
go/cmd/vtcombo/cli/main.go 0.00% 6 Missing ⚠️
go/cmd/vtgate/cli/cli.go 0.00% 6 Missing ⚠️
go/cmd/vtbackup/cli/vtbackup.go 0.00% 5 Missing ⚠️
go/vt/discovery/healthcheck.go 0.00% 4 Missing ⚠️
go/vt/utils/flags.go 93.54% 4 Missing ⚠️
go/vt/vtgate/grpcvtgateservice/server.go 20.00% 4 Missing ⚠️
go/cmd/mysqlctl/command/root.go 0.00% 3 Missing ⚠️
go/cmd/mysqlctld/cli/mysqlctld.go 0.00% 3 Missing ⚠️
go/vt/mysqlctl/mycnf_flag.go 85.00% 3 Missing ⚠️
... and 15 more
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #18280   +/-   ##
=======================================
  Coverage   67.46%   67.47%           
=======================================
  Files        1602     1603    +1     
  Lines      262245   262329   +84     
=======================================
+ Hits       176930   177010   +80     
- Misses      85315    85319    +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@deepthi deepthi added the release notes (needs details) This PR needs to be listed in the release notes in a dedicated section (deprecation notice, etc...) label May 21, 2025
Copy link
Collaborator

@deepthi deepthi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! LGTM.
The only thing we are missing right now is an announcement in the release notes. That should go into https://github.com/vitessio/vitess/blob/main/changelog/23.0/23.0.0/summary.md
Technically we don't have to block this PR merge on that though. It can be done in the follow up PRs that are already queued up.

@deepthi deepthi removed the release notes (needs details) This PR needs to be listed in the release notes in a dedicated section (deprecation notice, etc...) label May 21, 2025
@deepthi
Copy link
Collaborator

deepthi commented May 21, 2025

@rohit-nayak-ps we need to regenerate the website docs. Should we defer that until the remaining work is complete?

@rohit-nayak-ps
Copy link
Member

@rohit-nayak-ps we need to regenerate the website docs. Should we defer that until the remaining work is complete?

Let's defer till we have merged everything.

@deepthi deepthi added the NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work label May 21, 2025
@rohit-nayak-ps rohit-nayak-ps removed the NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work label May 22, 2025
@rohit-nayak-ps rohit-nayak-ps merged commit 8665230 into vitessio:main May 22, 2025
112 of 124 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: General Changes throughout the code base Type: Enhancement Logical improvement (somewhere between a bug and feature)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants