-
Notifications
You must be signed in to change notification settings - Fork 715
feat(ctl): add required throttle type option for independent target/type control #24111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: kwannoel/refactor-rate-limit
Are you sure you want to change the base?
Conversation
Co-authored-by: kwannoel <[email protected]>
…tern matching Co-authored-by: kwannoel <[email protected]>
| // Infer throttle type from target for backward compatibility. | ||
| let throttle_type = match kind { | ||
| PbThrottleTarget::Source => PbThrottleType::Source, | ||
| PbThrottleTarget::Mv => PbThrottleType::Backfill, | ||
| PbThrottleTarget::Sink => PbThrottleType::Sink, | ||
| PbThrottleTarget::Table | PbThrottleTarget::Fragment | PbThrottleTarget::Unspecified => { | ||
| // Default to Backfill for unspecified/unsupported combinations; user should use SQL for table throttling | ||
| PbThrottleType::Backfill | ||
|
|
||
| // Use provided throttle type if specified, otherwise infer from target for backward compatibility | ||
| let throttle_type = if let Some(type_str) = ¶ms.throttle_type { | ||
| parse_throttle_type(type_str)? | ||
| } else { | ||
| // Infer throttle type from target for backward compatibility | ||
| match kind { | ||
| PbThrottleTarget::Source => PbThrottleType::Source, | ||
| PbThrottleTarget::Mv => PbThrottleType::Backfill, | ||
| PbThrottleTarget::Sink => PbThrottleType::Sink, | ||
| PbThrottleTarget::Table | ||
| | PbThrottleTarget::Fragment | ||
| | PbThrottleTarget::Unspecified => { | ||
| // Default to Backfill for unspecified/unsupported combinations; user should use SQL for table throttling | ||
| PbThrottleType::Backfill | ||
| } | ||
| } | ||
| }; | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot no need to maintain backwards compatibliilty, pkease simplify.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplified the code in commit 14ee937. Made --throttle-type required and removed all backward compatibility logic.
The apply_throttle function is now just 3 lines, and users must always specify the throttle type explicitly:
risectl throttle sink <id> <rate> --throttle-type backfillCo-authored-by: kwannoel <[email protected]>
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
Addresses review feedback from #24075 to decouple throttle target and throttle type in the ctl interface.
Previously, the ctl interface inferred throttle type from throttle target (e.g.,
sinktarget →sinktype). This prevented scenarios like applying backfill throttling to sinks.Changes:
--throttle-typeoption acceptingdml,backfill,source,sink(case-insensitive)sinksubcommand to throttle commandsUsage:
This allows independent specification of throttle target and type, enabling scenarios like sink backfill rate limiting.
Checklist
Documentation
Release note
The
risectl throttlecommand now requires the--throttle-typeflag to explicitly specify throttle type independently of the target. This enables scenarios like applying backfill throttling to sinks.Breaking change: The
--throttle-typeoption is now required for all throttle commands.💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.