Re: thinko in basic_archive.c - Mailing list pgsql-hackers

From Bharath Rupireddy
Subject Re: thinko in basic_archive.c
Date
Msg-id CALj2ACVC3ZqxwngzGdwpiArrX2=uG_LOBTO4Zfhn-=ZV6=xc6w@mail.gmail.com
Whole thread Raw
In response to Re: thinko in basic_archive.c  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: thinko in basic_archive.c  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
List pgsql-hackers
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

Attachment

pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: CF Bot failure in wait_for_subscription_sync()
Next
From: Fabrice Chapuis
Date:
Subject: Re: Logical replication timeout problem