pgstat_reset_remove_files ignores its argument

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: pgstat_reset_remove_files ignores its argument
Date: 2013-08-14 04:13:11
Message-ID: CAMkU=1wbk947=-pAosDMX5VC+sQw9W4ttq6RM9rXu=MjNeEQKA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

in 9.3 and 9.4, pgstat_reset_remove_files uses the global variable
pgstat_stat_directory rather than the argument it is passed, "directory".
On crash recovery, this means the tmp directory gets cleared twice and the
permanent pg_stat doesn't get cleared at all.

It seems like the obvious one line change would fix it, but I haven't
tested it because I don't know how to cause a crash without pg_stat already
being empty.

pgstat_reset_remove_files(const char *directory)
{
DIR *dir;
struct dirent *entry;
char fname[MAXPGPATH];

dir = AllocateDir(pgstat_stat_directory);

Cheers,

Jeff

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vlad Arkhipov 2013-08-14 05:31:31 Re: System catalog vacuum issues
Previous Message Amit Kapila 2013-08-14 04:06:17 Re: Foreground vacuum and buffer access strategy