]> granicus.if.org Git - postgresql/commitdiff
Force idle_in_transaction_session_timeout off in pg_dump and autovacuum.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 15 Jun 2016 14:52:53 +0000 (10:52 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 15 Jun 2016 14:53:03 +0000 (10:53 -0400)
We disable statement_timeout and lock_timeout during dump and restore, to
prevent any global settings that might exist from breaking routine backups.
Commit c6dda1f48 should have added idle_in_transaction_session_timeout to
that list, but failed to.

Another place where these timeouts get turned off is autovacuum.  While
I doubt an idle timeout could fire there, it seems better to be safe than
sorry.

pg_dump issue noted by Bernd Helmle, the other one found by grepping.

Report: <352F9B77DB5D3082578D17BB@eje.land.credativ.lan>

src/backend/postmaster/autovacuum.c
src/bin/pg_dump/pg_backup_archiver.c
src/bin/pg_dump/pg_dump.c

index 2c7446b4a43ea3822a2d00466d887ac6d57d8862..3768f50bcf3aa2b2700c2e586e117d1ff3465399 100644 (file)
@@ -538,11 +538,13 @@ AutoVacLauncherMain(int argc, char *argv[])
        SetConfigOption("zero_damaged_pages", "false", PGC_SUSET, PGC_S_OVERRIDE);
 
        /*
-        * Force statement_timeout and lock_timeout to zero to avoid letting these
-        * settings prevent regular maintenance from being executed.
+        * Force settable timeouts off to avoid letting these settings prevent
+        * regular maintenance from being executed.
         */
        SetConfigOption("statement_timeout", "0", PGC_SUSET, PGC_S_OVERRIDE);
        SetConfigOption("lock_timeout", "0", PGC_SUSET, PGC_S_OVERRIDE);
+       SetConfigOption("idle_in_transaction_session_timeout", "0",
+                                       PGC_SUSET, PGC_S_OVERRIDE);
 
        /*
         * Force default_transaction_isolation to READ COMMITTED.  We don't want
@@ -1551,11 +1553,13 @@ AutoVacWorkerMain(int argc, char *argv[])
        SetConfigOption("zero_damaged_pages", "false", PGC_SUSET, PGC_S_OVERRIDE);
 
        /*
-        * Force statement_timeout and lock_timeout to zero to avoid letting these
-        * settings prevent regular maintenance from being executed.
+        * Force settable timeouts off to avoid letting these settings prevent
+        * regular maintenance from being executed.
         */
        SetConfigOption("statement_timeout", "0", PGC_SUSET, PGC_S_OVERRIDE);
        SetConfigOption("lock_timeout", "0", PGC_SUSET, PGC_S_OVERRIDE);
+       SetConfigOption("idle_in_transaction_session_timeout", "0",
+                                       PGC_SUSET, PGC_S_OVERRIDE);
 
        /*
         * Force default_transaction_isolation to READ COMMITTED.  We don't want
index eadc874f9526b0cb96b2004446b9f6d1291535bf..796a0aa71685b96d567f5ae5c16cb30ca8d1bd9d 100644 (file)
@@ -2859,11 +2859,12 @@ _doSetFixedOutputState(ArchiveHandle *AH)
 {
        RestoreOptions *ropt = AH->public.ropt;
 
-       /* Disable statement_timeout since restore is probably slow */
+       /*
+        * Disable timeouts to allow for slow commands, idle parallel workers, etc
+        */
        ahprintf(AH, "SET statement_timeout = 0;\n");
-
-       /* Likewise for lock_timeout */
        ahprintf(AH, "SET lock_timeout = 0;\n");
+       ahprintf(AH, "SET idle_in_transaction_session_timeout = 0;\n");
 
        /* Select the correct character set encoding */
        ahprintf(AH, "SET client_encoding = '%s';\n",
index 0f1f6e9f93b8e65dc271caed26fa15200b9f400f..13bfd2cfb934cdf0d769147e7b9657168c768752 100644 (file)
@@ -1022,6 +1022,8 @@ setup_connection(Archive *AH, const char *dumpencoding,
                ExecuteSqlStatement(AH, "SET statement_timeout = 0");
        if (AH->remoteVersion >= 90300)
                ExecuteSqlStatement(AH, "SET lock_timeout = 0");
+       if (AH->remoteVersion >= 90600)
+               ExecuteSqlStatement(AH, "SET idle_in_transaction_session_timeout = 0");
 
        /*
         * Quote all identifiers, if requested.