1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

pgbench: More fix with handling default scaling factor in the default

scenarios. With multiple clinets, only the first client got the right
scaling factor and this gave a illusion of better performance in case
of the scaling factor greater than 1.
This commit is contained in:
Tatsuo Ishii
2006-10-21 06:31:28 +00:00
parent 554032b3e4
commit a5007d671a
3 changed files with 31 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/*
* $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.57 2006/10/07 19:25:28 tgl Exp $
* $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.58 2006/10/21 06:31:28 ishii Exp $
*
* pgbench: a simple benchmark program for PostgreSQL
* written by Tatsuo Ishii
@ -1352,6 +1352,8 @@ main(int argc, char **argv)
memset(state + 1, 0, sizeof(*state) * (nclients - 1));
snprintf(val, sizeof(val), "%d", scale);
for (i = 1; i < nclients; i++)
{
int j;
@ -1364,6 +1366,12 @@ main(int argc, char **argv)
exit(1);
}
}
if (putVariable(&state[i], "scale", val) == false)
{
fprintf(stderr, "Couldn't allocate memory for variable\n");
exit(1);
}
}
}
@ -1425,6 +1433,18 @@ main(int argc, char **argv)
fprintf(stderr, "Couldn't allocate memory for variable\n");
exit(1);
}
if (nclients > 1)
{
for (i = 1; i < nclients; i++)
{
if (putVariable(&state[i], "scale", val) == false)
{
fprintf(stderr, "Couldn't allocate memory for variable\n");
exit(1);
}
}
}
}
if (!is_no_vacuum)