pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix snapshot leak warning for some procedures 2+ messages / 1 participants [nested] [flat]
* pgsql: Fix snapshot leak warning for some procedures @ 2018-08-27 20:57 Peter Eisentraut <peter_e@gmx.net> 0 siblings, 0 replies; 2+ messages in thread From: Peter Eisentraut @ 2018-08-27 20:57 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix snapshot leak warning for some procedures The problem arises with the combination of CALL with output parameters and doing a COMMIT inside the procedure. When a CALL has output parameters, the portal uses the strategy PORTAL_UTIL_SELECT instead of PORTAL_MULTI_QUERY. Using PORTAL_UTIL_SELECT causes the portal's snapshot to be registered with the current resource owner (portal->holdSnapshot); see 9ee1cf04ab6bcefe03a11837b53f29ca9dc24c7a for the reason. Normally, PortalDrop() unregisters the snapshot. If not, then ResourceOwnerRelease() will print a warning about a snapshot leak on transaction commit. A transaction commit normally drops all portals (PreCommit_Portals()), except the active portal. So in case of the active portal, we need to manually release the snapshot to avoid the warning. Reported-by: Prabhat Sahu <prabhat.sahu@enterprisedb.com> Reviewed-by: Jonathan S. Katz <jkatz@postgresql.org> Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/7a3b7bbfded3142aaa8edae2dbc88999568cc1cd Modified Files -------------- src/backend/utils/mmgr/portalmem.c | 14 ++++++++-- .../plpgsql/src/expected/plpgsql_transaction.out | 30 ++++++++++++++++++++++ src/pl/plpgsql/src/sql/plpgsql_transaction.sql | 25 ++++++++++++++++++ 3 files changed, 67 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: Fix snapshot leak warning for some procedures @ 2018-08-27 20:57 Peter Eisentraut <peter_e@gmx.net> 0 siblings, 0 replies; 2+ messages in thread From: Peter Eisentraut @ 2018-08-27 20:57 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix snapshot leak warning for some procedures The problem arises with the combination of CALL with output parameters and doing a COMMIT inside the procedure. When a CALL has output parameters, the portal uses the strategy PORTAL_UTIL_SELECT instead of PORTAL_MULTI_QUERY. Using PORTAL_UTIL_SELECT causes the portal's snapshot to be registered with the current resource owner (portal->holdSnapshot); see 9ee1cf04ab6bcefe03a11837b53f29ca9dc24c7a for the reason. Normally, PortalDrop() unregisters the snapshot. If not, then ResourceOwnerRelease() will print a warning about a snapshot leak on transaction commit. A transaction commit normally drops all portals (PreCommit_Portals()), except the active portal. So in case of the active portal, we need to manually release the snapshot to avoid the warning. Reported-by: Prabhat Sahu <prabhat.sahu@enterprisedb.com> Reviewed-by: Jonathan S. Katz <jkatz@postgresql.org> Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/2657d4ea66c775c3334181722115be2d6128c5cd Modified Files -------------- src/backend/utils/mmgr/portalmem.c | 14 ++++++++-- .../plpgsql/src/expected/plpgsql_transaction.out | 30 ++++++++++++++++++++++ src/pl/plpgsql/src/sql/plpgsql_transaction.sql | 25 ++++++++++++++++++ 3 files changed, 67 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2018-08-27 20:57 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2018-08-27 20:57 pgsql: Fix snapshot leak warning for some procedures Peter Eisentraut <peter_e@gmx.net> 2018-08-27 20:57 pgsql: Fix snapshot leak warning for some procedures Peter Eisentraut <peter_e@gmx.net>
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