From 4633ec986fce07c22ca094212c86ca16d5c9c887 Mon Sep 17 00:00:00 2001 From: Pavel Borisov Date: Tue, 4 Apr 2023 13:26:14 +0400 Subject: [PATCH v5 2/3] This recommendation is outdated for some time now. A regular VACUUM works just fine. Additionally add an explicit note against using a single-user mode for people who may potentially miss this change. Author: Aleksander Alekseev Reported-by: Hannu Krosing Reviewed-by: John Naylor Discussion: https://postgr.es/m/CAJ7c6TM2D277U2wH8X78kg8pH3tdUqebV3_JCJqAkYQFHCFzeg@mail.gmail.com Discussion: https://postgr.es/m/CAMT0RQTmRj_Egtmre6fbiMA9E2hM3BsLULiV8W00stwa3URvzA%40mail.gmail.com --- doc/src/sgml/maintenance.sgml | 20 ++++++++++++++------ src/backend/access/transam/varsup.c | 4 ++-- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/doc/src/sgml/maintenance.sgml b/doc/src/sgml/maintenance.sgml index b7254344ee0..66456b5e462 100644 --- a/doc/src/sgml/maintenance.sgml +++ b/doc/src/sgml/maintenance.sgml @@ -668,7 +668,7 @@ HINT: To prevent entering read-only mode, execute a database-wide VACUUM in tha ERROR: database can't generate new XIDs to avoid wraparound data loss in database "mydb" -HINT: Stop the postmaster and vacuum that database in single-user mode. +HINT: VACUUM that database. In this condition any transactions already started can continue. @@ -676,13 +676,21 @@ HINT: Stop the postmaster and vacuum that database in single-user mode. The three-million-transaction safety margin exists to let the administrator recover without data loss, by manually executing the - required VACUUM commands. However - the only way to do this is to stop the server and start the server in single-user - mode to execute VACUUM. See the - reference page for details about using - single-user mode. + required VACUUM commands. + + + Previously it was required to stop the postmaster and + VACUUM the database in a single-user mode. There is no + need to use a single-user mode anymore unless the resolution needs to be + speeded up by performing TRUNCATE or + DROP. Except for this scenario it's strongly advised + against using a single-user mode: it requires downtime, can't be monitored, + disables replication, disables safeguards against wraparound, etc. + + + Multixacts and Wraparound diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c index bd27576bd58..f039c98cd09 100644 --- a/src/backend/access/transam/varsup.c +++ b/src/backend/access/transam/varsup.c @@ -128,14 +128,14 @@ GetNewTransactionId(bool isSubXact) (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), errmsg("database can't generate new XIDs to avoid wraparound data loss in database \"%s\"", oldest_datname), - errhint("Stop the postmaster and vacuum that database in single-user mode.\n" + errhint("VACUUM that database.\n" "You might also need to commit or roll back old prepared transactions and drop stale replication slots."))); else ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), errmsg("database can't generate new XIDs to avoid wraparound data loss in database with OID %u", oldest_datoid), - errhint("Stop the postmaster and vacuum that database in single-user mode.\n" + errhint("VACUUM that database.\n" "You might also need to commit or roll back old prepared transactions and drop stale replication slots."))); } else if (TransactionIdFollowsOrEquals(xid, xidWarnLimit)) -- 2.37.1 (Apple Git-137.1)