On Fri, Dec 8, 2017 at 12:07 PM, Thomas Munro <thomas.mu...@enterprisedb.com> wrote: > I suppose if we wanted to make this type of problem go away, but still > keep files for forensic purposes, we could introduce a "restart > number", and stick it into the top level temporary directory's name. > That way you'd never be able to collide with files created before a > crash-restart, and we could add O_EXCL so it'd become an error to try > to create the same filename again.
Or we could teach crash-restart to move the top level directory (in each tablespace) to pgsql_tmp.old, so we'd keep the temporary files from one previous lifetime only. That'd prevent unlimited space eating in multiple crash scenarios, and we could more comfortably say that it's entirely safe to delete that directory manually in cases like this: https://www.postgresql.org/message-id/flat/4f3c89a224ff4660baa62a2b79fb0f1d%40ITUPW-EXMBOX3B.UniNet.unisa.edu.au -- Thomas Munro http://www.enterprisedb.com