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

From: Cary Huang <cary(dot)huang(at)highgo(dot)ca>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: SATYANARAYANA NARLAPURAM <satyanarlapuram(at)gmail(dot)com>
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-03-31 22:01:04
Message-ID: 164876406444.1182.11596302572557875100.pgcf@coridan.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello

pg_receivewal creates this .partial WAL file during WAL streaming and it is already treating this file as a temporary file. It will fill this .partial file with zeroes up to 16777216 by default before streaming real WAL data on it.

If your .partial file is only 8396800 bytes, then this could mean that pg_receivewal is terminated abruptly while it is appending zeroes or your system runs out of disk space. Do you have any error message?

If this is case, the uninitialized .partial file should still be all zeroes, so it should be ok to delete it and have pg_receivewal to recreate a new .partial file.

Also, in your patch, you are using pad_to_size argument in function dir_open_for_write to determine if it needs to create a temp file, but I see that this function is always given a pad_to_size = 16777216 , and never 0. Am I missing something?

Cary Huang
===========
HighGo Software Canada

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2022-03-31 22:42:30 Re: head fails to build on SLES 12 (wal_compression=zstd)
Previous Message Jacob Champion 2022-03-31 21:49:00 Re: [PATCH] Expose port->authn_id to extensions and triggers