Re: pg_dump lock timeout

daveg <[email protected]> Mon, 21 Jul 2008 22:57:35 -0700
Newsgroups gmane.comp.db.postgresql.devel.patches
Message-ID <[email protected]>
On Mon, Jul 21, 2008 at 03:43:11AM -0400, Tom Lane wrote:
> daveg <[email protected]> writes:
> > On Sun, Jul 20, 2008 at 02:50:50PM -0400, Tom Lane wrote:
> >> In most cases our policy has been that pg_dumpall should accept and pass
> >> through any pg_dump option for which it's sensible to do so. I did not
> >> make that happen but it seems it'd be a reasonable follow-on patch.
> 
> > I'll remember that next time.
> 
> Er .. actually that was a direct request for you to do it.

 
Attached is a the followon patch for pg_dumpall and docs to match pg_dump.

On a second topic, is anyone working on a parallel dump/load? I'd be
interested in helping.

-dg

-- 
David Gould       [email protected]      510 536 1443    510 282 0869
If simplicity worked, the world would be overrun with insects.


-- 
Sent via pgsql-patches mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches
pg-dumpall-timeout.patch (text/plain, 2.4 KB)
*** a/doc/src/sgml/ref/pg_dumpall.sgml
--- b/doc/src/sgml/ref/pg_dumpall.sgml
***************
*** 196,201 **** PostgreSQL documentation
--- 196,217 ----
       </varlistentry>
  
       <varlistentry>
+       <term><option>--lock-wait-timeout=<replaceable class="parameter">timeout</replaceable></option></term>
+       <listitem>
+        <para>
+         Do not wait forever to acquire shared table locks at the beginning of
+         the dump. Instead fail if unable to lock a table within the specified
+         <replaceable class="parameter">timeout</>. The timeout may be
+         specified in any of the formats accepted by <command>SET
+         statement_timeout</>.  (Allowed values vary depending on the server
+         version you are dumping from, but an integer number of milliseconds
+         is accepted by all versions since 7.3.  This option is ignored when
+         dumping from a pre-7.3 server.)
+        </para>
+       </listitem>
+      </varlistentry>
+ 
+      <varlistentry>
        <term><option>--no-tablespaces</option></term>
        <listitem>
         <para>
*** a/src/bin/pg_dump/pg_dumpall.c
--- b/src/bin/pg_dump/pg_dumpall.c
***************
*** 120,125 **** main(int argc, char *argv[])
--- 120,126 ----
  		{"disable-triggers", no_argument, &disable_triggers, 1},
  		{"no-tablespaces", no_argument, &no_tablespaces, 1},
  		{"use-set-session-authorization", no_argument, &use_setsessauth, 1},
+ 		{"lock-wait-timeout", required_argument, NULL, 2},
  
  		{NULL, 0, NULL, 0}
  	};
***************
*** 305,310 **** main(int argc, char *argv[])
--- 306,316 ----
  			case 0:
  				break;
  
+ 			case 2:
+ 				appendPQExpBuffer(pgdumpopts, " --lock-wait-timeout=");
+ 				appendPQExpBuffer(pgdumpopts, optarg);
+                 break;
+ 
  			default:
  				fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
  				exit(1);
***************
*** 488,493 **** help(void)
--- 494,500 ----
  	printf(_("  -f, --file=FILENAME      output file name\n"));
  	printf(_("  --help                   show this help, then exit\n"));
  	printf(_("  --version                output version information, then exit\n"));
+ 	printf(_("  --lock-wait-timeout=TIMEOUT fail after waiting TIMEOUT for a table lock\n"));
  	printf(_("\nOptions controlling the output content:\n"));
  	printf(_("  -a, --data-only          dump only the data, not the schema\n"));
  	printf(_("  -c, --clean              clean (drop) databases prior to create\n"));