diff options
author | Peter Eisentraut | 2017-12-16 22:26:26 +0000 |
---|---|---|
committer | Peter Eisentraut | 2018-01-09 18:47:56 +0000 |
commit | 0f7c49e85518dd846ccd0a044d49a922b9132983 (patch) | |
tree | 1bcbff190de4cc6f8c02e3ecbb2e9b753bbb1ef5 /src/backend/utils/mmgr/portalmem.c | |
parent | 3cb1b2a8804da8365fe17f687d96b720df4a583d (diff) |
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 <[email protected]>
Reviewed-by: Alvaro Herrera <[email protected]>
Diffstat (limited to 'src/backend/utils/mmgr/portalmem.c')
-rw-r--r-- | src/backend/utils/mmgr/portalmem.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/backend/utils/mmgr/portalmem.c b/src/backend/utils/mmgr/portalmem.c index c93c37d74a8..9edc1ccc832 100644 --- a/src/backend/utils/mmgr/portalmem.c +++ b/src/backend/utils/mmgr/portalmem.c @@ -87,7 +87,7 @@ do { \ elog(WARNING, "trying to delete portal name that does not exist"); \ } while(0) -static MemoryContext PortalMemory = NULL; +static MemoryContext TopPortalContext = NULL; /* ---------------------------------------------------------------- @@ -104,10 +104,10 @@ EnablePortalManager(void) { HASHCTL ctl; - Assert(PortalMemory == NULL); + Assert(TopPortalContext == NULL); - PortalMemory = AllocSetContextCreate(TopMemoryContext, - "PortalMemory", + TopPortalContext = AllocSetContextCreate(TopMemoryContext, + "TopPortalContext", ALLOCSET_DEFAULT_SIZES); ctl.keysize = MAX_PORTALNAME_LEN; @@ -193,12 +193,12 @@ CreatePortal(const char *name, bool allowDup, bool dupSilent) } /* make new portal structure */ - portal = (Portal) MemoryContextAllocZero(PortalMemory, sizeof *portal); + portal = (Portal) MemoryContextAllocZero(TopPortalContext, sizeof *portal); - /* initialize portal heap context; typically it won't store much */ - portal->heap = AllocSetContextCreate(PortalMemory, - "PortalHeapMemory", - ALLOCSET_SMALL_SIZES); + /* initialize portal context; typically it won't store much */ + portal->portalContext = AllocSetContextCreate(TopPortalContext, + "PortalContext", + ALLOCSET_SMALL_SIZES); /* create a resource owner for the portal */ portal->resowner = ResourceOwnerCreate(CurTransactionResourceOwner, @@ -263,7 +263,7 @@ CreateNewPortal(void) * * If cplan is NULL, then it is the caller's responsibility to ensure that * the passed plan trees have adequate lifetime. Typically this is done by - * copying them into the portal's heap context. + * copying them into the portal's context. * * The caller is also responsible for ensuring that the passed prepStmtName * (if not NULL) and sourceText have adequate lifetime. @@ -331,10 +331,10 @@ PortalCreateHoldStore(Portal portal) /* * Create the memory context that is used for storage of the tuple set. - * Note this is NOT a child of the portal's heap memory. + * Note this is NOT a child of the portal's portalContext. */ portal->holdContext = - AllocSetContextCreate(PortalMemory, + AllocSetContextCreate(TopPortalContext, "PortalHoldContext", ALLOCSET_DEFAULT_SIZES); @@ -576,9 +576,9 @@ PortalDrop(Portal portal, bool isTopCommit) MemoryContextDelete(portal->holdContext); /* release subsidiary storage */ - MemoryContextDelete(PortalGetHeapMemory(portal)); + MemoryContextDelete(portal->portalContext); - /* release portal struct (it's in PortalMemory) */ + /* release portal struct (it's in TopPortalContext) */ pfree(portal); } @@ -806,7 +806,7 @@ AtAbort_Portals(void) * The cleanup hook was the last thing that might have needed data * there. */ - MemoryContextDeleteChildren(PortalGetHeapMemory(portal)); + MemoryContextDeleteChildren(portal->portalContext); } } @@ -1000,7 +1000,7 @@ AtSubAbort_Portals(SubTransactionId mySubid, * The cleanup hook was the last thing that might have needed data * there. */ - MemoryContextDeleteChildren(PortalGetHeapMemory(portal)); + MemoryContextDeleteChildren(portal->portalContext); } } |