Fix removal of files in pgstats directories
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Mon, 19 Aug 2013 21:48:17 +0000 (17:48 -0400)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Mon, 19 Aug 2013 21:48:17 +0000 (17:48 -0400)
commitf9b50b7c18c8ce7de1fee59409fe23c58d438190
tree73fc5582edf2c138c5cd2e3e350d70320205f7d3
parent3619a20d33517399d4e234a78e6078c601ffba01
Fix removal of files in pgstats directories

Instead of deleting all files in stats_temp_directory and the permanent
directory on a crash, only remove those files that match the pattern of
files we actually write in them, to avoid possibly clobbering existing
unrelated contents of the temporary directory.  Per complaint from Jeff
Janes, and subsequent discussion, starting at message
CAMkU=1z9+7RsDODnT4=cDFBRBp8wYQbd_qsLcMtKEf-oFwuOdQ@mail.gmail.com

Also, fix a bug in the same routine to avoid removing files from the
permanent directory twice (instead of once from that directory and then
from the temporary directory), also per report from Jeff Janes, in
message
CAMkU=1wbk947=-pAosDMX5VC+sQw9W4ttq6RM9rXu=MjNeEQKA@mail.gmail.com
src/backend/postmaster/pgstat.c