@@ -294,6 +294,20 @@ static bool verify_arbitrary_command_option(struct benchmark_config *cfg) {
294294 return false ;
295295 }
296296
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+
297311 return true ;
298312}
299313
@@ -624,8 +638,17 @@ static int config_parse_args(int argc, char *argv[], struct benchmark_config *cf
624638 cfg->key_pattern [key_pattern_set] != ' P' ) ||
625639 (cfg->key_pattern [key_pattern_get] != ' R' &&
626640 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 " );
629652 return -1 ;
630653 }
631654 break ;
0 commit comments