Re: enhance wraparound warnings

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: wenhui qiu <qiuwenhuifx(at)gmail(dot)com>, Shinya Kato <shinya11(dot)kato(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: enhance wraparound warnings
Date: 2026-06-19 18:13:23
Message-ID: CAHGQGwHWZTsR6bjdfpa+pOkBPjoXXm2LuJ+5nh+CvdyqEASHcQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Mar 21, 2026 at 4:16 AM Nathan Bossart <nathandbossart(at)gmail(dot)com> wrote:
>
> On Mon, Mar 09, 2026 at 08:08:54PM +0800, wenhui qiu wrote:
> > Thank you for working on this. The path LGTM,...
>
> Thanks for looking. Committed.

Thanks for working on this feature! I have one comment.

ereport(WARNING,
(errmsg("database \"%s\" must be vacuumed within %u transactions",
oldest_datname,
xidWrapLimit - xid),
+ errdetail("Approximately %.2f%% of transaction IDs are available for use.",
+ (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.")));

The new DETAIL messages for XID and MultiXactId wraparound warnings
seem misleading.

The percentage is calculated as (xidWrapLimit - xid) divided by half
of the ID space. This represents the remaining ID space before wraparound,
not the percentage of IDs that are still available for use. Since
PostgreSQL stops assigning new XIDs/MultiXactIds at the stop limit
before reaching the wraparound limit, the current wording could be
interpreted as overstating how many IDs remain usable.

So, how about changing the wording to match the calculation? For example:

Approximately XX.XX% of transaction ID space remains before wraparound.

and similarly for MultiXactIds.

Regards,

--
Fujii Masao

Attachment Content-Type Size
v1-0001-Clarify-wraparound-warning-percentage-messages.patch application/octet-stream 7.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jacob Champion 2026-06-19 18:18:51 Re: PG20 Minimum Dependency Thread
Previous Message Tom Lane 2026-06-19 17:49:45 check_stack_depth() vs. tail-recursion optimization