From 37d758c78186e6848026a659ca1b35f94c49c248 Mon Sep 17 00:00:00 2001 From: "masao.fujii" Date: Sat, 20 Jun 2026 02:33:37 +0900 Subject: [PATCH v1] Clarify wraparound warning percentage messages Commit e646450e609 added DETAIL messages for XID and MultiXactId wraparound warnings describing the reported percentage as the IDs available for use. However, the percentage is actually calculated from the remaining distance to the wraparound limit, not the stop limit where new IDs are refused. As a result, the wording could be misinterpreted as meaning that the reported percentage of IDs can still be allocated. Update the wording to clarify that the reported percentage represents the remaining ID space before wraparound. --- doc/src/sgml/maintenance.sgml | 2 +- src/backend/access/transam/multixact.c | 8 ++++---- src/backend/access/transam/varsup.c | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/src/sgml/maintenance.sgml b/doc/src/sgml/maintenance.sgml index e341f165efd..a5a779e2e62 100644 --- a/doc/src/sgml/maintenance.sgml +++ b/doc/src/sgml/maintenance.sgml @@ -674,7 +674,7 @@ SELECT datname, age(datfrozenxid) FROM pg_database; WARNING: database "mydb" must be vacuumed within 99985967 transactions -DETAIL: Approximately 4.66% of transaction IDs are available for use. +DETAIL: Approximately 4.66% of transaction ID space remains before wraparound. HINT: To avoid XID assignment failures, execute a database-wide VACUUM in that database. diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c index 10cbc0d76bd..079f5967e74 100644 --- a/src/backend/access/transam/multixact.c +++ b/src/backend/access/transam/multixact.c @@ -1070,7 +1070,7 @@ GetNewMultiXactId(int nmembers, MultiXactOffset *offset) multiWrapLimit - result, oldest_datname, multiWrapLimit - result), - errdetail("Approximately %.2f%% of MultiXactIds are available for use.", + errdetail("Approximately %.2f%% of MultiXactId space remains before wraparound.", (double) (multiWrapLimit - result) / (MaxMultiXactId / 2) * 100), errhint("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."))); @@ -1081,7 +1081,7 @@ GetNewMultiXactId(int nmembers, MultiXactOffset *offset) multiWrapLimit - result, oldest_datoid, multiWrapLimit - result), - errdetail("Approximately %.2f%% of MultiXactIds are available for use.", + errdetail("Approximately %.2f%% of MultiXactId space remains before wraparound.", (double) (multiWrapLimit - result) / (MaxMultiXactId / 2) * 100), errhint("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."))); @@ -2208,7 +2208,7 @@ SetMultiXactIdLimit(MultiXactId oldest_datminmxid, Oid oldest_datoid) multiWrapLimit - curMulti, oldest_datname, multiWrapLimit - curMulti), - errdetail("Approximately %.2f%% of MultiXactIds are available for use.", + errdetail("Approximately %.2f%% of MultiXactId space remains before wraparound.", (double) (multiWrapLimit - curMulti) / (MaxMultiXactId / 2) * 100), errhint("To avoid MultiXactId assignment failures, 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."))); @@ -2219,7 +2219,7 @@ SetMultiXactIdLimit(MultiXactId oldest_datminmxid, Oid oldest_datoid) multiWrapLimit - curMulti, oldest_datoid, multiWrapLimit - curMulti), - errdetail("Approximately %.2f%% of MultiXactIds are available for use.", + errdetail("Approximately %.2f%% of MultiXactId space remains before wraparound.", (double) (multiWrapLimit - curMulti) / (MaxMultiXactId / 2) * 100), errhint("To avoid MultiXactId assignment failures, 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."))); diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c index dc5e32d86f3..e0b280665cf 100644 --- a/src/backend/access/transam/varsup.c +++ b/src/backend/access/transam/varsup.c @@ -166,7 +166,7 @@ GetNewTransactionId(bool isSubXact) (errmsg("database \"%s\" must be vacuumed within %u transactions", oldest_datname, xidWrapLimit - xid), - errdetail("Approximately %.2f%% of transaction IDs are available for use.", + errdetail("Approximately %.2f%% of transaction ID space remains before wraparound.", (double) (xidWrapLimit - xid) / (MaxTransactionId / 2) * 100), errhint("To avoid transaction ID assignment failures, 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."))); @@ -175,7 +175,7 @@ GetNewTransactionId(bool isSubXact) (errmsg("database with OID %u must be vacuumed within %u transactions", oldest_datoid, xidWrapLimit - xid), - errdetail("Approximately %.2f%% of transaction IDs are available for use.", + errdetail("Approximately %.2f%% of transaction ID space remains before wraparound.", (double) (xidWrapLimit - xid) / (MaxTransactionId / 2) * 100), errhint("To avoid XID assignment failures, 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."))); @@ -485,7 +485,7 @@ SetTransactionIdLimit(TransactionId oldest_datfrozenxid, Oid oldest_datoid) (errmsg("database \"%s\" must be vacuumed within %u transactions", oldest_datname, xidWrapLimit - curXid), - errdetail("Approximately %.2f%% of transaction IDs are available for use.", + errdetail("Approximately %.2f%% of transaction ID space remains before wraparound.", (double) (xidWrapLimit - curXid) / (MaxTransactionId / 2) * 100), errhint("To avoid XID assignment failures, 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."))); @@ -494,7 +494,7 @@ SetTransactionIdLimit(TransactionId oldest_datfrozenxid, Oid oldest_datoid) (errmsg("database with OID %u must be vacuumed within %u transactions", oldest_datoid, xidWrapLimit - curXid), - errdetail("Approximately %.2f%% of transaction IDs are available for use.", + errdetail("Approximately %.2f%% of transaction ID space remains before wraparound.", (double) (xidWrapLimit - curXid) / (MaxTransactionId / 2) * 100), errhint("To avoid XID assignment failures, 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.53.0