pgbench_scale.patch
application/octet-stream
Filename: pgbench_scale.patch
Type: application/octet-stream
Part: 0
Message:
Re: Simulating Clog Contention
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
| File | + | − |
|---|---|---|
| contrib/pgbench/pgbench.c | 8 | 5 |
diff --git a/contrib/pgbench/pgbench.c b/contrib/pgbench/pgbench.c
index 9081f09..4e8f1c5 100644
--- a/contrib/pgbench/pgbench.c
+++ b/contrib/pgbench/pgbench.c
@@ -2175,25 +2175,28 @@ main(int argc, char **argv)
* get the scaling factor that should be same as count(*) from
* pgbench_branches if this is not a custom query
*/
+ int newscale;
res = PQexec(con, "select count(*) from pgbench_branches");
if (PQresultStatus(res) != PGRES_TUPLES_OK)
{
fprintf(stderr, "%s", PQerrorMessage(con));
exit(1);
}
- scale = atoi(PQgetvalue(res, 0, 0));
- if (scale < 0)
+ newscale = atoi(PQgetvalue(res, 0, 0));
+ if (newscale < 0)
{
- fprintf(stderr, "count(*) from pgbench_branches invalid (%d)\n", scale);
+ fprintf(stderr, "count(*) from pgbench_branches invalid (%d)\n", newscale);
exit(1);
}
PQclear(res);
/* warn if we override user-given -s switch */
- if (scale_given)
+ if (scale_given && newscale!=scale) {
fprintf(stderr,
"Scale option ignored, using pgbench_branches table count = %d\n",
- scale);
+ newscale);
+ };
+ scale=newscale;
}
/*