Re: pg_rewind: Skip log directory for file type check like pg_wal

From: Alexander Kukushkin <cyberdemn(at)gmail(dot)com>
To: Soumyadeep Chakraborty <soumyadeep2007(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_rewind: Skip log directory for file type check like pg_wal
Date: 2023-03-07 07:33:24
Message-ID: CAFh8B=nebtn5238TeT9gz_YWWwRqkzT0kbxZgBF4s5YpMXM9zA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 6 Mar 2023 at 19:37, Soumyadeep Chakraborty <
soumyadeep2007(at)gmail(dot)com> wrote:

>
> > 2. Unlike "pg_wal", the "log" directory is not necessarily located
> inside PGDATA. The actual value is configured using "log_directory" GUC,
> which just happened to be "log" by default. And in fact actual values on
> source and target could be different.
>
> I think we only care about files/dirs inside the datadir. Anything
> outside is out of scope for
> pg_rewind AFAIU. We can only address the common case here. As mentioned in
> this
> comment:
>
> * XXX: There is no backend function to get a symbolic link's target in
> * general, so if the admin has put any custom symbolic links in the data
> * directory, they won't be copied correctly.
>

That's exactly my point. Users are very creative.
On one node they could set log_directory to for example "pg_log" and on
another one "my_log".
And they would be writing logs to $PGDATA/pg_log and $PGDATA/my_log
respectively and they are both located inside datadir.

Lets assume that on the source we have "pg_log" and on the target we have
"my_log" (they are configured using "log_directory" GUC).
When doing rewind in this case we want neither to remove the content of
"my_log" on the target nor to copy content of "pg_log" from the source.
It couldn't be achieved just by introducing a static string "log". The
"log_directory" GUC must be examined on both, source and target.

Regards,
--
Alexander Kukushkin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2023-03-07 07:48:57 Re: [PATCH] Use indexes on the subscriber when REPLICA IDENTITY is full on the publisher
Previous Message Thomas Munro 2023-03-07 07:33:11 Re: Use pg_pwritev_with_retry() instead of write() in dir_open_for_write() to avoid partial writes?