char *filename = NULL;
bool scale_given = false;
+ bool benchmarking_option_set = false;
+ bool initialization_option_set = false;
+
CState *state; /* status of clients */
TState *threads; /* array of thread */
break;
case 'S':
ttype = 1;
+ benchmarking_option_set = true;
break;
case 'N':
ttype = 2;
+ benchmarking_option_set = true;
break;
case 'c':
+ benchmarking_option_set = true;
nclients = atoi(optarg);
if (nclients <= 0 || nclients > MAXCLIENTS)
{
#endif /* HAVE_GETRLIMIT */
break;
case 'j': /* jobs */
+ benchmarking_option_set = true;
nthreads = atoi(optarg);
if (nthreads <= 0)
{
}
break;
case 'C':
+ benchmarking_option_set = true;
is_connect = true;
break;
case 'r':
+ benchmarking_option_set = true;
is_latencies = true;
break;
case 's':
}
break;
case 't':
+ benchmarking_option_set = true;
if (duration > 0)
{
fprintf(stderr, "specify either a number of transactions (-t) or a duration (-T), not both.\n");
}
break;
case 'T':
+ benchmarking_option_set = true;
if (nxacts > 0)
{
fprintf(stderr, "specify either a number of transactions (-t) or a duration (-T), not both.\n");
login = pg_strdup(optarg);
break;
case 'l':
+ benchmarking_option_set = true;
use_log = true;
break;
case 'q':
+ initialization_option_set = true;
use_quiet = true;
break;
case 'f':
+ benchmarking_option_set = true;
ttype = 3;
filename = pg_strdup(optarg);
if (process_file(filename) == false || *sql_files[num_files - 1] == NULL)
{
char *p;
+ benchmarking_option_set = true;
+
if ((p = strchr(optarg, '=')) == NULL || p == optarg || *(p + 1) == '\0')
{
fprintf(stderr, "invalid variable definition: %s\n", optarg);
}
break;
case 'F':
+ initialization_option_set = true;
fillfactor = atoi(optarg);
if ((fillfactor < 10) || (fillfactor > 100))
{
}
break;
case 'M':
+ benchmarking_option_set = true;
if (num_files > 0)
{
fprintf(stderr, "query mode (-M) should be specifiled before transaction scripts (-f)\n");
}
break;
case 'P':
+ benchmarking_option_set = true;
progress = atoi(optarg);
if (progress <= 0)
{
/* get a double from the beginning of option value */
double throttle_value = atof(optarg);
+ benchmarking_option_set = true;
+
if (throttle_value <= 0.0)
{
fprintf(stderr, "invalid rate limit: %s\n", optarg);
break;
case 0:
/* This covers long options which take no argument. */
+ if (foreign_keys || unlogged_tables)
+ initialization_option_set = true;
break;
case 2: /* tablespace */
+ initialization_option_set = true;
tablespace = pg_strdup(optarg);
break;
case 3: /* index-tablespace */
+ initialization_option_set = true;
index_tablespace = pg_strdup(optarg);
break;
case 4:
+ benchmarking_option_set = true;
sample_rate = atof(optarg);
if (sample_rate <= 0.0 || sample_rate > 1.0)
{
fprintf(stderr, "--aggregate-interval is not currently supported on Windows");
exit(1);
#else
+ benchmarking_option_set = true;
agg_interval = atoi(optarg);
if (agg_interval <= 0)
{
if (is_init_mode)
{
+ if (benchmarking_option_set)
+ {
+ fprintf(stderr, "some options cannot be used in initialization (-i) mode\n");
+ exit(1);
+ }
+
init(is_no_vacuum);
exit(0);
}
+ else
+ {
+ if (initialization_option_set)
+ {
+ fprintf(stderr, "some options cannot be used in benchmarking mode\n");
+ exit(1);
+ }
+ }
/* Use DEFAULT_NXACTS if neither nxacts nor duration is specified. */
if (nxacts <= 0 && duration <= 0)
exit(1);
}
- /* -q may be used only with -i */
- if (use_quiet && !is_init_mode)
- {
- fprintf(stderr, "quiet-logging is allowed only in initialization mode (-i)\n");
- exit(1);
- }
-
/* --sampling-rate may must not be used with --aggregate-interval */
if (sample_rate > 0.0 && agg_interval > 0)
{