Re: thinko in basic_archive.c

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Nathan Bossart <nathandbossart(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: thinko in basic_archive.c
Date: 2022-10-18 13:24:22
Message-ID: CALj2ACVC3ZqxwngzGdwpiArrX2=uG_LOBTO4Zfhn-=ZV6=xc6w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Oct 17, 2022 at 6:45 PM Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>
> On Fri, Oct 14, 2022 at 4:45 AM Bharath Rupireddy
> <bharath(dot)rupireddyforpostgres(at)gmail(dot)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

Attachment Content-Type Size
v1-0001-Remove-leftover-temporary-files-via-basic_archive.patch application/x-patch 3.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabrice Chapuis 2022-10-18 14:35:02 Re: Logical replication timeout problem
Previous Message Amit Kapila 2022-10-18 13:04:33 Re: CF Bot failure in wait_for_subscription_sync()