On Mon, Oct 17, 2022 at 6:45 PM Robert Haas <robertmhaas@gmail.com> wrote:
>
> On Fri, Oct 14, 2022 at 4:45 AM Bharath Rupireddy
> <bharath.rupireddyforpostgres@gmail.com> wrote:
> > What happens to the left-over temp files after a server crash? Will
> > they be lying around in the archive directory? I understand that we
> > can't remove such files because we can't distinguish left-over files
> > from a crash and the temp files that another server is in the process
> > of copying.
>
> Yeah, leaving a potentially unbounded number of files around after
> system crashes seems pretty unfriendly. I'm not sure how to fix that,
> exactly.
A simple server restart while the basic_archive module is copying
to/from temp file would leave the file behind, see[1]. I think we can
fix this by defining shutdown_cb for the basic_archive module, like
the attached patch. While this helps in most of the crashes, but not
all. However, this is better than what we have right now.
[1] ubuntu:~/postgres/contrib/basic_archive/archive_directory$ ls
000000010000000000000001
archtemp.000000010000000000000002.2493876.1666091933457
archtemp.000000010000000000000002.2495316.1666091958680
--
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com