Introduce CreateColumnarScanMemoryContext

pull/5058/head
Onur Tirtir 2021-06-22 12:34:22 +03:00
parent a25d89e4cb
commit c021b82a43
1 changed files with 14 additions and 6 deletions

View File

@ -91,6 +91,7 @@ static object_access_hook_type PrevObjectAccessHook = NULL;
static ProcessUtility_hook_type PrevProcessUtilityHook = NULL; static ProcessUtility_hook_type PrevProcessUtilityHook = NULL;
/* forward declaration for static functions */ /* forward declaration for static functions */
static MemoryContext CreateColumnarScanMemoryContext(void);
static void ColumnarTableDropHook(Oid tgid); static void ColumnarTableDropHook(Oid tgid);
static void ColumnarTriggerCreateHook(Oid tgid); static void ColumnarTriggerCreateHook(Oid tgid);
static void ColumnarTableAMObjectAccessHook(ObjectAccessType access, Oid classId, static void ColumnarTableAMObjectAccessHook(ObjectAccessType access, Oid classId,
@ -178,12 +179,7 @@ columnar_beginscan_extended(Relation relation, Snapshot snapshot,
* initialized read state. We assume that beginscan is called in a * initialized read state. We assume that beginscan is called in a
* context that will last until end of scan. * context that will last until end of scan.
*/ */
MemoryContext scanContext = MemoryContext scanContext = CreateColumnarScanMemoryContext();
AllocSetContextCreate(
CurrentMemoryContext,
"Column Store Scan Context",
ALLOCSET_DEFAULT_SIZES);
MemoryContext oldContext = MemoryContextSwitchTo(scanContext); MemoryContext oldContext = MemoryContextSwitchTo(scanContext);
ColumnarScanDesc scan = palloc0(sizeof(ColumnarScanDescData)); ColumnarScanDesc scan = palloc0(sizeof(ColumnarScanDescData));
@ -220,6 +216,18 @@ columnar_beginscan_extended(Relation relation, Snapshot snapshot,
} }
/*
* CreateColumnarScanMemoryContext creates a memory context to store
* ColumnarReadStare in it.
*/
static MemoryContext
CreateColumnarScanMemoryContext(void)
{
return AllocSetContextCreate(CurrentMemoryContext, "Columnar Scan Context",
ALLOCSET_DEFAULT_SIZES);
}
/* /*
* init_columnar_read_state initializes a column store table read and returns the * init_columnar_read_state initializes a column store table read and returns the
* state. * state.