From a085a6a77c65e10d7c24d134677cce223e1db94e Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Fri, 5 Feb 2010 11:08:02 +0000 Subject: [PATCH] Add a note to the documentation of pg_standby that it's important that the postgres process has permissions to delete the trigger file, per suggestion by Mason Hale. Also fix pg_standby to do a more predictable exit(200) instead of the current exit(-1) when the unlink of the trigger file fails anyway. This only affects 8.3 branch. Older versions didn't have pg_standby, and in 8.4 upwards pg_standby is no longer responsible for deleting the trigger file; it's supposed to be done by recovery_end_command instead. --- contrib/pg_standby/pg_standby.c | 5 ++++- doc/src/sgml/pgstandby.sgml | 11 ++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/contrib/pg_standby/pg_standby.c b/contrib/pg_standby/pg_standby.c index 4261490dabc..1d6f972447f 100644 --- a/contrib/pg_standby/pg_standby.c +++ b/contrib/pg_standby/pg_standby.c @@ -371,13 +371,16 @@ CheckForExternalTrigger(void) * recovery completes, we will be asked again for the same file from * the archive using pg_standby so must remove trigger file so we can * reload file again and come up correctly. + * + * If it fails, return with an exit code that the server will treat + * as a FATAL error. */ rc = unlink(triggerPath); if (rc != 0) { fprintf(stderr, "\n ERROR: could not remove \"%s\": %s", triggerPath, strerror(errno)); fflush(stderr); - exit(rc); + exit(200); } return true; } diff --git a/doc/src/sgml/pgstandby.sgml b/doc/src/sgml/pgstandby.sgml index 87629278141..b52bf27d403 100644 --- a/doc/src/sgml/pgstandby.sgml +++ b/doc/src/sgml/pgstandby.sgml @@ -1,4 +1,4 @@ - + pg_standby @@ -199,6 +199,15 @@ pg_standby option ... archiv + + + It is critical the trigger file be created with permissions allowing + the postgres process to remove the file. Generally this is best done + by creating the file from the postgres user account. Failure to do so + will prevent completion of WAL file recovery and the server from + coming back online successfully. + + --help is not supported since