Commit 2b4f2ab3 authored by Alvaro Herrera's avatar Alvaro Herrera

Remove the correct pgstat file on DROP DATABASE

We were unlinking the permanent file, not the non-permanent one.  But
since the stat collector already unlinks all permanent files on startup,
there was nothing for it to unlink.  The non-permanent file remained in
place, and was copied to the permanent directory on shutdown, so in
effect no file was ever dropped.

Backpatch to 9.3, where the issue was introduced by commit 187492b6.
Before that, there were no per-database files and thus no file to drop
on DROP DATABASE.

Per report from Thom Brown.

Author: Tomáš Vondra
parent 65b96714
...@@ -4772,7 +4772,7 @@ pgstat_recv_dropdb(PgStat_MsgDropdb *msg, int len) ...@@ -4772,7 +4772,7 @@ pgstat_recv_dropdb(PgStat_MsgDropdb *msg, int len)
{ {
char statfile[MAXPGPATH]; char statfile[MAXPGPATH];
get_dbstat_filename(true, false, dbid, statfile, MAXPGPATH); get_dbstat_filename(false, false, dbid, statfile, MAXPGPATH);
elog(DEBUG2, "removing %s", statfile); elog(DEBUG2, "removing %s", statfile);
unlink(statfile); unlink(statfile);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment