From 5ce785a5617aa9ab38d4a414f1a927d8de292abf Mon Sep 17 00:00:00 2001 From: Aleksander Alekseev Date: Mon, 16 Jan 2023 12:49:39 +0300 Subject: [PATCH v2 3/4] Fix the message in case of exceeding xidWarnLimit Previously the message said that the user should execute VACCUM in order to prevent the database shutdown. This gave a wrong impression that the entire database may become unavailable. This is not what happens though. Rather the system refuses to allocate new XIDs. From the user perspective it looks like entering a read-only mode, similarly to what the user sees on hot standby replicas. This patch changes the message accordingly. Author: Aleksander Alekseev Reviewed-by: TODO FIXME Discussion: https://postgr.es/m/CAJ7c6TM2D277U2wH8X78kg8pH3tdUqebV3_JCJqAkYQFHCFzeg@mail.gmail.com --- doc/src/sgml/maintenance.sgml | 2 +- src/backend/access/transam/varsup.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/src/sgml/maintenance.sgml b/doc/src/sgml/maintenance.sgml index 48330605c7..d21675fac9 100644 --- a/doc/src/sgml/maintenance.sgml +++ b/doc/src/sgml/maintenance.sgml @@ -655,7 +655,7 @@ SELECT datname, age(datfrozenxid) FROM pg_database; WARNING: database "mydb" must be vacuumed within 39985967 transactions -HINT: To avoid a database shutdown, execute a database-wide VACUUM in that database. +HINT: To prevent entering read-only mode, execute a database-wide VACUUM in that database. (A manual VACUUM should fix the problem, as suggested by the diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c index fece6cf31b..485d8ebf81 100644 --- a/src/backend/access/transam/varsup.c +++ b/src/backend/access/transam/varsup.c @@ -148,14 +148,14 @@ GetNewTransactionId(bool isSubXact) (errmsg("database \"%s\" must be vacuumed within %u transactions", oldest_datname, xidWrapLimit - xid), - errhint("To avoid a database shutdown, execute a database-wide VACUUM in that database.\n" + errhint("To prevent entering read-only mode, execute a database-wide VACUUM in that database.\n" "You might also need to commit or roll back old prepared transactions, or drop stale replication slots."))); else ereport(WARNING, (errmsg("database with OID %u must be vacuumed within %u transactions", oldest_datoid, xidWrapLimit - xid), - errhint("To avoid a database shutdown, execute a database-wide VACUUM in that database.\n" + errhint("To prevent entering read-only mode, execute a database-wide VACUUM in that database.\n" "You might also need to commit or roll back old prepared transactions, or drop stale replication slots."))); } @@ -463,14 +463,14 @@ SetTransactionIdLimit(TransactionId oldest_datfrozenxid, Oid oldest_datoid) (errmsg("database \"%s\" must be vacuumed within %u transactions", oldest_datname, xidWrapLimit - curXid), - errhint("To avoid a database shutdown, execute a database-wide VACUUM in that database.\n" + errhint("To prevent entering read-only mode, execute a database-wide VACUUM in that database.\n" "You might also need to commit or roll back old prepared transactions, or drop stale replication slots."))); else ereport(WARNING, (errmsg("database with OID %u must be vacuumed within %u transactions", oldest_datoid, xidWrapLimit - curXid), - errhint("To avoid a database shutdown, execute a database-wide VACUUM in that database.\n" + errhint("To prevent entering read-only mode, execute a database-wide VACUUM in that database.\n" "You might also need to commit or roll back old prepared transactions, or drop stale replication slots."))); } } -- 2.39.0