Re: pg_receivewal fail to streams when the partial file to write is not fully initialized present in the wal receiver directory

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: mahendrakar s <mahendrakarforpg(at)gmail(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, SATYANARAYANA NARLAPURAM <satyanarlapuram(at)gmail(dot)com>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_receivewal fail to streams when the partial file to write is not fully initialized present in the wal receiver directory
Date: 2022-08-19 11:57:50
Message-ID: CALj2ACW7ixfwYX7fxhsFhVcyS9DEQF52GgUX7xGkLWuctcoo-Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Aug 19, 2022 at 1:37 PM mahendrakar s
<mahendrakarforpg(at)gmail(dot)com> wrote:
>
> Hi Bharath,
> I reviewed your patch. Minor comments.

Thanks.

> 1. Why are we not using durable_unlink instead of unlink to remove the partial tmp files?

durable_unlink() issues fsync on the parent directory, if used, those
fsync() calls will be per partial.tmp file. Moreover, durable_unlink()
is backend-only, not available for tools i.e. FRONTEND code. If we
don't durably remove the pratial.tmp file, it will get deleted in the
next cycle anyways, so no problem there.

> 2. Below could be a simple if(shouldcreatetempfile){} else{} as in error case we need to return NULL.

Yeah, that way it is much simpler.

Please review the attached v6 patch.

--
Bharath Rupireddy
RDS Open Source Databases: https://aws.amazon.com/rds/postgresql/

Attachment Content-Type Size
v6-0001-Make-WAL-file-initialization-by-pg_receivewal-ato.patch application/octet-stream 7.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2022-08-19 12:04:56 Re: pg_receivewal and SIGTERM
Previous Message Tomas Vondra 2022-08-19 11:11:35 Re: logical decoding and replication of sequences, take 2