mirror of
https://github.com/postgres/postgres.git
synced 2025-07-17 06:41:09 +03:00
Update portal-related memory context names and API
Rename PortalMemory to TopPortalContext, to avoid confusion with PortalContext and align naming with similar top-level memory contexts. Rename PortalData's "heap" field to portalContext. The "heap" naming seems quite antiquated and confusing. Also get rid of the PortalGetHeapMemory() macro and access the field directly, which we do for other portal fields, so this abstraction doesn't buy anything. Reviewed-by: Andrew Dunstan <andrew.dunstan@2ndquadrant.com> Reviewed-by: Alvaro Herrera <alvherre@alvh.no-ip.org>
This commit is contained in:
@ -96,7 +96,7 @@ PerformCursorOpen(DeclareCursorStmt *cstmt, ParamListInfo params,
|
||||
*/
|
||||
portal = CreatePortal(cstmt->portalname, false, false);
|
||||
|
||||
oldContext = MemoryContextSwitchTo(PortalGetHeapMemory(portal));
|
||||
oldContext = MemoryContextSwitchTo(portal->portalContext);
|
||||
|
||||
plan = copyObject(plan);
|
||||
|
||||
@ -363,7 +363,7 @@ PersistHoldablePortal(Portal portal)
|
||||
ActivePortal = portal;
|
||||
if (portal->resowner)
|
||||
CurrentResourceOwner = portal->resowner;
|
||||
PortalContext = PortalGetHeapMemory(portal);
|
||||
PortalContext = portal->portalContext;
|
||||
|
||||
MemoryContextSwitchTo(PortalContext);
|
||||
|
||||
@ -450,10 +450,10 @@ PersistHoldablePortal(Portal portal)
|
||||
PopActiveSnapshot();
|
||||
|
||||
/*
|
||||
* We can now release any subsidiary memory of the portal's heap context;
|
||||
* We can now release any subsidiary memory of the portal's context;
|
||||
* we'll never use it again. The executor already dropped its context,
|
||||
* but this will clean up anything that glommed onto the portal's heap via
|
||||
* but this will clean up anything that glommed onto the portal's context via
|
||||
* PortalContext.
|
||||
*/
|
||||
MemoryContextDeleteChildren(PortalGetHeapMemory(portal));
|
||||
MemoryContextDeleteChildren(portal->portalContext);
|
||||
}
|
||||
|
Reference in New Issue
Block a user