Hello Soumyadeep,
The problem indeed exists, but IMO the "log" directory case must be handled
differently:
1. We don't need or I would even say we don't want to sync log files from
the new primary, because it destroys the actual logs, which could be very
important to figure out what has happened with the old primary
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.
Regards,
--
Alexander Kukushkin