]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Add a note to the documentation of pg_standby that it's important that
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Fri, 5 Feb 2010 11:08:02 +0000 (11:08 +0000)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Fri, 5 Feb 2010 11:08:02 +0000 (11:08 +0000)
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
doc/src/sgml/pgstandby.sgml

index 4261490dabc6fdd8bdf882f2772bc69d24dedacc..1d6f972447f984fb27a1d2f1df81fa0f4240b7be 100644 (file)
@@ -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;
        }
index 87629278141ccddc927ce11263d98b50b0e682a2..b52bf27d4033c0410b689cc2f1ecfd0943a8c8d0 100644 (file)
@@ -1,4 +1,4 @@
-<!-- $PostgreSQL: pgsql/doc/src/sgml/pgstandby.sgml,v 2.4.2.1 2008/05/07 22:06:11 alvherre Exp $ -->
+<!-- $PostgreSQL: pgsql/doc/src/sgml/pgstandby.sgml,v 2.4.2.2 2010/02/05 11:08:02 heikki Exp $ -->
 
 <sect1 id="pgstandby">
  <title>pg_standby</title>
@@ -199,6 +199,15 @@ pg_standby <optional> <replaceable>option</> ... </optional> <replaceable>archiv
     </tbody>
    </tgroup>
   </table>
+  <caution>
+    <para>
+      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.
+    </para>
+  </caution>
   <note>
    <para>
     <literal>--help</literal> is not supported since