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 function declarations */
|
||||||
|
static MemoryContext CreateStripeReadMemoryContext(void);
|
||||||
static bool StripeReadInProgress(ColumnarReadState *readState);
|
static bool StripeReadInProgress(ColumnarReadState *readState);
|
||||||
static bool HasUnreadStripe(ColumnarReadState *readState);
|
static bool HasUnreadStripe(ColumnarReadState *readState);
|
||||||
static StripeReadState * BeginStripeRead(StripeMetadata *stripeMetadata, Relation rel,
|
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
|
* this memory context before loading a new stripe. This is to avoid memory
|
||||||
* leaks.
|
* leaks.
|
||||||
*/
|
*/
|
||||||
MemoryContext stripeReadContext = AllocSetContextCreate(CurrentMemoryContext,
|
MemoryContext stripeReadContext = CreateStripeReadMemoryContext();
|
||||||
"Stripe Read Memory Context",
|
|
||||||
ALLOCSET_DEFAULT_SIZES);
|
|
||||||
|
|
||||||
ColumnarReadState *readState = palloc0(sizeof(ColumnarReadState));
|
ColumnarReadState *readState = palloc0(sizeof(ColumnarReadState));
|
||||||
readState->relation = relation;
|
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
|
* 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,
|
* column values and nulls, and returns true. If there are no more rows to read,
|
||||||
|
|
Loading…
Reference in New Issue