Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf442711

Browse files
committed
Call pgstat_drop_database during DROP DATABASE, so that any stats file
entries for the victim database go away sooner rather than later. We alreadydid the equivalent thing at the per-relation level, not sure why it's notbeen done for whole databases. With this change, pgstat_vacuum_tabstatshould usually not find anything to do; though we still need it as a backstopin case DROPDB or TABPURGE messages get lost under load.
1 parentc138b96 commitf442711

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

‎src/backend/commands/dbcommands.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
*
1515
* IDENTIFICATION
16-
* $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.191 2007/02/01 19:10:26 momjian Exp $
16+
* $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.192 2007/02/09 16:12:18 tgl Exp $
1717
*
1818
*-------------------------------------------------------------------------
1919
*/
@@ -37,6 +37,7 @@
3737
#include"commands/tablespace.h"
3838
#include"mb/pg_wchar.h"
3939
#include"miscadmin.h"
40+
#include"pgstat.h"
4041
#include"postmaster/bgwriter.h"
4142
#include"storage/freespace.h"
4243
#include"storage/procarray.h"
@@ -644,6 +645,11 @@ dropdb(const char *dbname, bool missing_ok)
644645
*/
645646
FreeSpaceMapForgetDatabase(db_id);
646647

648+
/*
649+
* Tell the stats collector to forget it immediately, too.
650+
*/
651+
pgstat_drop_database(db_id);
652+
647653
/*
648654
* Tell bgwriter to forget any pending fsync requests for files in the
649655
* database; else it'll fail at next checkpoint.

‎src/backend/postmaster/pgstat.c

Lines changed: 2 additions & 3 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.145 2007/02/07 23:11:29 tgl Exp $
16+
*$PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.146 2007/02/09 16:12:18 tgl Exp $
1717
* ----------
1818
*/
1919
#include"postgres.h"
@@ -153,7 +153,6 @@ static void force_statwrite(SIGNAL_ARGS);
153153
staticvoidpgstat_beshutdown_hook(intcode,Datumarg);
154154

155155
staticPgStat_StatDBEntry*pgstat_get_db_entry(Oiddatabaseid,boolcreate);
156-
staticvoidpgstat_drop_database(Oiddatabaseid);
157156
staticvoidpgstat_write_statsfile(void);
158157
staticHTAB*pgstat_read_statsfile(Oidonlydb);
159158
staticvoidbackend_read_statsfile(void);
@@ -820,7 +819,7 @@ pgstat_collect_oids(Oid catalogid)
820819
*via future invocations of pgstat_vacuum_tabstat().)
821820
* ----------
822821
*/
823-
staticvoid
822+
void
824823
pgstat_drop_database(Oiddatabaseid)
825824
{
826825
PgStat_MsgDropdbmsg;

‎src/include/pgstat.h

Lines changed: 2 additions & 1 deletion
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.53 2007/02/07 23:11:30 tgl Exp $
8+
*$PostgreSQL: pgsql/src/include/pgstat.h,v 1.54 2007/02/09 16:12:19 tgl Exp $
99
* ----------
1010
*/
1111
#ifndefPGSTAT_H
@@ -378,6 +378,7 @@ extern void pgstat_ping(void);
378378

379379
externvoidpgstat_report_tabstat(void);
380380
externvoidpgstat_vacuum_tabstat(void);
381+
externvoidpgstat_drop_database(Oiddatabaseid);
381382
externvoidpgstat_drop_relation(Oidrelid);
382383

383384
externvoidpgstat_clear_snapshot(void);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp