@@ -378,14 +378,17 @@ func startupCommand(
378
378
}
379
379
380
380
// Postgres creates "log_directory" but does *not* create any of its parent directories.
381
- // Postgres omits the group-write S_IWGRP permission on the directory. Do both here while being
382
- // careful to *not* touch "data_directory" contents until after `initdb` or Patroni bootstrap.
381
+ // Postgres omits group-write S_IWGRP permission when creating the directory.
382
+ //
383
+ // Do both here while being careful to *not* touch "data_directory" contents until after
384
+ // `initdb` or Patroni bootstrap; those abort unless "data_directory" is entirely empty.
383
385
if path .IsAbs (logDir ) && ! strings .HasPrefix (logDir , dataDir ) {
384
386
mkdirs = append (mkdirs ,
385
387
`(` + shell .MakeDirectories (dataMountPath , logDir )+ `) ||` ,
386
388
`halt "$(permissions ` + shell .QuoteWord (logDir )+ ` ||:)"` ,
387
389
)
388
390
} else {
391
+ // Postgres interprets "log_directory" relative to "data_directory" so do the same here.
389
392
mkdirs = append (mkdirs ,
390
393
`[[ ! -f ` + shell .QuoteWord (path .Join (dataDir , "PG_VERSION" ))+ ` ]] ||` ,
391
394
`(` + shell .MakeDirectories (dataDir , logDir )+ `) ||` ,
0 commit comments