Skip to content

Commit 2406c4e

Browse files
committed
Reword messages about impending (M)XID exhaustion.
First, we shouldn't recommend switching to single-user mode, because that's terrible advice. Especially on newer versions where VACUUM will enter emergency mode when nearing (M)XID exhaustion, it's perfectly fine to just VACUUM in multi-user mode. Doing it that way is less disruptive and avoids disabling the safeguards that prevent actual wraparound, so recommend that instead. Second, be more precise about what is going to happen (when we're nearing the limits) or what is happening (when we actually hit them). The database doesn't shut down, nor does it refuse all commands. It refuses commands that assign whichever of XIDs and MXIDs are nearly exhausted. No back-patch. The existing hint that advises going to single-user mode is sufficiently awful advice that removing it or changing it might be justifiable even though we normally avoid changing user-facing messages in back-branches, but I (rhaas) felt that it was better to be more conservative and limit this fix to master only. Aside from the usual risk of breaking translations, people might be used to the existing message, or even have monitoring scripts that look for it. Alexander Alekseev, John Naylor, Robert Haas, reviewed at various times by Peter Geoghegan, Hannu Krosing, and Andres Freund. Discussion: http://postgr.es/m/CA+TgmoZBg95FiR9wVQPAXpGPRkacSt2okVge+PKPPFppN7sfnQ@mail.gmail.com
1 parent a1a5da8 commit 2406c4e

File tree

3 files changed

+16
-15
lines changed

3 files changed

+16
-15
lines changed

doc/src/sgml/maintenance.sgml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ SELECT datname, age(datfrozenxid) FROM pg_database;
656656

657657
<programlisting>
658658
WARNING: database "mydb" must be vacuumed within 39985967 transactions
659-
HINT: To avoid a database shutdown, execute a database-wide VACUUM in that database.
659+
HINT: To avoid XID assignment failures, execute a database-wide VACUUM in that database.
660660
</programlisting>
661661

662662
(A manual <command>VACUUM</command> should fix the problem, as suggested by the
@@ -667,16 +667,17 @@ HINT: To avoid a database shutdown, execute a database-wide VACUUM in that data
667667
there are fewer than three million transactions left until wraparound:
668668

669669
<programlisting>
670-
ERROR: database is not accepting commands to avoid wraparound data loss in database "mydb"
671-
HINT: Stop the postmaster and vacuum that database in single-user mode.
670+
ERROR: database is not accepting commands that assign new XIDs to avoid wraparound data loss in database "mydb"
671+
HINT: Execute a database-wide VACUUM in that database.
672672
</programlisting>
673673

674674
In this condition any transactions already in progress can continue,
675675
but only read-only transactions can be started. Operations that
676676
modify database records or truncate relations will fail.
677677
The <command>VACUUM</command> command can still be run normally.
678-
Contrary to what the hint states, it is not necessary or desirable to stop the
679-
postmaster or enter single user-mode in order to restore normal operation.
678+
Note that, contrary to what was sometimes recommended in earlier releases,
679+
it is not necessary or desirable to stop the postmaster or enter single
680+
user-mode in order to restore normal operation.
680681
Instead, follow these steps:
681682

682683
<orderedlist>

src/backend/access/transam/multixact.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2335,7 +2335,7 @@ SetMultiXactIdLimit(MultiXactId oldest_datminmxid, Oid oldest_datoid,
23352335
multiWrapLimit - curMulti,
23362336
oldest_datname,
23372337
multiWrapLimit - curMulti),
2338-
errhint("To avoid a database shutdown, execute a database-wide VACUUM in that database.\n"
2338+
errhint("To avoid MultiXactId assignment failures, execute a database-wide VACUUM in that database.\n"
23392339
"You might also need to commit or roll back old prepared transactions, or drop stale replication slots.")));
23402340
else
23412341
ereport(WARNING,
@@ -2344,7 +2344,7 @@ SetMultiXactIdLimit(MultiXactId oldest_datminmxid, Oid oldest_datoid,
23442344
multiWrapLimit - curMulti,
23452345
oldest_datoid,
23462346
multiWrapLimit - curMulti),
2347-
errhint("To avoid a database shutdown, execute a database-wide VACUUM in that database.\n"
2347+
errhint("To avoid MultiXactId assignment failures, execute a database-wide VACUUM in that database.\n"
23482348
"You might also need to commit or roll back old prepared transactions, or drop stale replication slots.")));
23492349
}
23502350
}

src/backend/access/transam/varsup.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,16 +126,16 @@ GetNewTransactionId(bool isSubXact)
126126
if (oldest_datname)
127127
ereport(ERROR,
128128
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
129-
errmsg("database is not accepting commands to avoid wraparound data loss in database \"%s\"",
129+
errmsg("database is not accepting commands that assign new XIDs to avoid wraparound data loss in database \"%s\"",
130130
oldest_datname),
131-
errhint("Stop the postmaster and vacuum that database in single-user mode.\n"
131+
errhint("Execute a database-wide VACUUM in that database.\n"
132132
"You might also need to commit or roll back old prepared transactions, or drop stale replication slots.")));
133133
else
134134
ereport(ERROR,
135135
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
136-
errmsg("database is not accepting commands to avoid wraparound data loss in database with OID %u",
136+
errmsg("database is not accepting commands that assign new XIDs to avoid wraparound data loss in database with OID %u",
137137
oldest_datoid),
138-
errhint("Stop the postmaster and vacuum that database in single-user mode.\n"
138+
errhint("Execute a database-wide VACUUM in that database.\n"
139139
"You might also need to commit or roll back old prepared transactions, or drop stale replication slots.")));
140140
}
141141
else if (TransactionIdFollowsOrEquals(xid, xidWarnLimit))
@@ -148,14 +148,14 @@ GetNewTransactionId(bool isSubXact)
148148
(errmsg("database \"%s\" must be vacuumed within %u transactions",
149149
oldest_datname,
150150
xidWrapLimit - xid),
151-
errhint("To avoid a database shutdown, execute a database-wide VACUUM in that database.\n"
151+
errhint("To avoid XID assignment failures, execute a database-wide VACUUM in that database.\n"
152152
"You might also need to commit or roll back old prepared transactions, or drop stale replication slots.")));
153153
else
154154
ereport(WARNING,
155155
(errmsg("database with OID %u must be vacuumed within %u transactions",
156156
oldest_datoid,
157157
xidWrapLimit - xid),
158-
errhint("To avoid a database shutdown, execute a database-wide VACUUM in that database.\n"
158+
errhint("To avoid XID assignment failures, execute a database-wide VACUUM in that database.\n"
159159
"You might also need to commit or roll back old prepared transactions, or drop stale replication slots.")));
160160
}
161161

@@ -463,14 +463,14 @@ SetTransactionIdLimit(TransactionId oldest_datfrozenxid, Oid oldest_datoid)
463463
(errmsg("database \"%s\" must be vacuumed within %u transactions",
464464
oldest_datname,
465465
xidWrapLimit - curXid),
466-
errhint("To avoid a database shutdown, execute a database-wide VACUUM in that database.\n"
466+
errhint("To avoid XID assignment failures, execute a database-wide VACUUM in that database.\n"
467467
"You might also need to commit or roll back old prepared transactions, or drop stale replication slots.")));
468468
else
469469
ereport(WARNING,
470470
(errmsg("database with OID %u must be vacuumed within %u transactions",
471471
oldest_datoid,
472472
xidWrapLimit - curXid),
473-
errhint("To avoid a database shutdown, execute a database-wide VACUUM in that database.\n"
473+
errhint("To avoid XID assignment failures, execute a database-wide VACUUM in that database.\n"
474474
"You might also need to commit or roll back old prepared transactions, or drop stale replication slots.")));
475475
}
476476
}

0 commit comments

Comments
 (0)