Skip to content

Commit 8383486

Browse files
committed
Force idle_in_transaction_session_timeout off in pg_dump and autovacuum.
We disable statement_timeout and lock_timeout during dump and restore, to prevent any global settings that might exist from breaking routine backups. Commit c6dda1f 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>
1 parent f0688d6 commit 8383486

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

src/backend/postmaster/autovacuum.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -538,11 +538,13 @@ AutoVacLauncherMain(int argc, char *argv[])
538538
SetConfigOption("zero_damaged_pages", "false", PGC_SUSET, PGC_S_OVERRIDE);
539539

540540
/*
541-
* Force statement_timeout and lock_timeout to zero to avoid letting these
542-
* settings prevent regular maintenance from being executed.
541+
* Force settable timeouts off to avoid letting these settings prevent
542+
* regular maintenance from being executed.
543543
*/
544544
SetConfigOption("statement_timeout", "0", PGC_SUSET, PGC_S_OVERRIDE);
545545
SetConfigOption("lock_timeout", "0", PGC_SUSET, PGC_S_OVERRIDE);
546+
SetConfigOption("idle_in_transaction_session_timeout", "0",
547+
PGC_SUSET, PGC_S_OVERRIDE);
546548

547549
/*
548550
* Force default_transaction_isolation to READ COMMITTED. We don't want
@@ -1551,11 +1553,13 @@ AutoVacWorkerMain(int argc, char *argv[])
15511553
SetConfigOption("zero_damaged_pages", "false", PGC_SUSET, PGC_S_OVERRIDE);
15521554

15531555
/*
1554-
* Force statement_timeout and lock_timeout to zero to avoid letting these
1555-
* settings prevent regular maintenance from being executed.
1556+
* Force settable timeouts off to avoid letting these settings prevent
1557+
* regular maintenance from being executed.
15561558
*/
15571559
SetConfigOption("statement_timeout", "0", PGC_SUSET, PGC_S_OVERRIDE);
15581560
SetConfigOption("lock_timeout", "0", PGC_SUSET, PGC_S_OVERRIDE);
1561+
SetConfigOption("idle_in_transaction_session_timeout", "0",
1562+
PGC_SUSET, PGC_S_OVERRIDE);
15591563

15601564
/*
15611565
* Force default_transaction_isolation to READ COMMITTED. We don't want

src/bin/pg_dump/pg_backup_archiver.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2859,11 +2859,12 @@ _doSetFixedOutputState(ArchiveHandle *AH)
28592859
{
28602860
RestoreOptions *ropt = AH->public.ropt;
28612861

2862-
/* Disable statement_timeout since restore is probably slow */
2862+
/*
2863+
* Disable timeouts to allow for slow commands, idle parallel workers, etc
2864+
*/
28632865
ahprintf(AH, "SET statement_timeout = 0;\n");
2864-
2865-
/* Likewise for lock_timeout */
28662866
ahprintf(AH, "SET lock_timeout = 0;\n");
2867+
ahprintf(AH, "SET idle_in_transaction_session_timeout = 0;\n");
28672868

28682869
/* Select the correct character set encoding */
28692870
ahprintf(AH, "SET client_encoding = '%s';\n",

src/bin/pg_dump/pg_dump.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,6 +1022,8 @@ setup_connection(Archive *AH, const char *dumpencoding,
10221022
ExecuteSqlStatement(AH, "SET statement_timeout = 0");
10231023
if (AH->remoteVersion >= 90300)
10241024
ExecuteSqlStatement(AH, "SET lock_timeout = 0");
1025+
if (AH->remoteVersion >= 90600)
1026+
ExecuteSqlStatement(AH, "SET idle_in_transaction_session_timeout = 0");
10251027

10261028
/*
10271029
* Quote all identifiers, if requested.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy