Hi All,
I tried performing pg_basebackup after creating a symbolic link for pg_replslot, pg_stat_tmp, pg_log and pg_clog in the source directory and found that on the backup location pg_stat_tmp, pg_repl_slot is a corrupt file rather than a link or directory whereas pg_clog and pg_log are getting skipped. As per the documentation of pg_basebackup, symbolic links on any directories
other than tablespace and xlog should be skipped. But this statement is not true for pg_replslot and pg_stat_tmp. The reason is as follows:
pg_basebackup is expecting pg_stat_tmp/pg_replslot to be a directory and irrespective of whether pg_stat_tmp is empty or not, it will always include it as a empty directory in backup path. Now, in my case i have created a softlink for pg_stat_tmp/pg_replslot and pg_basebackup is trying to create a tar format header without changing the filemode as it does in case of pg_xlog. Also, linkpath is not considered as in case of pg_tblspc. This is the reason why a regular file is getting created in the backup path even though i have a symbolic link in the source path but ideally it should be skipped.
Solution: Skip pg_stat_tmp and pg_replslot if they are symbolic link. Attached is the patch that fix this issue.
With Regards,
Ashutosh Sharma
EnterpriseDB:
http://www.enterprisedb.com