mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Add :client_id automatic variable for custom pgbench scripts.
This makes it easier to write custom scripts that have different logic for each client. Gurjeet Singh, with some changes by me.
This commit is contained in:
@ -2544,6 +2544,20 @@ main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Define a :client_id variable that is unique per connection. But don't
|
||||
* override an explicit -D switch.
|
||||
*/
|
||||
if (getVariable(&state[0], "client_id") == NULL)
|
||||
{
|
||||
for (i = 0; i < nclients; i++)
|
||||
{
|
||||
snprintf(val, sizeof(val), "%d", i);
|
||||
if (!putVariable(&state[i], "startup", "client_id", val))
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_no_vacuum)
|
||||
{
|
||||
fprintf(stderr, "starting vacuum...");
|
||||
|
Reference in New Issue
Block a user