diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2009-04-23 00:23:46 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2009-04-23 00:23:46 +0000 |
commit | 8d4f2ecd41312e57422901952cbad234d293060b (patch) | |
tree | f3345b5dcf1c8980bfe59da77186b332500ff064 /src/backend/access/transam/varsup.c | |
parent | bae8102f52863bdb29b5c5e1ee7e27a8b0f5b9c7 (diff) |
Change the default value of max_prepared_transactions to zero, and add
documentation warnings against setting it nonzero unless active use of
prepared transactions is intended and a suitable transaction manager has been
installed. This should help to prevent the type of scenario we've seen
several times now where a prepared transaction is forgotten and eventually
causes severe maintenance problems (or even anti-wraparound shutdown).
The only real reason we had the default be nonzero in the first place was to
support regression testing of the feature. To still be able to do that,
tweak pg_regress to force a nonzero value during "make check". Since we
cannot force a nonzero value in "make installcheck", add a variant regression
test "expected" file that shows the results that will be obtained when
max_prepared_transactions is zero.
Also, extend the HINT messages for transaction wraparound warnings to mention
the possibility that old prepared transactions are causing the problem.
All per today's discussion.
Diffstat (limited to 'src/backend/access/transam/varsup.c')
-rw-r--r-- | src/backend/access/transam/varsup.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c index 5c0e6279877..029b2f2deb7 100644 --- a/src/backend/access/transam/varsup.c +++ b/src/backend/access/transam/varsup.c @@ -6,7 +6,7 @@ * Copyright (c) 2000-2009, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/transam/varsup.c,v 1.83 2009/01/01 17:23:36 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/transam/varsup.c,v 1.84 2009/04/23 00:23:45 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -86,14 +86,16 @@ GetNewTransactionId(bool isSubXact) (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), errmsg("database is not accepting commands to avoid wraparound data loss in database \"%s\"", NameStr(ShmemVariableCache->limit_datname)), - errhint("Stop the postmaster and use a standalone backend to vacuum database \"%s\".", + errhint("Stop the postmaster and use a standalone backend to vacuum database \"%s\".\n" + "You might also need to commit or roll back old prepared transactions.", NameStr(ShmemVariableCache->limit_datname)))); else if (TransactionIdFollowsOrEquals(xid, ShmemVariableCache->xidWarnLimit)) ereport(WARNING, (errmsg("database \"%s\" must be vacuumed within %u transactions", NameStr(ShmemVariableCache->limit_datname), ShmemVariableCache->xidWrapLimit - xid), - errhint("To avoid a database shutdown, execute a database-wide VACUUM in \"%s\".", + errhint("To avoid a database shutdown, execute a database-wide VACUUM in \"%s\".\n" + "You might also need to commit or roll back old prepared transactions.", NameStr(ShmemVariableCache->limit_datname)))); } @@ -299,7 +301,8 @@ SetTransactionIdLimit(TransactionId oldest_datfrozenxid, (errmsg("database \"%s\" must be vacuumed within %u transactions", NameStr(*oldest_datname), xidWrapLimit - curXid), - errhint("To avoid a database shutdown, execute a database-wide VACUUM in \"%s\".", + errhint("To avoid a database shutdown, execute a database-wide VACUUM in \"%s\".\n" + "You might also need to commit or roll back old prepared transactions.", NameStr(*oldest_datname)))); } |