BUG #15303: Postgres fail to start if pg_wal is symlink, and works when it's a junction point

Started by PG Bug reporting formover 7 years ago2 messagesbugs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

The following bug has been logged on the website:

Bug reference: 15303
Logged by: Maria Fedorova
Email address: qwadrillion@gmail.com
PostgreSQL version: 10.4
Operating system: Windows 10
Description:

Postgres fail to start if pg_wal is directory symbolic link:
$ mklink /D pg_wal C:\***\jul_25\transaction_log\pg_wal

Directory of C:\***\jul_25\storage_file\data

27.07.2018 11:34 <DIR> .
27.07.2018 11:34 <DIR> ..
27.07.2018 10:12 <DIR> base
27.07.2018 11:34 86 current_logfiles
27.07.2018 11:34 <DIR> global
27.07.2018 10:12 <DIR> pg_commit_ts
27.07.2018 10:12 <DIR> pg_dynshmem
27.07.2018 10:12 4 208 pg_hba.conf
27.07.2018 10:12 1 678 pg_ident.conf
27.07.2018 11:27 <DIR> pg_logical
27.07.2018 10:12 <DIR> pg_multixact
27.07.2018 11:34 <DIR> pg_notify
27.07.2018 10:12 <DIR> pg_replslot
27.07.2018 10:12 <DIR> pg_serial
27.07.2018 10:12 <DIR> pg_snapshots
27.07.2018 11:27 <DIR> pg_stat
27.07.2018 11:27 <DIR> pg_stat_tmp
27.07.2018 10:12 <DIR> pg_subtrans
27.07.2018 10:12 <DIR> pg_tblspc
27.07.2018 10:12 <DIR> pg_twophase
27.07.2018 10:12 3 PG_VERSION
27.07.2018 11:26 <SYMLINKD> pg_wal
[C:\***\jul_25\transaction_log\pg_wal]
27.07.2018 10:12 <DIR> pg_xact
27.07.2018 10:12 90 postgresql.auto.conf
27.07.2018 11:34 22 918 postgresql.conf
27.07.2018 11:34 132 postmaster.opts
27.07.2018 10:12 <DIR> tablespaces
7 File(s) 29 115 bytes
20 Dir(s) 319 136 731 136 bytes free

Then postgres fail to start
2018-07-27 11:34:22.544 MSK [11848] LOG: 00000: database system was shut
down at 2018-07-27 11:27:33 MSK
2018-07-27 11:34:22.544 MSK [11848] LOCATION: StartupXLOG, xlog.c:6244
2018-07-27 11:34:22.545 MSK [11848] FATAL: XX000: required WAL directory
"pg_wal" does not exist
2018-07-27 11:34:22.545 MSK [11848] LOCATION:
ValidateXLOGDirectoryStructure, xlog.c:4079
2018-07-27 11:34:22.571 MSK [7232] LOG: 00000: startup process (PID 11848)
exited with exit code 1
2018-07-27 11:34:22.571 MSK [7232] LOCATION: LogChildExit,
postmaster.c:3605
2018-07-27 11:34:22.571 MSK [7232] LOG: 00000: aborting startup due to
startup process failure
2018-07-27 11:34:22.571 MSK [7232] LOCATION: reaper, postmaster.c:2876
2018-07-27 11:34:22.585 MSK [7232] LOG: 00000: database system is shut
down
2018-07-27 11:34:22.585 MSK [7232] LOCATION: UnlinkLockFiles,
miscinit.c:757

But works when pg_wal is created as directory junction:
mklink /J pg_wal C:\***\jul_25\transaction_log\pg_wal

2018-07-27 10:12:21.216 MSK [10444] LOG: database system was shut down at
2018-07-24 04:22:02 MSK
2018-07-27 10:12:21.304 MSK [5332] LOG: database system is ready to accept
connections

#2Michael Paquier
michael@paquier.xyz
In reply to: PG Bug reporting form (#1)
Re: BUG #15303: Postgres fail to start if pg_wal is symlink, and works when it's a junction point

On Fri, Jul 27, 2018 at 08:37:55AM +0000, PG Bug reporting form wrote:

Postgres fail to start if pg_wal is directory symbolic link:
$ mklink /D pg_wal C:\***\jul_25\transaction_log\pg_wal

That's working as designed and that's not a bug. Postgres has many code
paths where symbolic link handling of any other *nix platform maps to
junction points for Windows.

There may be some room for supporting direct symbolic links, but is that
really worth it knowing that junction points (mklink /J) work as
expected?
--
Michael