]> granicus.if.org Git - postgresql/commitdiff
Add long options to pg_resetwal and pg_controldata
authorPeter Eisentraut <peter_e@gmx.net>
Sun, 25 Mar 2018 01:14:20 +0000 (21:14 -0400)
committerPeter Eisentraut <peter_e@gmx.net>
Sun, 25 Mar 2018 01:49:53 +0000 (21:49 -0400)
We were running out of good single-letter options for some upcoming
pg_resetwal functionality, so add long options to create more
possibilities.  Add to pg_controldata as well for symmetry.

based on patch by Bossart, Nathan <bossartn@amazon.com>

doc/src/sgml/ref/pg_controldata.sgml
doc/src/sgml/ref/pg_resetwal.sgml
src/bin/pg_controldata/pg_controldata.c
src/bin/pg_resetwal/pg_resetwal.c

index 9a676e0a78bf5bd663129fc929f017f3b66d0090..32081e9b91cc5674324b2302a73cf11343ebe979 100644 (file)
@@ -23,7 +23,13 @@ PostgreSQL documentation
   <cmdsynopsis>
    <command>pg_controldata</command>
    <arg choice="opt"><replaceable class="parameter">option</replaceable></arg>
-   <arg choice="opt"><arg choice="opt"><option>-D</option></arg> <replaceable class="parameter">datadir</replaceable></arg>
+   <group choice="opt">
+    <group choice="opt">
+     <arg choice="plain"><option>--pgdata</option></arg>
+     <arg choice="plain"><option>-D</option></arg>
+    </group>
+    <replaceable class="parameter"> datadir</replaceable>
+   </group>
   </cmdsynopsis>
  </refsynopsisdiv>
 
index 34ebe11a4427abfe4327f01cbb6e91c3c7ae9608..5e2e3086a6eaf87baf6702be774c8598968257a3 100644 (file)
@@ -22,10 +22,22 @@ PostgreSQL documentation
  <refsynopsisdiv>
   <cmdsynopsis>
    <command>pg_resetwal</command>
-   <arg choice="opt"><option>-f</option></arg>
-   <arg choice="opt"><option>-n</option></arg>
+   <group choice="opt">
+    <arg choice="plain"><option>--force</option></arg>
+    <arg choice="plain"><option>-f</option></arg>
+   </group>
+   <group choice="opt">
+    <arg choice="plain"><option>--dry-run</option></arg>
+    <arg choice="plain"><option>-n</option></arg>
+   </group>
    <arg rep="repeat"><replaceable>option</replaceable></arg>
-   <arg choice="req"><arg choice="opt"><option>-D</option></arg> <replaceable class="parameter">datadir</replaceable></arg>
+   <group choice="plain">
+    <group choice="opt">
+     <arg choice="plain"><option>--pgdata</option></arg>
+     <arg choice="plain"><option>-D</option></arg>
+    </group>
+    <replaceable class="parameter"> datadir</replaceable>
+   </group>
   </cmdsynopsis>
  </refsynopsisdiv>
 
@@ -78,6 +90,7 @@ PostgreSQL documentation
   <variablelist>
    <varlistentry>
     <term><option>-f</option></term>
+    <term><option>--force</option></term>
     <listitem>
      <para>
       Force <command>pg_resetwal</command> to proceed even if it cannot determine
@@ -88,9 +101,10 @@ PostgreSQL documentation
 
    <varlistentry>
     <term><option>-n</option></term>
+    <term><option>--dry-run</option></term>
     <listitem>
      <para>
-      The <option>-n</option> (no operation) option instructs
+      The <option>-n</option>/<option>--dry-run</option> option instructs
       <command>pg_resetwal</command> to print the values reconstructed from
       <filename>pg_control</filename> and values about to be changed, and then exit
       without modifying anything. This is mainly a debugging tool, but can be
@@ -123,7 +137,8 @@ PostgreSQL documentation
 
   <variablelist>
    <varlistentry>
-    <term><option>-c</option> <replaceable class="parameter">xid</replaceable>,<replaceable class="parameter">xid</replaceable></term>
+    <term><option>-c <replaceable class="parameter">xid</replaceable>,<replaceable class="parameter">xid</replaceable></option></term>
+    <term><option>--commit-timestamp-ids=<replaceable class="parameter">xid</replaceable>,<replaceable class="parameter">xid</replaceable></option></term>
     <listitem>
      <para>
       Manually set the oldest and newest transaction IDs for which the commit
@@ -144,7 +159,8 @@ PostgreSQL documentation
    </varlistentry>
 
    <varlistentry>
-    <term><option>-e</option> <replaceable class="parameter">xid_epoch</replaceable></term>
+    <term><option>-e <replaceable class="parameter">xid_epoch</replaceable></option></term>
+    <term><option>--epoch=<replaceable class="parameter">xid_epoch</replaceable></option></term>
     <listitem>
      <para>
       Manually set the next transaction ID's epoch.
@@ -164,7 +180,8 @@ PostgreSQL documentation
    </varlistentry>
 
    <varlistentry>
-    <term><option>-l</option> <replaceable class="parameter">walfile</replaceable></term>
+    <term><option>-l <replaceable class="parameter">walfile</replaceable></option></term>
+    <term><option>--next-wal-file=<replaceable class="parameter">walfile</replaceable></option></term>
     <listitem>
      <para>
       Manually set the WAL starting location by specifying the name of the
@@ -203,7 +220,8 @@ PostgreSQL documentation
    </varlistentry>
 
    <varlistentry>
-    <term><option>-m</option> <replaceable class="parameter">mxid</replaceable>,<replaceable class="parameter">mxid</replaceable></term>
+    <term><option>-m <replaceable class="parameter">mxid</replaceable>,<replaceable class="parameter">mxid</replaceable></option></term>
+    <term><option>--multixact-ids=<replaceable class="parameter">mxid</replaceable>,<replaceable class="parameter">mxid</replaceable></option></term>
     <listitem>
      <para>
       Manually set the next and oldest multitransaction ID.
@@ -224,7 +242,8 @@ PostgreSQL documentation
    </varlistentry>
 
    <varlistentry>
-    <term><option>-o</option> <replaceable class="parameter">oid</replaceable></term>
+    <term><option>-o <replaceable class="parameter">oid</replaceable></option></term>
+    <term><option>--next-oid=<replaceable class="parameter">oid</replaceable></option></term>
     <listitem>
      <para>
       Manually set the next OID.
@@ -239,7 +258,8 @@ PostgreSQL documentation
    </varlistentry>
 
    <varlistentry>
-    <term><option>-O</option> <replaceable class="parameter">mxoff</replaceable></term>
+    <term><option>-O <replaceable class="parameter">mxoff</replaceable></option></term>
+    <term><option>--multixact-offset=<replaceable class="parameter">mxoff</replaceable></option></term>
     <listitem>
      <para>
       Manually set the next multitransaction offset.
@@ -256,7 +276,8 @@ PostgreSQL documentation
    </varlistentry>
 
    <varlistentry>
-    <term><option>-x</option> <replaceable class="parameter">xid</replaceable></term>
+    <term><option>-x <replaceable class="parameter">xid</replaceable></option></term>
+    <term><option>--next-transaction-id=<replaceable class="parameter">xid</replaceable></option></term>
     <listitem>
      <para>
       Manually set the next transaction ID.
index f9dc854b4a95b527618fa2dd25d2040b12ba00b4..0dbf8e2f6b66876c3ecf7d563b79c4754f89a4a8 100644 (file)
@@ -34,9 +34,9 @@ usage(const char *progname)
        printf(_("Usage:\n"));
        printf(_("  %s [OPTION] [DATADIR]\n"), progname);
        printf(_("\nOptions:\n"));
-       printf(_(" [-D] DATADIR    data directory\n"));
-       printf(_("  -V, --version  output version information, then exit\n"));
-       printf(_("  -?, --help     show this help, then exit\n"));
+       printf(_(" [-D,--pgdata=]DATADIR  data directory\n"));
+       printf(_("  -V, --version         output version information, then exit\n"));
+       printf(_("  -?, --help            show this help, then exit\n"));
        printf(_("\nIf no data directory (DATADIR) is specified, "
                         "the environment variable PGDATA\nis used.\n\n"));
        printf(_("Report bugs to <pgsql-bugs@postgresql.org>.\n"));
@@ -85,6 +85,11 @@ wal_level_str(WalLevel wal_level)
 int
 main(int argc, char *argv[])
 {
+       static struct option long_options[] = {
+               {"pgdata", required_argument, NULL, 'D'},
+               {NULL, 0, NULL, 0}
+       };
+
        ControlFileData *ControlFile;
        bool            crc_ok;
        char       *DataDir = NULL;
@@ -118,7 +123,7 @@ main(int argc, char *argv[])
                }
        }
 
-       while ((c = getopt(argc, argv, "D:")) != -1)
+       while ((c = getopt_long(argc, argv, "D:", long_options, NULL)) != -1)
        {
                switch (c)
                {
index c99e7a8db1e21343ed46f62e29dbabd393cd4fed..ba3b8b4d6b71909bb90c1bbcf1b8d95c493ab38c 100644 (file)
@@ -88,6 +88,20 @@ static void usage(void);
 int
 main(int argc, char *argv[])
 {
+       static struct option long_options[] = {
+               {"commit-timestamp-ids", required_argument, NULL, 'c'},
+               {"pgdata", required_argument, NULL, 'D'},
+               {"epoch", required_argument, NULL, 'e'},
+               {"force", no_argument, NULL, 'f'},
+               {"next-wal-file", required_argument, NULL, 'l'},
+               {"multixact-ids", required_argument, NULL, 'm'},
+               {"dry-run", no_argument, NULL, 'n'},
+               {"next-oid", required_argument, NULL, 'o'},
+               {"multixact-offset", required_argument, NULL, 'O'},
+               {"next-transaction-id", required_argument, NULL, 'x'},
+               {NULL, 0, NULL, 0}
+       };
+
        int                     c;
        bool            force = false;
        bool            noupdate = false;
@@ -117,7 +131,7 @@ main(int argc, char *argv[])
        }
 
 
-       while ((c = getopt(argc, argv, "c:D:e:fl:m:no:O:x:")) != -1)
+       while ((c = getopt_long(argc, argv, "c:D:e:fl:m:no:O:x:", long_options, NULL)) != -1)
        {
                switch (c)
                {
@@ -1251,18 +1265,19 @@ usage(void)
        printf(_("%s resets the PostgreSQL write-ahead log.\n\n"), progname);
        printf(_("Usage:\n  %s [OPTION]... DATADIR\n\n"), progname);
        printf(_("Options:\n"));
-       printf(_("  -c XID,XID       set oldest and newest transactions bearing commit timestamp\n"));
-       printf(_("                   (zero in either value means no change)\n"));
-       printf(_(" [-D] DATADIR      data directory\n"));
-       printf(_("  -e XIDEPOCH      set next transaction ID epoch\n"));
-       printf(_("  -f               force update to be done\n"));
-       printf(_("  -l WALFILE       force minimum WAL starting location for new write-ahead log\n"));
-       printf(_("  -m MXID,MXID     set next and oldest multitransaction ID\n"));
-       printf(_("  -n               no update, just show what would be done (for testing)\n"));
-       printf(_("  -o OID           set next OID\n"));
-       printf(_("  -O OFFSET        set next multitransaction offset\n"));
-       printf(_("  -V, --version    output version information, then exit\n"));
-       printf(_("  -x XID           set next transaction ID\n"));
-       printf(_("  -?, --help       show this help, then exit\n"));
+       printf(_("  -c, --commit-timestamp-ids=XID,XID\n"
+                        "                                 set oldest and newest transactions bearing\n"
+                        "                                 commit timestamp (zero means no change)\n"));
+       printf(_(" [-D, --pgdata=]DATADIR          data directory\n"));
+       printf(_("  -e, --epoch=XIDEPOCH           set next transaction ID epoch\n"));
+       printf(_("  -f, --force                    force update to be done\n"));
+       printf(_("  -l, --next-wal-file=WALFILE    set minimum starting location for new WAL\n"));
+       printf(_("  -m, --multixact-ids=MXID,MXID  set next and oldest multitransaction ID\n"));
+       printf(_("  -n, --dry-run                  no update, just show what would be done\n"));
+       printf(_("  -o, --next-oid=OID             set next OID\n"));
+       printf(_("  -O, --multixact-offset=OFFSET  set next multitransaction offset\n"));
+       printf(_("  -V, --version                  output version information, then exit\n"));
+       printf(_("  -x, --next-transaction-id=XID  set next transaction ID\n"));
+       printf(_("  -?, --help                     show this help, then exit\n"));
        printf(_("\nReport bugs to <pgsql-bugs@postgresql.org>.\n"));
 }