pgsql: Fix snapshot leak warning for some procedures
От | Peter Eisentraut |
---|---|
Тема | pgsql: Fix snapshot leak warning for some procedures |
Дата | |
Msg-id | E1fuOZl-0006vP-PJ@gemulon.postgresql.org обсуждение исходный текст |
Список | pgsql-committers |
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(-)
В списке pgsql-committers по дате отправления: