Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit73d1bfd

Browse files
committed
Prevent autovacuum transactions from running in serializable mode.
Force the transaction isolation level to READ COMMITTED in autovacuumworker and launcher processes. There is no benefit to using a higherisolation level, and doing so could result in delaying foregroundtransactions (or maybe even causing unnecessary serialization failures?).Noted by Dan Ports.Also, make sure we disable zero_damaged_pages and statement_timeout inthe autovac launcher, not only workers. Now that the launcher can runtransactions, these settings could affect its behavior, and it seemslike the same arguments apply to the launcher as the workers.
1 parent99f5e47 commit73d1bfd

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

‎src/backend/postmaster/autovacuum.c

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,27 @@ AutoVacLauncherMain(int argc, char *argv[])
529529
/* must unblock signals before calling rebuild_database_list */
530530
PG_SETMASK(&UnBlockSig);
531531

532+
/*
533+
* Force zero_damaged_pages OFF in the autovac process, even if it is set
534+
* in postgresql.conf.We don't really want such a dangerous option being
535+
* applied non-interactively.
536+
*/
537+
SetConfigOption("zero_damaged_pages","false",PGC_SUSET,PGC_S_OVERRIDE);
538+
539+
/*
540+
* Force statement_timeout to zero to avoid a timeout setting from
541+
* preventing regular maintenance from being executed.
542+
*/
543+
SetConfigOption("statement_timeout","0",PGC_SUSET,PGC_S_OVERRIDE);
544+
545+
/*
546+
* Force default_transaction_isolation to READ COMMITTED. We don't
547+
* want to pay the overhead of serializable mode, nor add any risk
548+
* of causing deadlocks or delaying other transactions.
549+
*/
550+
SetConfigOption("default_transaction_isolation","read committed",
551+
PGC_SUSET,PGC_S_OVERRIDE);
552+
532553
/* in emergency mode, just start a worker and go away */
533554
if (!AutoVacuumingActive())
534555
{
@@ -1530,13 +1551,22 @@ AutoVacWorkerMain(int argc, char *argv[])
15301551
*/
15311552
SetConfigOption("statement_timeout","0",PGC_SUSET,PGC_S_OVERRIDE);
15321553

1554+
/*
1555+
* Force default_transaction_isolation to READ COMMITTED. We don't
1556+
* want to pay the overhead of serializable mode, nor add any risk
1557+
* of causing deadlocks or delaying other transactions.
1558+
*/
1559+
SetConfigOption("default_transaction_isolation","read committed",
1560+
PGC_SUSET,PGC_S_OVERRIDE);
1561+
15331562
/*
15341563
* Force synchronous replication off to allow regular maintenance even if
15351564
* we are waiting for standbys to connect. This is important to ensure we
15361565
* aren't blocked from performing anti-wraparound tasks.
15371566
*/
15381567
if (synchronous_commit>SYNCHRONOUS_COMMIT_LOCAL_FLUSH)
1539-
SetConfigOption("synchronous_commit","local",PGC_SUSET,PGC_S_OVERRIDE);
1568+
SetConfigOption("synchronous_commit","local",
1569+
PGC_SUSET,PGC_S_OVERRIDE);
15401570

15411571
/*
15421572
* Get the info about the database we're going to work on.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp