v2-0004-Don-t-recommend-running-VACUUM-in-a-single-user-m.patch
application/octet-stream
Filename: v2-0004-Don-t-recommend-running-VACUUM-in-a-single-user-m.patch
Type: application/octet-stream
Part: 2
Patch
Format: format-patch
Series: patch v2-0004
Subject: Don't recommend running VACUUM in a single-user mode when reaching xidStopLimit
| File | + | − |
|---|---|---|
| doc/src/sgml/maintenance.sgml | 2 | 6 |
| src/backend/access/transam/varsup.c | 3 | 5 |
From 7656a445b24914d402e00465de8491453c83c89d Mon Sep 17 00:00:00 2001
From: Aleksander Alekseev <aleksander@timescale.com>
Date: Mon, 16 Jan 2023 15:37:12 +0300
Subject: [PATCH v2 4/4] Don't recommend running VACUUM in a single-user mode
when reaching xidStopLimit
This recommendation is outdated for some time now. A regular VACUUM or
VACUUM FREEZE works just fine.
Author: Aleksander Alekseev
Reported-by: Hannu Krosing
Reviewed-by: TODO FIXME
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 | 8 ++------
src/backend/access/transam/varsup.c | 8 +++-----
2 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/doc/src/sgml/maintenance.sgml b/doc/src/sgml/maintenance.sgml
index d21675fac9..3b78098232 100644
--- a/doc/src/sgml/maintenance.sgml
+++ b/doc/src/sgml/maintenance.sgml
@@ -667,7 +667,7 @@ HINT: To prevent entering read-only mode, execute a database-wide VACUUM in tha
<programlisting>
ERROR: database is not accepting commands that 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 or VACUUM FREEZE that database.
</programlisting>
In this condition the system can still execute read-only transactions.
@@ -676,11 +676,7 @@ 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 <command>VACUUM</command> commands. However
- the only way to do this is to stop the server and start the server in single-user
- mode to execute <command>VACUUM</command>. See the
- <xref linkend="app-postgres"/> reference page for details about using
- single-user mode.
+ required <command>VACUUM</command> commands.
</para>
<sect3 id="vacuum-for-multixact-wraparound">
diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c
index 485d8ebf81..a79144d445 100644
--- a/src/backend/access/transam/varsup.c
+++ b/src/backend/access/transam/varsup.c
@@ -86,9 +86,7 @@ GetNewTransactionId(bool isSubXact)
*
* If we're past xidVacLimit, start trying to force autovacuum cycles.
* If we're past xidWarnLimit, start issuing warnings.
- * If we're past xidStopLimit, refuse to execute transactions, unless
- * we are running in single-user mode (which gives an escape hatch
- * to the DBA who somehow got past the earlier defenses).
+ * If we're past xidStopLimit, refuse to allocate new XIDs.
*
* Note that this coding also appears in GetNewMultiXactId.
*----------
@@ -128,14 +126,14 @@ GetNewTransactionId(bool isSubXact)
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
errmsg("database is not accepting commands that 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 or VACUUM FREEZE that database.\n"
"You might also need to commit or roll back old prepared transactions, or drop stale replication slots.")));
else
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
errmsg("database is not accepting commands that 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 or VACUUM FREEZE that database.\n"
"You might also need to commit or roll back old prepared transactions, or drop stale replication slots.")));
}
else if (TransactionIdFollowsOrEquals(xid, xidWarnLimit))
--
2.39.0