@@ -184,7 +184,7 @@ namespace {
184
184
return MeteringMode_;
185
185
}
186
186
187
- void TCommandWithAutoscaling::AddAutoscaling (TClientCommand::TConfig& config, bool withDefault ) {
187
+ void TCommandWithAutoscaling::AddAutoscaling (TClientCommand::TConfig& config, bool isAlter ) {
188
188
TStringStream description;
189
189
description << " A strategy to automatically change the number of partitions depending on the load. Available strategies: " ;
190
190
NColorizer::TColors colors = NColorizer::AutoColors (Cout);
@@ -194,29 +194,38 @@ namespace {
194
194
" Couldn't find description for %s autoscale strategy" , (TStringBuilder () << strategy.second ).c_str ());
195
195
description << " \n " << colors.BoldColor () << strategy.first << colors.OldColor ()
196
196
<< " \n " << findResult->second ;
197
- if (strategy.second == NTopic::EAutoscalingStrategy::Disabled) {
198
- description << colors.CyanColor () << " (default)" << colors.OldColor ();
199
- }
200
197
}
201
198
202
- auto straregy = config.Opts ->AddLongOption (" autoscale-strategy" , description.Str ())
203
- .Optional ()
204
- .StoreResult (&AutoscaleStrategy_);
205
- auto thresholdTime = config.Opts ->AddLongOption (" autoscale-threshold-time" , " Duration in seconds of high or low load before automatically scale the number of partitions" )
206
- .Optional ()
207
- .StoreResult (&ScaleThresholdTime_);
208
- auto upThresholdPercent = config.Opts ->AddLongOption (" autoscale-scale-up-threshold-percent" , " The load percentage at which the number of partitions will increase." )
209
- .Optional ()
210
- .StoreResult (&ScaleUpThresholdPercent_);
211
- auto downThresholdPercent = config.Opts ->AddLongOption (" autoscale-scale-down-threshold-percent" , " The load percentage at which the number of partitions will decrease." )
212
- .Optional ()
213
- .StoreResult (&ScaleDownThresholdPercent_);
214
-
215
- if (withDefault) {
216
- straregy.DefaultValue (" disabled" );
217
- thresholdTime.DefaultValue (300 );
218
- upThresholdPercent.DefaultValue (90 );
219
- downThresholdPercent.DefaultValue (30 );
199
+ if (isAlter) {
200
+ config.Opts ->AddLongOption (" autoscale-strategy" , description.Str ())
201
+ .Optional ()
202
+ .StoreResult (&AutoscaleStrategy_);
203
+ config.Opts ->AddLongOption (" autoscale-threshold-time" , " Duration in seconds of high or low load before automatically scale the number of partitions" )
204
+ .Optional ()
205
+ .StoreResult (&ScaleThresholdTime_);
206
+ config.Opts ->AddLongOption (" autoscale-scale-up-threshold-percent" , " The load percentage at which the number of partitions will increase" )
207
+ .Optional ()
208
+ .StoreResult (&ScaleUpThresholdPercent_);
209
+ config.Opts ->AddLongOption (" autoscale-scale-down-threshold-percent" , " The load percentage at which the number of partitions will decrease" )
210
+ .Optional ()
211
+ .StoreResult (&ScaleDownThresholdPercent_);
212
+ } else {
213
+ config.Opts ->AddLongOption (" autoscale-strategy" , description.Str ())
214
+ .Optional ()
215
+ .DefaultValue (" disabled" )
216
+ .StoreResult (&AutoscaleStrategy_);
217
+ config.Opts ->AddLongOption (" autoscale-threshold-time" , " Duration in seconds of high or low load before automatically scale the number of partitions" )
218
+ .Optional ()
219
+ .DefaultValue (300 )
220
+ .StoreResult (&ScaleThresholdTime_);
221
+ config.Opts ->AddLongOption (" autoscale-scale-up-threshold-percent" , " The load percentage at which the number of partitions will increase" )
222
+ .Optional ()
223
+ .DefaultValue (90 )
224
+ .StoreResult (&ScaleUpThresholdPercent_);
225
+ config.Opts ->AddLongOption (" autoscale-scale-down-threshold-percent" , " The load percentage at which the number of partitions will decrease" )
226
+ .Optional ()
227
+ .DefaultValue (30 )
228
+ .StoreResult (&ScaleDownThresholdPercent_);
220
229
}
221
230
}
222
231
@@ -289,7 +298,7 @@ namespace {
289
298
SetFreeArgTitle (0 , " <topic-path>" , " Topic path" );
290
299
AddAllowedCodecs (config, AllowedCodecs);
291
300
AddAllowedMeteringModes (config);
292
- AddAutoscaling (config, true );
301
+ AddAutoscaling (config, false );
293
302
}
294
303
295
304
void TCommandTopicCreate::Parse (TConfig& config) {
@@ -358,7 +367,7 @@ namespace {
358
367
SetFreeArgTitle (0 , " <topic-path>" , " Topic path" );
359
368
AddAllowedCodecs (config, AllowedCodecs);
360
369
AddAllowedMeteringModes (config);
361
- AddAutoscaling (config, false );
370
+ AddAutoscaling (config, true );
362
371
}
363
372
364
373
void TCommandTopicAlter::Parse (TConfig& config) {
0 commit comments