Re: pg_rewind: Skip log directory for file type check like pg_wal
Alexander Kukushkin <cyberdemn@gmail.com>
From: Alexander Kukushkin <cyberdemn@gmail.com>
To: Soumyadeep Chakraborty <soumyadeep2007@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2023-03-07T07:33:24Z
Lists: 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