Re: BUG #16739: Temporary files not deleting from data folder on disk
Adrien Nayrat <adrien.nayrat@anayrat.info>
From: Adrien Nayrat <adrien.nayrat@anayrat.info>
To: Dilip Kumar <dilipbalaut@gmail.com>
Cc: manojkumar@ameyo.com, pgsql-bugs@lists.postgresql.org
Date: 2023-06-05T10:40:14Z
Lists: pgsql-bugs
On 6/5/23 12:14, Dilip Kumar wrote: > IIUC, this flag is for the temp files created for query level > operation so this will clean up the files like "pgsql_tmp" but in > this thread, we are talking about the files related to temp tables > starting with "t_" I am not sure per comment and code in fd.c : /* * Remove temporary and temporary relation files left over from a prior * postmaster session * * This should be called during postmaster startup. It will forcibly * remove any leftover files created by OpenTemporaryFile and any leftover * temporary relation files created by mdcreate. * * During post-backend-crash restart cycle, this routine is called when * remove_temp_files_after_crash GUC is enabled. Multiple crashes while * queries are using temp files could result in useless storage usage that can * only be reclaimed by a service restart. The argument against enabling it is * that someone might want to examine the temporary files for debugging * purposes. This does however mean that OpenTemporaryFile had better allow for * collision with an existing temp file name. The function RemovePgTempFiles is called, which call RemovePgTempRelationFiles, then RemovePgTempRelationFilesInDbspace and looks_like_temp_rel_name which check: /* t<digits>_<digits>, or t<digits>_<digits>_<forkname> */ -- Adrien NAYRAT