@@ -398,35 +398,54 @@ void TLogWorkloadParams::ConfigureOptsFillData(NLastGetopt::TOpts& opts) {
398398 .DefaultValue (NullPercent).StoreResult (&NullPercent);
399399}
400400
401- void TLogWorkloadParams::Validate (int workloadType) const {
402- if (static_cast <TLogGenerator::EType>(workloadType) == TLogGenerator::EType::Select) {
403- return ;
404- }
405-
401+ void TLogWorkloadParams::Validate (const ECommandType commandType, int workloadType) const {
406402 const bool timestampDevPassed = TimestampStandardDeviationMinutes;
407403 const bool dateFromPassed = !!TimestampDateFrom;
408404 const bool dateToPassed = !!TimestampDateTo;
409405
410- Cerr << " TimestampDevPassed: " << timestampDevPassed << " \n " ;
411- Cerr << " DateFromPassed: " << dateFromPassed << " \n " ;
412- Cerr << " DateToPassed: " << dateToPassed << " \n " ;
413-
414- if (!timestampDevPassed && (!dateFromPassed || !dateToPassed)) {
415- throw yexception () << " One of parameter should be provided - timestamp_deviation or date-from and date-to" ;
416- }
406+ switch (commandType) {
407+ case TWorkloadParams::ECommandType::Init:
408+ break ;
409+ case TWorkloadParams::ECommandType::Run:
410+ switch (static_cast <TLogGenerator::EType>(workloadType)) {
411+ case TLogGenerator::EType::Insert:
412+ case TLogGenerator::EType::Upsert:
413+ case TLogGenerator::EType::BulkUpsert:
414+
415+
416+ Cerr << " TimestampDevPassed: " << timestampDevPassed << " \n " ;
417+ Cerr << " DateFromPassed: " << dateFromPassed << " \n " ;
418+ Cerr << " DateToPassed: " << dateToPassed << " \n " ;
419+
420+ if (!timestampDevPassed && (!dateFromPassed || !dateToPassed)) {
421+ throw yexception () << " One of parameter should be provided - timestamp_deviation or date-from and date-to" ;
422+ }
417423
418- if (timestampDevPassed && (dateFromPassed || dateToPassed)) {
419- throw yexception () << " The `timestamp_deviation` and `date-from`, `date-to` are mutually exclusive and shouldn't be provided at once" ;
420- }
424+ if (timestampDevPassed && (dateFromPassed || dateToPassed)) {
425+ throw yexception () << " The `timestamp_deviation` and `date-from`, `date-to` are mutually exclusive and shouldn't be provided at once" ;
426+ }
421427
422- if ((dateFromPassed && !dateToPassed) || (!dateFromPassed && dateToPassed)) {
423- throw yexception () << " The `date-from` and `date-to` parameters must be provided together to specify the interval for uniform PK generation" ;
424- }
428+ if ((dateFromPassed && !dateToPassed) || (!dateFromPassed && dateToPassed)) {
429+ throw yexception () << " The `date-from` and `date-to` parameters must be provided together to specify the interval for uniform PK generation" ;
430+ }
425431
426- if (dateFromPassed && dateToPassed && *TimestampDateFrom >= *TimestampDateTo) {
427- throw yexception () << " Invalid interval [`date-from`, `date-to`)" ;
432+ if (dateFromPassed && dateToPassed && *TimestampDateFrom >= *TimestampDateTo) {
433+ throw yexception () << " Invalid interval [`date-from`, `date-to`)" ;
434+ }
435+
436+ break ;
437+ case TLogGenerator::EType::Select:
438+
439+ break ;
440+ }
441+ break ;
442+ case TWorkloadParams::ECommandType::Clean:
443+ break ;
444+ case TWorkloadParams::ECommandType::Root:
445+ break ;
446+ case TWorkloadParams::ECommandType::Import:
447+ break ;
428448 }
429-
430449 return ;
431450}
432451
0 commit comments