Skip to content

Commit 641912b

Browse files
committed
Fix oversight in my patch of yesterday: forgot to ensure that stats would
still be forced out at backend exit.
1 parent 957d08c commit 641912b

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

src/backend/postmaster/pgstat.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
* Copyright (c) 2001-2007, PostgreSQL Global Development Group
1515
*
16-
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.154 2007/04/30 03:23:49 tgl Exp $
16+
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.155 2007/04/30 16:37:08 tgl Exp $
1717
* ----------
1818
*/
1919
#include "postgres.h"
@@ -615,7 +615,7 @@ void allow_immediate_pgstat_restart(void)
615615
* ----------
616616
*/
617617
void
618-
pgstat_report_tabstat(void)
618+
pgstat_report_tabstat(bool force)
619619
{
620620
static TimestampTz last_report = 0;
621621
TimestampTz now;
@@ -627,10 +627,11 @@ pgstat_report_tabstat(void)
627627

628628
/*
629629
* Don't send a message unless it's been at least PGSTAT_STAT_INTERVAL
630-
* msec since we last sent one.
630+
* msec since we last sent one, or the caller wants to force stats out.
631631
*/
632632
now = GetCurrentTransactionStopTimestamp();
633-
if (!TimestampDifferenceExceeds(last_report, now, PGSTAT_STAT_INTERVAL))
633+
if (!force &&
634+
!TimestampDifferenceExceeds(last_report, now, PGSTAT_STAT_INTERVAL))
634635
return;
635636
last_report = now;
636637

@@ -1491,7 +1492,7 @@ pgstat_beshutdown_hook(int code, Datum arg)
14911492
{
14921493
volatile PgBackendStatus *beentry = MyBEEntry;
14931494

1494-
pgstat_report_tabstat();
1495+
pgstat_report_tabstat(true);
14951496

14961497
/*
14971498
* Clear my status entry, following the protocol of bumping st_changecount

src/backend/tcop/postgres.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.532 2007/04/16 18:21:07 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.533 2007/04/30 16:37:08 tgl Exp $
1212
*
1313
* NOTES
1414
* this is the "main" module of the postgres backend and
@@ -3444,7 +3444,7 @@ PostgresMain(int argc, char *argv[], const char *username)
34443444
}
34453445
else
34463446
{
3447-
pgstat_report_tabstat();
3447+
pgstat_report_tabstat(false);
34483448

34493449
set_ps_display("idle", false);
34503450
pgstat_report_activity("<IDLE>");

src/include/pgstat.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Copyright (c) 2001-2007, PostgreSQL Global Development Group
77
*
8-
* $PostgreSQL: pgsql/src/include/pgstat.h,v 1.57 2007/03/30 18:34:55 mha Exp $
8+
* $PostgreSQL: pgsql/src/include/pgstat.h,v 1.58 2007/04/30 16:37:08 tgl Exp $
99
* ----------
1010
*/
1111
#ifndef PGSTAT_H
@@ -416,7 +416,7 @@ extern void PgstatCollectorMain(int argc, char *argv[]);
416416
*/
417417
extern void pgstat_ping(void);
418418

419-
extern void pgstat_report_tabstat(void);
419+
extern void pgstat_report_tabstat(bool force);
420420
extern void pgstat_vacuum_tabstat(void);
421421
extern void pgstat_drop_database(Oid databaseid);
422422
extern void pgstat_drop_relation(Oid relid);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy