mirror of https://github.com/citusdata/citus.git
Implement an helper to create memory cxt for stripe read (#4965)
parent
5a941814fd
commit
59fea712e2
|
@ -83,6 +83,7 @@ struct ColumnarReadState
|
|||
};
|
||||
|
||||
/* static function declarations */
|
||||
static MemoryContext CreateStripeReadMemoryContext(void);
|
||||
static bool StripeReadInProgress(ColumnarReadState *readState);
|
||||
static bool HasUnreadStripe(ColumnarReadState *readState);
|
||||
static StripeReadState * BeginStripeRead(StripeMetadata *stripeMetadata, Relation rel,
|
||||
|
@ -162,9 +163,7 @@ ColumnarBeginRead(Relation relation, TupleDesc tupleDescriptor,
|
|||
* this memory context before loading a new stripe. This is to avoid memory
|
||||
* leaks.
|
||||
*/
|
||||
MemoryContext stripeReadContext = AllocSetContextCreate(CurrentMemoryContext,
|
||||
"Stripe Read Memory Context",
|
||||
ALLOCSET_DEFAULT_SIZES);
|
||||
MemoryContext stripeReadContext = CreateStripeReadMemoryContext();
|
||||
|
||||
ColumnarReadState *readState = palloc0(sizeof(ColumnarReadState));
|
||||
readState->relation = relation;
|
||||
|
@ -181,6 +180,18 @@ ColumnarBeginRead(Relation relation, TupleDesc tupleDescriptor,
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* CreateStripeReadMemoryContext creates a memory context to be used when
|
||||
* reading a stripe.
|
||||
*/
|
||||
static MemoryContext
|
||||
CreateStripeReadMemoryContext()
|
||||
{
|
||||
return AllocSetContextCreate(CurrentMemoryContext, "Stripe Read Memory Context",
|
||||
ALLOCSET_DEFAULT_SIZES);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ColumnarReadNextRow tries to read a row from the columnar table. On success, it sets
|
||||
* column values and nulls, and returns true. If there are no more rows to read,
|
||||
|
|
Loading…
Reference in New Issue