pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Avoid using tuple from syscache for update of pg_database.datfro
3+ messages / 1 participants
[nested] [flat]

* pgsql: Avoid using tuple from syscache for update of pg_database.datfro
@ 2020-12-08 03:23  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 3+ messages in thread

From: Michael Paquier @ 2020-12-08 03:23 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Avoid using tuple from syscache for update of pg_database.datfrozenxid

pg_database.datfrozenxid gets updated using an in-place update at the
end of vacuum or autovacuum.  Since 96cdeae, as pg_database has a toast
relation, it is possible for a pg_database tuple to have toast values
if there is a large set of ACLs in place.  In such a case, the in-place
update would fail because of the flattening of the toast values done for
the catcache entry fetched.  Instead of using a copy from the catcache,
this changes the logic to fetch the copy of the tuple by directly
scanning pg_database.

Per the lack of complaints on the matter, no backpatch is done.  Note
that before 96cdeae, attempting to insert such a tuple to pg_database
would cause a "row is too big" error, so the end-of-vacuum problem was
not reachable.

Author: Ashwin Agrawal, Junfeng Yang
Discussion: https://postgr.es/m/DM5PR0501MB38800D9E4605BCA72DD35557CCE10@DM5PR0501MB3880.namprd05.prod.outlook.c...

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/947789f1f5fb61daf663f26325cbe7cad8197d58

Modified Files
--------------
src/backend/access/heap/heapam.c |  4 ++++
src/backend/commands/vacuum.c    | 20 ++++++++++++++++++--
2 files changed, 22 insertions(+), 2 deletions(-)



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

* pgsql: Avoid using tuple from syscache for update of pg_database.datfro
@ 2023-01-11 00:56  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 3+ messages in thread

From: Michael Paquier @ 2023-01-11 00:56 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Avoid using tuple from syscache for update of pg_database.datfrozenxid

pg_database.datfrozenxid gets updated using an in-place update at the
end of vacuum or autovacuum.  Since 96cdeae, as pg_database has a toast
relation, it is possible for a pg_database tuple to have toast values
if there is a large set of ACLs in place.  In such a case, the in-place
update would fail because of the flattening of the toast values done for
the catcache entry fetched.  Instead of using a copy from the catcache,
this changes the logic to fetch the copy of the tuple by directly
scanning pg_database.

Note that before 96cdeae, attempting to insert such a tuple to
pg_database would cause a "row is too big" error, so the end-of-vacuum
problem was not reachable.

This issue has been originally fixed in 947789f on v14~, and there have
been reports about this problem on v12 and v13, causing failures at the
end of VACUUM.  This completes the fix on all the stable branches where
pg_database can use a toast table, down to 12.

Author: Ashwin Agrawal, Junfeng Yang
Discussion: https://postgr.es/m/DM5PR0501MB38800D9E4605BCA72DD35557CCE10@DM5PR0501MB3880.namprd05.prod.outlook.c...
Discussion: https://postgr.es/m/Y70XNVbUWQsR2Car@paquier.xyz
Backpatch-through: 12

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/72b6098be47e19eff50a052676908e0fde25e7ee

Modified Files
--------------
src/backend/access/heap/heapam.c |  4 ++++
src/backend/commands/vacuum.c    | 21 +++++++++++++++++++--
2 files changed, 23 insertions(+), 2 deletions(-)



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

* pgsql: Avoid using tuple from syscache for update of pg_database.datfro
@ 2023-01-11 00:56  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 3+ messages in thread

From: Michael Paquier @ 2023-01-11 00:56 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Avoid using tuple from syscache for update of pg_database.datfrozenxid

pg_database.datfrozenxid gets updated using an in-place update at the
end of vacuum or autovacuum.  Since 96cdeae, as pg_database has a toast
relation, it is possible for a pg_database tuple to have toast values
if there is a large set of ACLs in place.  In such a case, the in-place
update would fail because of the flattening of the toast values done for
the catcache entry fetched.  Instead of using a copy from the catcache,
this changes the logic to fetch the copy of the tuple by directly
scanning pg_database.

Note that before 96cdeae, attempting to insert such a tuple to
pg_database would cause a "row is too big" error, so the end-of-vacuum
problem was not reachable.

This issue has been originally fixed in 947789f on v14~, and there have
been reports about this problem on v12 and v13, causing failures at the
end of VACUUM.  This completes the fix on all the stable branches where
pg_database can use a toast table, down to 12.

Author: Ashwin Agrawal, Junfeng Yang
Discussion: https://postgr.es/m/DM5PR0501MB38800D9E4605BCA72DD35557CCE10@DM5PR0501MB3880.namprd05.prod.outlook.c...
Discussion: https://postgr.es/m/Y70XNVbUWQsR2Car@paquier.xyz
Backpatch-through: 12

Branch
------
REL_12_STABLE

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

Modified Files
--------------
src/backend/access/heap/heapam.c |  4 ++++
src/backend/commands/vacuum.c    | 21 +++++++++++++++++++--
2 files changed, 23 insertions(+), 2 deletions(-)



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


end of thread, other threads:[~2023-01-11 00:56 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-12-08 03:23 pgsql: Avoid using tuple from syscache for update of pg_database.datfro Michael Paquier <michael@paquier.xyz>
2023-01-11 00:56 pgsql: Avoid using tuple from syscache for update of pg_database.datfro Michael Paquier <michael@paquier.xyz>
2023-01-11 00:56 pgsql: Avoid using tuple from syscache for update of pg_database.datfro Michael Paquier <michael@paquier.xyz>

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