Clarify initdb --sync-only help message and docs
authorDaniel Gustafsson <dgustafsson@postgresql.org>
Mon, 16 Aug 2021 11:38:01 +0000 (13:38 +0200)
committerDaniel Gustafsson <dgustafsson@postgresql.org>
Mon, 16 Aug 2021 11:38:01 +0000 (13:38 +0200)
The initdb help message for --sync-only was a bit terse, and not
really self-explanatory. Make it clearer that initdb --sync-only
will exit after syncing, and expand the docs with a note on when
the option can be useful. Also align the help output with others
that exit immediately.

Author: Nathan Bossart, Gurjeet Singh
Discussion: https://postgr.es/m/CABwTF4U6hbNNE1bv=LxQdJybmUdZ5NJQ9rKY9tN82NXM8QH+iQ@mail.gmail.com

doc/src/sgml/ref/initdb.sgml
src/bin/initdb/initdb.c

index e62742850a3b8daad2e8a405996f6b962cea8cdb..3d88838712646f076714c6ac00a405e8e3fefbd0 100644 (file)
@@ -306,6 +306,9 @@ PostgreSQL documentation
        <para>
         Safely write all database files to disk and exit.  This does not
         perform any of the normal <application>initdb</application> operations.
+        Generally, this option is useful for ensuring reliable recovery after
+        changing <xref linkend="guc-fsync"/> from <literal>off</literal> to
+        <literal>on</literal>.
        </para>
       </listitem>
      </varlistentry>
index 5e84c7bb20efce3850bcfdc667bbc72cb7e22bd8..f05cddf0e088b0719d90db53cc15605095bc9bbb 100644 (file)
@@ -2200,7 +2200,7 @@ usage(const char *progname)
        printf(_("  -N, --no-sync             do not wait for changes to be written safely to disk\n"));
        printf(_("      --no-instructions     do not print instructions for next steps\n"));
        printf(_("  -s, --show                show internal settings\n"));
-       printf(_("  -S, --sync-only           only sync data directory\n"));
+       printf(_("  -S, --sync-only           only sync database files to disk, then exit\n"));
        printf(_("\nOther options:\n"));
        printf(_("  -V, --version             output version information, then exit\n"));
        printf(_("  -?, --help                show this help, then exit\n"));