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

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: pg_receivewal fail to streams when the partial file to write is not fully initialized present in the wal receiver directory
Дата
Msg-id YdKsN5N2+TpHFu5C@paquier.xyz
обсуждение исходный текст
Ответ на pg_receivewal fail to streams when the partial file to write is not fully initialized present in the wal receiver directory  (SATYANARAYANA NARLAPURAM <satyanarlapuram@gmail.com>)
Ответы Re: pg_receivewal fail to streams when the partial file to write is not fully initialized present in the wal receiver directory  (SATYANARAYANA NARLAPURAM <satyanarlapuram@gmail.com>)
Список pgsql-hackers
On Sun, Jan 02, 2022 at 09:27:43PM -0800, SATYANARAYANA NARLAPURAM wrote:
> I noticed that pg_receivewal fails to stream when the partial file to write
> is not fully initialized and fails with the error message something like
> below. This requires an extra step of deleting the partial file that is not
> fully initialized before starting the pg_receivewal. Attaching a simple
> patch that creates a temp file, fully initialize it and rename the file to
> the desired wal segment name.

Are you referring to the pre-padding when creating a new partial
segment, aka when we write chunks of XLOG_BLCKSZ full of zeros until
the file is fully created?  What kind of error did you see?  I guess
that a write() with ENOSPC would be more likely, but you got a
different problem?  I don't disagree with improving such cases, but we
should not do things so as there is a risk of leaving behind an
infinite set of segments in case of repeated errors, and partial
segments are already a kind of temporary file.

-       if (dir_data->sync)
+       if (shouldcreatetempfile)
+       {
+               if (durable_rename(tmpsuffixpath, targetpath) != 0)
+               {
+                       close(fd);
+                       unlink(tmpsuffixpath);
+                       return NULL;
+               }
+       }

durable_rename() does a set of fsync()'s, but --no-sync should not
flush any data.
--
Michael

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: Confused comment about drop replica identity index
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: Use MaxLockMode in lock methods initialization