Re: BUG #16739: Temporary files not deleting from data folder on disk

From: Adrien Nayrat <adrien(dot)nayrat(at)anayrat(dot)info>
To: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
Cc: manojkumar(at)ameyo(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16739: Temporary files not deleting from data folder on disk
Date: 2023-06-05 10:40:14
Message-ID: dc3b7ef9-2867-734b-0804-5bb4c9cef063@anayrat.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Dilip Kumar 2023-06-05 10:48:39 Re: BUG #16739: Temporary files not deleting from data folder on disk
Previous Message Dilip Kumar 2023-06-05 10:14:14 Re: BUG #16739: Temporary files not deleting from data folder on disk