Re: enhance wraparound warnings
Re: enhance wraparound warnings
От:
Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Дата:
Hello,
At Fri, 26 Jun 2026 09:51:16 +0900, Fujii Masao wrote in
> On Fri, Jun 26, 2026 at 2:19 AM Bharath Rupireddy
> wrote:
> > The use there is referring to the whole set of transaction IDs and how
> > one can visualize the use of them - so "XID space" in that context
> > seems fine to me.
> >
> > But the wraparound warnings read better when they say how many more
> > transaction IDs are left:
> >
> > + errdetail("Approximately %.2f%% of MultiXactIds remain before wraparound.",
> > + errdetail("Approximately %.2f%% of transaction IDs remain before wraparound.",
>
> Okay, I've updated the patches as suggested. The updated patches are attached.
I'm not sure I'm following this correctly, but the explanation above
sounded to me as if the warning should report the number of IDs
remaining before wraparound, e.g. "Approximately N MultiXactIds remain
before wraparound", so I'm a bit confused by the proposed wording.
> + errdetail("Approximately %.2f%% of MultiXactIds remain before wraparound.",
The attached patch adopts that wording. However, I'm not sure how to
interpret it. The value is still expressed as a percentage, but it is
no longer clear what that percentage is relative to.
Whichever approach we choose, I think the wording should be explicit.
If the value is reported as a percentage, then something like "x.xx%
of MultiXactId space remains" seems clearer to me. If it is reported
as a count, then "N MultiXactIds remain" would make more sense.
Regards,
--
Kyotaro Horiguchi
NTT Open Source Software Center
Re: enhance wraparound warnings
От:
Yugo Nagata <nagata@sraoss.co.jp>
Дата:
On Fri, 26 Jun 2026 15:18:25 -0700
Bharath Rupireddy wrote:
> Hi,
>
> On Fri, Jun 26, 2026 at 11:06 AM Nathan Bossart
> wrote:
> >
> > On Fri, Jun 26, 2026 at 10:55:39AM +0900, Kyotaro Horiguchi wrote:
> > > I'm not sure I'm following this correctly, but the explanation above
> > > sounded to me as if the warning should report the number of IDs
> > > remaining before wraparound, e.g. "Approximately N MultiXactIds remain
> > > before wraparound", so I'm a bit confused by the proposed wording.
> >
> > We already report the number of IDs remaining in the WARNING message. In
> > v19, I've added a DETAIL message that also reports the percentage
> > remaining, with the hope that it makes the urgency clearer.
>
> Yes. For example: WARNING: database "mydb" must be vacuumed within
> 99985967 transactions
>
> > >> + errdetail("Approximately %.2f%% of MultiXactIds remain before wraparound.",
> > >
> > > The attached patch adopts that wording. However, I'm not sure how to
> > > interpret it. The value is still expressed as a percentage, but it is
> > > no longer clear what that percentage is relative to.
> > >
> > > Whichever approach we choose, I think the wording should be explicit.
> > > If the value is reported as a percentage, then something like "x.xx%
> > > of MultiXactId space remains" seems clearer to me. If it is reported
> > > as a count, then "N MultiXactIds remain" would make more sense.
> >
> > I find both "percentage of IDs remaining" and "percentage of ID space
> > remaining" equally clear and have no strong opinion on the matter.
>
> My initial comment was that "IDs remaining" reads more naturally to me
> than "ID space remaining," but I'm happy to go with the majority here.
> IMHO, no need to spend more cycles on this.
I don't have a strong preference, but I slightly lean toward keeping "space".
The explicit denominator would make the percentage easier to interpret, and
"space" itself doesn't seem particularly confusing to me.
I have a comment of 0002 patch.
being able to advance the database's datfrozenxid.)
- If these warnings are ignored, the system will refuse to assign new XIDs once
+ If these warnings are ignored, the system will refuse to assign new transaction IDs once
there are fewer than three million transactions left until wraparound:
This also replaces "XIDs" with "transaction IDs" in the surrounding explanatory text.
I'm not sure this change is necessary, since that text is not part of the example output,
and "XID" is already used elsewhere in the same paragraph.
Regards,
Yugo Nagata
--
Yugo Nagata
Re: enhance wraparound warnings
От:
Nathan Bossart <nathandbossart@gmail.com>
Дата:
On Wed, Feb 18, 2026 at 04:16:16PM +0900, Shinya Kato wrote: > On Sat, Nov 15, 2025 at 2:05 AM Nathan Bossart wrote: >> I don't know about you, but I start getting antsy around a quarter tank. >> In any case, I'm told that even 40M transactions aren't enough time to >> react these days. Attached are a few patches to enhance the wraparound >> warnings. > > Thank you for the patch! Thanks for reviewing. > I don't have a strong opinion on whether 100M is the right value, but > I noticed a documentation issue in 0002. > > > WARNING: database "mydb" must be vacuumed within 39985967 transactions > DETAIL: Approximately 1.86% of transaction IDs are available for use. > HINT: To avoid XID assignment failures, execute a database-wide > VACUUM in that database. > > > In maintenance.sgml, above "39985967" and "1.86%" should be updated. Fixed. > I'm not sure 0003 is worth the added complexity. It adds a new field > to TransamVariablesData and a modulo check in GetNewTransactionId(), > which is a hot path. DBAs who need early warning can already monitor > age(datfrozenxid) with more flexible thresholds. Yeah, looking at this one again, I'm less sure it's worth pursuing. I've removed it. -- nathan
Re: enhance wraparound warnings
От:
Nathan Bossart <nathandbossart@gmail.com>
Дата:
Barring additional feedback or objections, I'm planning to commit this in the next week or two. -- nathan
Re: enhance wraparound warnings
От:
Nathan Bossart <nathandbossart@gmail.com>
Дата:
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. > ...But I have a small request,There > are many reasons why the table's age can’t be frozen. Now have a path that > can report the reason to users(https://commitfest.postgresql.org/patch/6188/). > Would you be interested in reviewing it? I think we should tell users the > root cause of why the age can’t be reduced, so they can clearly understand > where the issue is.I think we should not only tell users that the XID is > close to wraparound, but also report why this causes the table‘s age to be > unable to freeze. Thanks for alerting me to this patch. -- nathan
Re: enhance wraparound warnings
От:
Nathan Bossart <nathandbossart@gmail.com>
Дата:
On Fri, Jun 26, 2026 at 10:55:39AM +0900, Kyotaro Horiguchi wrote:
> I'm not sure I'm following this correctly, but the explanation above
> sounded to me as if the warning should report the number of IDs
> remaining before wraparound, e.g. "Approximately N MultiXactIds remain
> before wraparound", so I'm a bit confused by the proposed wording.
We already report the number of IDs remaining in the WARNING message. In
v19, I've added a DETAIL message that also reports the percentage
remaining, with the hope that it makes the urgency clearer.
>> + errdetail("Approximately %.2f%% of MultiXactIds remain before wraparound.",
>
> The attached patch adopts that wording. However, I'm not sure how to
> interpret it. The value is still expressed as a percentage, but it is
> no longer clear what that percentage is relative to.
>
> Whichever approach we choose, I think the wording should be explicit.
> If the value is reported as a percentage, then something like "x.xx%
> of MultiXactId space remains" seems clearer to me. If it is reported
> as a count, then "N MultiXactIds remain" would make more sense.
I find both "percentage of IDs remaining" and "percentage of ID space
remaining" equally clear and have no strong opinion on the matter.
--
nathan
Re: enhance wraparound warnings
От:
Nathan Bossart <nathandbossart@gmail.com>
Дата:
On Sat, Jun 20, 2026 at 03:13:23AM +0900, Fujii Masao wrote: > 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. That seems reasonable to me, thanks. -- nathan
enhance wraparound warnings
От:
Nathan Bossart <nathandbossart@gmail.com>
Дата:
varsup.c has the following comment: /* * We'll start complaining loudly when we get within 40M transactions of * data loss. This is kind of arbitrary, but if you let your gas gauge * get down to 2% of full, would you be looking for the next gas station? * We need to be fairly liberal about this number because there are lots * of scenarios where most transactions are done by automatic clients that * won't pay attention to warnings. (No, we're not gonna make this * configurable. If you know enough to configure it, you know enough to * not get in this kind of trouble in the first place.) */ I don't know about you, but I start getting antsy around a quarter tank. In any case, I'm told that even 40M transactions aren't enough time to react these days. Attached are a few patches to enhance the wraparound warnings. * 0001 adds a "percent remaining" detail message to the existing WARNING. The idea is that "1.86% of transaction IDs" is both easier to understand and better indicates urgency than "39985967 transactions". * 0002 bumps the warning limit from 40M to 100M to give folks some more time to react. * 0003 adds an early warning system for when fewer than 500M transactions remain. This system sends a LOG only to the server log every 1M transactions. The hope is that this gets someone's attention sooner without flooding the application and server log. Thoughts? -- nathan
Re: enhance wraparound warnings
От:
Nathan Bossart <nathandbossart@gmail.com>
Дата:
On Fri, Dec 12, 2025 at 10:59:53AM +0800, Chao Li wrote:
> I just reviewed the patch. My comments are mainly in 0001, and a few nits
> on 0003. For 0002, the code change is quite straightforward, I am not
> sure the value bumping to has been discussed.
Thanks!
> Where "(MaxTransactionId >> 1)” has the same value as PG_INT32_MAX. But
> if one day xid is changed to 64 bits, that code doesn’t need to updated,
> while these patched code will need to be updated.
>
> So, can we define a const in transom.h like:
> ```
> #define MaxTransactionId ((TransactionId) 0xFFFFFFFF)
> #define WrapAroundWindow (MaxTransactionId>>1)
> ```
>
> And use WrapAroundWindow in all places.
I think I'd rather just open-code the (MaxTransactionId / 2) here. I'm not
too concerned about 64-bit transaction IDs (there's a lot more than this to
change for that), but it does seem like a good idea to be consistent with
nearby code.
> ```
> + errdetail("Approximately %.2f%% of MultiXactIds are available for use.",
> ```
>
> “%.2f%%” shows only 2 digits after dot. xidWrapLimit is roughly 2B, when
> remaining goes down to 107374, it will shows “0.00%”. IMO, when remaining
> is a large number, percentage makes more sense, while an exact number is
> clearer when the number is relatively small. So, can we show both
> percentage and exact number? Or shows the exact number when percentage is
> 0.00%?
The errmsg part should already show the exact number of IDs remaining.
> ```
> + xidLogLimit = xidWrapLimit - 500000000;
> ```
>
> Instead of hardcode 500M, do we want to consider
> autovacuum_freeze_max_age? If a deployment sets autovacuum_freeze_max_age
> > 500M, then vacuum would be triggered first, then this log can get kinda
> non-intuitive. But if a vacuum cannot freeze anything tuple, then this
> log will still make sense. I am not sure. Maybe not a real problem.
IMHO we should still emit warnings about imminent wraparound even if
autovacuum_freeze_max_age is set to totally-inadvisable values. I think
the behavior you are describing only happens if users set it to north of
1.6B.
--
nathan
Re: enhance wraparound warnings
От:
Chao Li <li.evan.chao@gmail.com>
Дата:
Hi Nathan,
I just reviewed the patch. My comments are mainly in 0001, and a few nits on 0003. For 0002, the code change is quite straightforward, I am not sure the value bumping to has been discussed.
> On Dec 12, 2025, at 04:28, Nathan Bossart wrote:
>
> rebased
>
> --
> nathan
>
1 - 0001
```
+ (double) (multiWrapLimit - result) / PG_INT32_MAX * 100),
```
I don’t feel good with using PG_INT32_MAX as denominator, though the value is correct.
Looking at the code of how xidWrapLimit is calculated:
```
/*
* The place where we actually get into deep trouble is halfway around
* from the oldest potentially-existing XID. (This calculation is
* probably off by one or two counts, because the special XIDs reduce the
* size of the loop a little bit. But we throw in plenty of slop below,
* so it doesn't matter.)
*/
xidWrapLimit = oldest_datfrozenxid + (MaxTransactionId >> 1);
if (xidWrapLimit < FirstNormalTransactionId)
xidWrapLimit += FirstNormalTransactionId;
```
Where "(MaxTransactionId >> 1)” has the same value as PG_INT32_MAX. But if one day xid is changed to 64 bits, that code doesn’t need to updated, while these patched code will need to be updated.
So, can we define a const in transom.h like:
```
#define MaxTransactionId ((TransactionId) 0xFFFFFFFF)
#define WrapAroundWindow (MaxTransactionId>>1)
```
And use WrapAroundWindow in all places.
2 - 0001
```
+ errdetail("Approximately %.2f%% of MultiXactIds are available for use.",
```
“%.2f%%” shows only 2 digits after dot. xidWrapLimit is roughly 2B, when remaining goes down to 107374, it will shows “0.00%”. IMO, when remaining is a large number, percentage makes more sense, while an exact number is clearer when the number is relatively small. So, can we show both percentage and exact number? Or shows the exact number when percentage is 0.00%?
3 - 0001
```
WARNING: database "mydb" must be vacuumed within 39985967 transactions
+DETAIL: Approximately 1.86% of transactions IDs are available for use.
```
Typo: " transactions IDs” => " transaction IDs"
4 - 0003
```
Subject: [PATCH v2 3/3] Perodically emit server logs when fewer than 500M
```
Typo: Perodically => Periodically
5 - 0003
```
+ xidLogLimit = xidWrapLimit - 500000000;
```
Instead of hardcode 500M, do we want to consider autovacuum_freeze_max_age? If a deployment sets autovacuum_freeze_max_age > 500M, then vacuum would be triggered first, then this log can get kinda non-intuitive. But if a vacuum cannot freeze anything tuple, then this log will still make sense. I am not sure. Maybe not a real problem.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
Re: enhance wraparound warnings
От:
wenhui qiu <qiuwenhuifx@gmail.com>
Дата:
Hi Nathan Bossart
> Barring additional feedback or objections, I'm planning to commit this in
> the next week or two.
> the next week or two.
Thank you for working on this. The path LGTM,But I have a small request,There are many reasons why the table's age can’t be frozen. Now have a path that can report the reason to users(https://commitfest.postgresql.org/patch/6188/). Would you be interested in reviewing it? I think we should tell users the root cause of why the age can’t be reduced, so they can clearly understand where the issue is.I think we should not only tell users that the XID is close to wraparound, but also report why this causes the table‘s age to be unable to freeze.
Thanks
On Sat, Mar 7, 2026 at 6:15 AM Nathan Bossart <nathandbossart@gmail.com> wrote:
Barring additional feedback or objections, I'm planning to commit this in
the next week or two.
--
nathan
Re: enhance wraparound warnings
От:
Fujii Masao <masao.fujii@gmail.com>
Дата:
On Wed, Jun 24, 2026 at 1:47 PM Bharath Rupireddy wrote: > I happened to quickly review these patches. Thanks for the review! > TBH, "transaction ID > space" and "MultiXactId space" seem a bit confusing because of the > word "space" - it reads fine without it. Is there a specific reason > for this wording? I was thinking "space" was appropriate here because the message is intended to express the percentage remaining before wraparound in the ID range. The documentation also uses expressions such as "normal XID space is ...". But I'm not a native English speaker, so this wording might be wrong. > Also, why not use "multixact IDs" instead of "MultiXactId"? The latter > reads like an internal structure name or such that might confuse users > reading the docs or error messages. I left "MultiXactId" unchanged because several existing log messages use that term. I don't have any strong objection to changing it to "multixact ID", which is already used in the documentation. However, if we do that, I think it's better update all log messages that use "MultiXactId" for consistency, probably as a separate patch. That seems more like a v20 item to me, though. Regards, -- Fujii Masao
Re: enhance wraparound warnings
От:
Fujii Masao <masao.fujii@gmail.com>
Дата:
On Tue, Jul 28, 2026 at 6:43 PM Yugo Nagata wrote: > I don't have a strong preference, but I slightly lean toward keeping "space". > The explicit denominator would make the percentage easier to interpret, and > "space" itself doesn't seem particularly confusing to me. So, my understanding of the discussion is: - Bharath preferred the wording without "space", but said he was fine with the majority. - Kyotaro thought the wording with "space" was clearer, because it makes explicit what the percentage is relative to. - Nathan had no strong preference. - Yugo also slightly leaned toward keeping "space". So, taking these opinions together, I think the wording with "space" is the better choice here. Unless there are further objections, I plan to commit the patch with that wording. > This also replaces "XIDs" with "transaction IDs" in the surrounding explanatory text. > I'm not sure this change is necessary, since that text is not part of the example output, > and "XID" is already used elsewhere in the same paragraph. I've updated 0002 patch as suggested. Thanks for the review! Regards, -- Fujii Masao
Re: enhance wraparound warnings
От:
Fujii Masao <masao.fujii@gmail.com>
Дата:
On Fri, Jun 26, 2026 at 2:19 AM Bharath Rupireddy
wrote:
> The use there is referring to the whole set of transaction IDs and how
> one can visualize the use of them - so "XID space" in that context
> seems fine to me.
>
> But the wraparound warnings read better when they say how many more
> transaction IDs are left:
>
> + errdetail("Approximately %.2f%% of MultiXactIds remain before wraparound.",
> + errdetail("Approximately %.2f%% of transaction IDs remain before wraparound.",
Okay, I've updated the patches as suggested. The updated patches are attached.
Regards,
--
Fujii Masao
Re: enhance wraparound warnings
От:
Fujii Masao <masao.fujii@gmail.com>
Дата:
On Sat, Jun 20, 2026 at 3:43 AM Nathan Bossart wrote:
>
> On Sat, Jun 20, 2026 at 03:13:23AM +0900, Fujii Masao wrote:
> > 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.
>
> That seems reasonable to me, thanks.
Thanks for the review!
While reading the related log messages again, I noticed that in three of
the four XID wraparound warnings in varsup.c, the HINT still uses "XID"
while the DETAIL message uses "transaction ID". Commit edee0c621de
updated the remaining warning to use "transaction ID",
but seems to have missed the other three. Since using different terms
for the same thing in the DETAIL and HINT messages seems
inconsistent, I included the following changes in the patch. Or would
it be better to do this in a separate patch?
- 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"
+ errhint("To avoid transaction ID assignment failures, execute a
database-wide VACUUM in that database.\n"
I also updated the comments in
src/test/modules/xid_wraparound/t/002_limits.pl, which contain
examples of the XID wraparound warnings.
Attached is the updated patch.
While making these changes, I also noticed that although commit
edee0c621de updated the runtime XID wraparound messages to use
"transaction IDs", the corresponding examples and text in
maintenance.sgml still use the older "XID" terminology. I therefore
created an additional patch (0002) to update the documentation to
match the current messages. I think this should be backpatched to v17.
Thought?
Regards,
--
Fujii Masao
Re: enhance wraparound warnings
От:
Fujii Masao <masao.fujii@gmail.com>
Дата:
On Sat, Mar 21, 2026 at 4:16 AM Nathan Bossart 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
Re: enhance wraparound warnings
От:
Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Дата:
Hi, On Tue, Aug 4, 2026 at 12:26 AM Fujii Masao wrote: > > So, my understanding of the discussion is: > > - Bharath preferred the wording without "space", but said he was fine with > the majority. > - Kyotaro thought the wording with "space" was clearer, because it makes > explicit what the percentage is relative to. > - Nathan had no strong preference. > - Yugo also slightly leaned toward keeping "space". > > So, taking these opinions together, I think the wording with "space" is the > better choice here. Unless there are further objections, I plan to commit > the patch with that wording. WFM. Thanks for summarizing. > > This also replaces "XIDs" with "transaction IDs" in the surrounding explanatory text. > > I'm not sure this change is necessary, since that text is not part of the example output, > > and "XID" is already used elsewhere in the same paragraph. > > I've updated 0002 patch as suggested. Thanks for the review! I looked at both patches and they look good to me. pgindent is happy too. Just a quick question: is the documentation change considered backpatchable when the source commit exists in older versions? I mean, does it fall into the bug or inconsistency category that qualifies for backpatching? -- Bharath Rupireddy Amazon Web Services: https://aws.amazon.com
Re: enhance wraparound warnings
От:
Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Дата:
Hi,
On Sat, Jun 20, 2026 at 4:54 AM Fujii Masao wrote:
>
> While making these changes, I also noticed that although commit
> edee0c621de updated the runtime XID wraparound messages to use
> "transaction IDs", the corresponding examples and text in
> maintenance.sgml still use the older "XID" terminology. I therefore
> created an additional patch (0002) to update the documentation to
> match the current messages. I think this should be backpatched to v17.
>
> Thought?
I happened to quickly review these patches. TBH, "transaction ID
space" and "MultiXactId space" seem a bit confusing because of the
word "space" - it reads fine without it. Is there a specific reason
for this wording?
Also, why not use "multixact IDs" instead of "MultiXactId"? The latter
reads like an internal structure name or such that might confuse users
reading the docs or error messages.
How about something like the following?
+ errdetail("Approximately %.2f%% of multixact IDs remain before wraparound.",
+ errdetail("Approximately %.2f%% of transaction IDs remain before wraparound.",
--
Bharath Rupireddy
Amazon Web Services: https://aws.amazon.com
Re: enhance wraparound warnings
От:
Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Дата:
Hi,
On Wed, Jun 24, 2026 at 5:53 AM Fujii Masao wrote:
>
> > TBH, "transaction ID
> > space" and "MultiXactId space" seem a bit confusing because of the
> > word "space" - it reads fine without it. Is there a specific reason
> > for this wording?
>
> I was thinking "space" was appropriate here because the message is intended
> to express the percentage remaining before wraparound in the ID range.
> The documentation also uses expressions such as "normal XID space is ...".
The use there is referring to the whole set of transaction IDs and how
one can visualize the use of them - so "XID space" in that context
seems fine to me.
But the wraparound warnings read better when they say how many more
transaction IDs are left:
+ errdetail("Approximately %.2f%% of MultiXactIds remain before wraparound.",
+ errdetail("Approximately %.2f%% of transaction IDs remain before wraparound.",
> > Also, why not use "multixact IDs" instead of "MultiXactId"? The latter
> > reads like an internal structure name or such that might confuse users
> > reading the docs or error messages.
>
> I left "MultiXactId" unchanged because several existing log messages
> use that term. I don't have any strong objection to changing it to
> "multixact ID", which is already used in the documentation. However, if
> we do that, I think it's better update all log messages that use
> "MultiXactId" for consistency, probably as a separate patch. That seems
> more like a v20 item to me, though.
I'm fine to leave "MultiXactIds" as-is - IMHO, it's not worth the cycles.
--
Bharath Rupireddy
Amazon Web Services: https://aws.amazon.com
Re: enhance wraparound warnings
От:
Shinya Kato <shinya11.kato@gmail.com>
Дата:
On Sat, Nov 15, 2025 at 2:05 AM Nathan Bossart wrote: > I don't know about you, but I start getting antsy around a quarter tank. > In any case, I'm told that even 40M transactions aren't enough time to > react these days. Attached are a few patches to enhance the wraparound > warnings. Thank you for the patch! > * 0001 adds a "percent remaining" detail message to the existing WARNING. > The idea is that "1.86% of transaction IDs" is both easier to understand > and better indicates urgency than "39985967 transactions". I like this idea and this is helpful information for DBA. 0001 looks good to me. > * 0002 bumps the warning limit from 40M to 100M to give folks some more > time to react. I don't have a strong opinion on whether 100M is the right value, but I noticed a documentation issue in 0002. WARNING: database "mydb" must be vacuumed within 39985967 transactions DETAIL: Approximately 1.86% of transaction IDs are available for use. HINT: To avoid XID assignment failures, execute a database-wide VACUUM in that database. In maintenance.sgml, above "39985967" and "1.86%" should be updated. > * 0003 adds an early warning system for when fewer than 500M transactions > remain. This system sends a LOG only to the server log every 1M > transactions. The hope is that this gets someone's attention sooner > without flooding the application and server log. I'm not sure 0003 is worth the added complexity. It adds a new field to TransamVariablesData and a modulo check in GetNewTransactionId(), which is a hot path. DBAs who need early warning can already monitor age(datfrozenxid) with more flexible thresholds. -- Best regards, Shinya Kato NTT OSS Center