pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix reorder buffer memory accounting for toast changes. 3+ messages / 1 participants [nested] [flat]
* pgsql: Fix reorder buffer memory accounting for toast changes. @ 2021-09-13 05:26 Amit Kapila <akapila@postgresql.org> 0 siblings, 0 replies; 3+ messages in thread From: Amit Kapila @ 2021-09-13 05:26 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix reorder buffer memory accounting for toast changes. While processing toast changes in logical decoding, we rejigger the tuple change to point to in-memory toast tuples instead to on-disk toast tuples. And, to make sure the memory accounting is correct, we were subtracting the old change size and then after re-computing the new tuple, re-adding its size at the end. Now, if there is any error before we add the new size, we will release the changes and that will update the accounting info (subtracting the size from the counters). And we were underflowing there which leads to an assertion failure in assert enabled builds and wrong memory accounting in reorder buffer otherwise. Author: Bertrand Drouvot Reviewed-by: Amit Kapila Backpatch-through: 13, where memory accounting was introduced Discussion: https://postgr.es/m/92b0ee65-b8bd-e42d-c082-4f3f4bf12d34@amazon.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/df3640e5293dccbf964508babfc067282ea7a2fc Modified Files -------------- src/backend/replication/logical/reorderbuffer.c | 36 ++++++++++++++++--------- 1 file changed, 23 insertions(+), 13 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Fix reorder buffer memory accounting for toast changes. @ 2021-09-13 05:26 Amit Kapila <akapila@postgresql.org> 0 siblings, 0 replies; 3+ messages in thread From: Amit Kapila @ 2021-09-13 05:26 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix reorder buffer memory accounting for toast changes. While processing toast changes in logical decoding, we rejigger the tuple change to point to in-memory toast tuples instead to on-disk toast tuples. And, to make sure the memory accounting is correct, we were subtracting the old change size and then after re-computing the new tuple, re-adding its size at the end. Now, if there is any error before we add the new size, we will release the changes and that will update the accounting info (subtracting the size from the counters). And we were underflowing there which leads to an assertion failure in assert enabled builds and wrong memory accounting in reorder buffer otherwise. Author: Bertrand Drouvot Reviewed-by: Amit Kapila Backpatch-through: 13, where memory accounting was introduced Discussion: https://postgr.es/m/92b0ee65-b8bd-e42d-c082-4f3f4bf12d34@amazon.com Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/f5e0ff4631b5402950db69c989c88c4c6295504b Modified Files -------------- src/backend/replication/logical/reorderbuffer.c | 36 ++++++++++++++++--------- 1 file changed, 23 insertions(+), 13 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Fix reorder buffer memory accounting for toast changes. @ 2021-09-13 05:26 Amit Kapila <akapila@postgresql.org> 0 siblings, 0 replies; 3+ messages in thread From: Amit Kapila @ 2021-09-13 05:26 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix reorder buffer memory accounting for toast changes. While processing toast changes in logical decoding, we rejigger the tuple change to point to in-memory toast tuples instead to on-disk toast tuples. And, to make sure the memory accounting is correct, we were subtracting the old change size and then after re-computing the new tuple, re-adding its size at the end. Now, if there is any error before we add the new size, we will release the changes and that will update the accounting info (subtracting the size from the counters). And we were underflowing there which leads to an assertion failure in assert enabled builds and wrong memory accounting in reorder buffer otherwise. Author: Bertrand Drouvot Reviewed-by: Amit Kapila Backpatch-through: 13, where memory accounting was introduced Discussion: https://postgr.es/m/92b0ee65-b8bd-e42d-c082-4f3f4bf12d34@amazon.com Branch ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/58cf794ca68d90ea11888f200e0b74d01d0c7093 Modified Files -------------- src/backend/replication/logical/reorderbuffer.c | 37 +++++++++++++++---------- 1 file changed, 23 insertions(+), 14 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2021-09-13 05:26 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2021-09-13 05:26 pgsql: Fix reorder buffer memory accounting for toast changes. Amit Kapila <akapila@postgresql.org> 2021-09-13 05:26 pgsql: Fix reorder buffer memory accounting for toast changes. Amit Kapila <akapila@postgresql.org> 2021-09-13 05:26 pgsql: Fix reorder buffer memory accounting for toast changes. Amit Kapila <akapila@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