Skip to content

Commit 46e6493

Browse files
committed
FIXUP: more comments around log dir creation
1 parent d381307 commit 46e6493

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

internal/postgres/config.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,14 +378,17 @@ func startupCommand(
378378
}
379379

380380
// 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.
383385
if path.IsAbs(logDir) && !strings.HasPrefix(logDir, dataDir) {
384386
mkdirs = append(mkdirs,
385387
`(`+shell.MakeDirectories(dataMountPath, logDir)+`) ||`,
386388
`halt "$(permissions `+shell.QuoteWord(logDir)+` ||:)"`,
387389
)
388390
} else {
391+
// Postgres interprets "log_directory" relative to "data_directory" so do the same here.
389392
mkdirs = append(mkdirs,
390393
`[[ ! -f `+shell.QuoteWord(path.Join(dataDir, "PG_VERSION"))+` ]] ||`,
391394
`(`+shell.MakeDirectories(dataDir, logDir)+`) ||`,

0 commit comments

Comments
 (0)