@@ -294,6 +294,20 @@ static bool verify_arbitrary_command_option(struct benchmark_config *cfg) {
294
294
return false ;
295
295
}
296
296
297
+ // verify that when using Parallel key pattern, it's configured to all commands
298
+ size_t parallel_count = 0 ;
299
+ for (size_t i = 0 ; i<cfg->arbitrary_commands ->size (); i++) {
300
+ arbitrary_command& cmd = cfg->arbitrary_commands ->at (i);
301
+ if (cmd.key_pattern == ' P' ) {
302
+ parallel_count++;
303
+ }
304
+ }
305
+
306
+ if (parallel_count > 0 && parallel_count != cfg->arbitrary_commands ->size ()) {
307
+ fprintf (stderr, " error: parallel key-pattern must be configured to all commands.\n " );
308
+ return false ;
309
+ }
310
+
297
311
return true ;
298
312
}
299
313
@@ -624,8 +638,17 @@ static int config_parse_args(int argc, char *argv[], struct benchmark_config *cf
624
638
cfg->key_pattern [key_pattern_set] != ' P' ) ||
625
639
(cfg->key_pattern [key_pattern_get] != ' R' &&
626
640
cfg->key_pattern [key_pattern_get] != ' S' &&
627
- cfg->key_pattern [key_pattern_get] != ' G' )) {
628
- fprintf (stderr, " error: key-pattern must be in the format of [S/R/G/P]:[S/R/G].\n " );
641
+ cfg->key_pattern [key_pattern_get] != ' G' &&
642
+ cfg->key_pattern [key_pattern_get] != ' P' )) {
643
+ fprintf (stderr, " error: key-pattern must be in the format of [S/R/G/P]:[S/R/G/P].\n " );
644
+ return -1 ;
645
+ }
646
+
647
+ if ((cfg->key_pattern [key_pattern_set] == ' P' ||
648
+ cfg->key_pattern [key_pattern_get] == ' P' ) &&
649
+ (cfg->key_pattern [key_pattern_set] != cfg->key_pattern [key_pattern_get])) {
650
+
651
+ fprintf (stderr, " error: parallel key-pattern must be configured for both SET and GET commands.\n " );
629
652
return -1 ;
630
653
}
631
654
break ;
0 commit comments