Re: pg_rewind: Skip log directory for file type check like pg_wal - Mailing list pgsql-hackers

From Alexander Kukushkin
Subject Re: pg_rewind: Skip log directory for file type check like pg_wal
Date
Msg-id CAFh8B=nebtn5238TeT9gz_YWWwRqkzT0kbxZgBF4s5YpMXM9zA@mail.gmail.com
Whole thread Raw
In response to Re: pg_rewind: Skip log directory for file type check like pg_wal  (Soumyadeep Chakraborty <soumyadeep2007@gmail.com>)
Responses Re: pg_rewind: Skip log directory for file type check like pg_wal  (Soumyadeep Chakraborty <soumyadeep2007@gmail.com>)
Re: pg_rewind: Skip log directory for file type check like pg_wal  (Daniel Gustafsson <daniel@yesql.se>)
List pgsql-hackers


On Mon, 6 Mar 2023 at 19:37, Soumyadeep Chakraborty <soumyadeep2007@gmail.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

pgsql-hackers by date:

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