pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: xid_wraparound: Fix XID consumption accounting
4+ messages / 1 participants
[nested] [flat]

* pgsql: xid_wraparound: Fix XID consumption accounting
@ 2026-11-18 04:59 Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 4+ messages in thread

From: Fujii Masao @ 2026-11-18 04:59 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

xid_wraparound: Fix XID consumption accounting

When the current transaction had not yet been assigned a top-level
XID, consume_xids(n) consumed n + 1 XIDs because the initial top-level
XID allocation was not included in the count. Include that allocation
so that the function consumes exactly n XIDs.

In particular, consume_xids(1) now consumes and returns only the
top-level XID in this case, rather than consuming two XIDs and
returning the second. consume_xids(0) now raises an error instead of
returning the next unallocated XID.

With 32kB blocks, bulk XID consumption could also consume more XIDs
than requested or return an outdated XID. Restrict this optimization
so that consume_xids(n) always consumes exactly n XIDs and returns
the last XID it assigned.

Backpatch to 17, where the xid_wraparound test module was introduced.

Author: Yushi Ogiwara <btogiwarayuushi@oss.nttdata.com>
Author: João Rito <joaovictor.rito@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/2a62f138c9dcb6fcf5889b076d123aa2@oss.nttdata.com
Backpatch-through: 17

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1b4abc23f3e3fa8f2274b74b7912c90bed31b242

Modified Files
--------------
src/test/modules/xid_wraparound/xid_wraparound.c | 52 ++++++++++++++++--------
1 file changed, 36 insertions(+), 16 deletions(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: xid_wraparound: Fix XID consumption accounting
@ 2026-11-18 04:59 Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 4+ messages in thread

From: Fujii Masao @ 2026-11-18 04:59 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

xid_wraparound: Fix XID consumption accounting

When the current transaction had not yet been assigned a top-level
XID, consume_xids(n) consumed n + 1 XIDs because the initial top-level
XID allocation was not included in the count. Include that allocation
so that the function consumes exactly n XIDs.

In particular, consume_xids(1) now consumes and returns only the
top-level XID in this case, rather than consuming two XIDs and
returning the second. consume_xids(0) now raises an error instead of
returning the next unallocated XID.

With 32kB blocks, bulk XID consumption could also consume more XIDs
than requested or return an outdated XID. Restrict this optimization
so that consume_xids(n) always consumes exactly n XIDs and returns
the last XID it assigned.

Backpatch to 17, where the xid_wraparound test module was introduced.

Author: Yushi Ogiwara <btogiwarayuushi@oss.nttdata.com>
Author: João Rito <joaovictor.rito@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/2a62f138c9dcb6fcf5889b076d123aa2@oss.nttdata.com
Backpatch-through: 17

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/03a2086a497b6345a71a7bdd56fa89be4924f77c

Modified Files
--------------
src/test/modules/xid_wraparound/xid_wraparound.c | 52 ++++++++++++++++--------
1 file changed, 36 insertions(+), 16 deletions(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: xid_wraparound: Fix XID consumption accounting
@ 2026-11-18 05:00 Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 4+ messages in thread

From: Fujii Masao @ 2026-11-18 05:00 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

xid_wraparound: Fix XID consumption accounting

When the current transaction had not yet been assigned a top-level
XID, consume_xids(n) consumed n + 1 XIDs because the initial top-level
XID allocation was not included in the count. Include that allocation
so that the function consumes exactly n XIDs.

In particular, consume_xids(1) now consumes and returns only the
top-level XID in this case, rather than consuming two XIDs and
returning the second. consume_xids(0) now raises an error instead of
returning the next unallocated XID.

With 32kB blocks, bulk XID consumption could also consume more XIDs
than requested or return an outdated XID. Restrict this optimization
so that consume_xids(n) always consumes exactly n XIDs and returns
the last XID it assigned.

Backpatch to 17, where the xid_wraparound test module was introduced.

Author: Yushi Ogiwara <btogiwarayuushi@oss.nttdata.com>
Author: João Rito <joaovictor.rito@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/2a62f138c9dcb6fcf5889b076d123aa2@oss.nttdata.com
Backpatch-through: 17

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/a47c0b82e64435fe8c297d0c4637b13203333588

Modified Files
--------------
src/test/modules/xid_wraparound/xid_wraparound.c | 52 ++++++++++++++++--------
1 file changed, 36 insertions(+), 16 deletions(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: xid_wraparound: Fix XID consumption accounting
@ 2026-11-18 05:00 Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 4+ messages in thread

From: Fujii Masao @ 2026-11-18 05:00 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

xid_wraparound: Fix XID consumption accounting

When the current transaction had not yet been assigned a top-level
XID, consume_xids(n) consumed n + 1 XIDs because the initial top-level
XID allocation was not included in the count. Include that allocation
so that the function consumes exactly n XIDs.

In particular, consume_xids(1) now consumes and returns only the
top-level XID in this case, rather than consuming two XIDs and
returning the second. consume_xids(0) now raises an error instead of
returning the next unallocated XID.

With 32kB blocks, bulk XID consumption could also consume more XIDs
than requested or return an outdated XID. Restrict this optimization
so that consume_xids(n) always consumes exactly n XIDs and returns
the last XID it assigned.

Backpatch to 17, where the xid_wraparound test module was introduced.

Author: Yushi Ogiwara <btogiwarayuushi@oss.nttdata.com>
Author: João Rito <joaovictor.rito@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/2a62f138c9dcb6fcf5889b076d123aa2@oss.nttdata.com
Backpatch-through: 17

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/344322da515e7eed56300f52f95ef320753c12d1

Modified Files
--------------
src/test/modules/xid_wraparound/xid_wraparound.c | 52 ++++++++++++++++--------
1 file changed, 36 insertions(+), 16 deletions(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2026-11-18 05:00 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-11-18 04:59 pgsql: xid_wraparound: Fix XID consumption accounting Fujii Masao <fujii@postgresql.org>
2026-11-18 04:59 pgsql: xid_wraparound: Fix XID consumption accounting Fujii Masao <fujii@postgresql.org>
2026-11-18 05:00 pgsql: xid_wraparound: Fix XID consumption accounting Fujii Masao <fujii@postgresql.org>
2026-11-18 05:00 pgsql: xid_wraparound: Fix XID consumption accounting Fujii Masao <fujii@postgresql.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox