Tweak logic for when to display:
"Waiting for %d transactions to finish. First PID: %s" message. Display it on every loop through the SQL_XID_ALIVE check (i.e. every second), instead of only when the number of transactions we're waiting on changes -- previously, it was too easy for that important message to get lost in other messages. And don't display the message at all when running under pg_regress, i.e. as part of `make installcheck`. We had been getting occasional errors from pg_regress when autovacuum was running and that message got logged.
This commit is contained in:
parent
0cb40b6204
commit
8f61e44efd
@ -987,7 +987,6 @@ repack_one_table(repack_table *table, const char *orderby)
|
|||||||
PGresult *res = NULL;
|
PGresult *res = NULL;
|
||||||
const char *params[2];
|
const char *params[2];
|
||||||
int num;
|
int num;
|
||||||
int num_waiting = 0;
|
|
||||||
char *vxid = NULL;
|
char *vxid = NULL;
|
||||||
char buffer[12];
|
char buffer[12];
|
||||||
StringInfoData sql;
|
StringInfoData sql;
|
||||||
@ -997,6 +996,11 @@ repack_one_table(repack_table *table, const char *orderby)
|
|||||||
char indexbuffer[12];
|
char indexbuffer[12];
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
|
/* appname will be "pg_repack" in normal use on 9.0+, or
|
||||||
|
* "pg_regress" when run under `make installcheck`
|
||||||
|
*/
|
||||||
|
const char *appname = getenv("PGAPPNAME");
|
||||||
|
|
||||||
/* Keep track of whether we have gotten through setup to install
|
/* Keep track of whether we have gotten through setup to install
|
||||||
* the z_repack_trigger, log table, etc. ourselves. We don't want to
|
* the z_repack_trigger, log table, etc. ourselves. We don't want to
|
||||||
* go through repack_cleanup() if we didn't actually set up the
|
* go through repack_cleanup() if we didn't actually set up the
|
||||||
@ -1312,15 +1316,14 @@ repack_one_table(repack_table *table, const char *orderby)
|
|||||||
if (num > 0)
|
if (num > 0)
|
||||||
{
|
{
|
||||||
/* Wait for old transactions.
|
/* Wait for old transactions.
|
||||||
* Only display the message below when the number of
|
* Only display this message if we are NOT
|
||||||
* transactions we are waiting on changes (presumably,
|
* running under pg_regress, so as not to cause
|
||||||
* num_waiting should only go down), so as not to
|
* noise which would trip up pg_regress.
|
||||||
* be too noisy.
|
|
||||||
*/
|
*/
|
||||||
if (num != num_waiting)
|
|
||||||
|
if (!appname || strcmp(appname, "pg_regress") != 0)
|
||||||
{
|
{
|
||||||
elog(NOTICE, "Waiting for %d transactions to finish. First PID: %s", num, PQgetvalue(res, 0, 0));
|
elog(NOTICE, "Waiting for %d transactions to finish. First PID: %s", num, PQgetvalue(res, 0, 0));
|
||||||
num_waiting = num;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CLEARPGRES(res);
|
CLEARPGRES(res);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user