address review comments

merge-cstore-pykello
Jeff Davis 2020-09-21 18:13:14 -07:00
parent c303f0f135
commit 8af9c91540
3 changed files with 12 additions and 30 deletions

View File

@ -42,7 +42,7 @@ void
cstore_init()
{
DefineCustomEnumVariable("cstore.compression",
"Sets the maximum number of statements tracked by pg_stat_statements.",
"Compression type for cstore.",
NULL,
&cstore_compression,
DEFAULT_COMPRESSION_TYPE,
@ -54,7 +54,7 @@ cstore_init()
NULL);
DefineCustomIntVariable("cstore.stripe_row_count",
"Sets the maximum number of statements tracked by pg_stat_statements.",
"Maximum number of tuples per stripe.",
NULL,
&cstore_stripe_row_count,
DEFAULT_STRIPE_ROW_COUNT,
@ -67,7 +67,7 @@ cstore_init()
NULL);
DefineCustomIntVariable("cstore.block_row_count",
"Sets the maximum number of statements tracked by pg_stat_statements.",
"Maximum number of rows per block.",
NULL,
&cstore_block_row_count,
DEFAULT_BLOCK_ROW_COUNT,

View File

@ -58,7 +58,7 @@ CStoreTableAMGetOptions(void)
static MemoryContext
CStoreMemoryContext(void)
GetCStoreMemoryContext(void)
{
if (CStoreContext == NULL)
{
@ -98,7 +98,7 @@ cstore_init_write_state(Relation relation)
}
void
static void
cstore_free_write_state()
{
if (CStoreWriteState != NULL)
@ -130,7 +130,7 @@ cstore_beginscan(Relation relation, Snapshot snapshot,
TableReadState *readState = NULL;
CStoreScanDesc scan = palloc(sizeof(CStoreScanDescData));
List *columnList = NIL;
MemoryContext oldContext = MemoryContextSwitchTo(CStoreMemoryContext());
MemoryContext oldContext = MemoryContextSwitchTo(GetCStoreMemoryContext());
cstoreOptions = CStoreTableAMGetOptions();
@ -176,6 +176,7 @@ cstore_endscan(TableScanDesc sscan)
{
CStoreScanDesc scan = (CStoreScanDesc) sscan;
CStoreEndRead(scan->cs_readState);
scan->cs_readState = NULL;
}
@ -192,7 +193,7 @@ cstore_getnextslot(TableScanDesc sscan, ScanDirection direction, TupleTableSlot
{
CStoreScanDesc scan = (CStoreScanDesc) sscan;
bool nextRowFound;
MemoryContext oldContext = MemoryContextSwitchTo(CStoreMemoryContext());
MemoryContext oldContext = MemoryContextSwitchTo(GetCStoreMemoryContext());
ExecClearTuple(slot);
@ -311,7 +312,7 @@ cstore_tuple_insert(Relation relation, TupleTableSlot *slot, CommandId cid,
int options, BulkInsertState bistate)
{
HeapTuple heapTuple;
MemoryContext oldContext = MemoryContextSwitchTo(CStoreMemoryContext());
MemoryContext oldContext = MemoryContextSwitchTo(GetCStoreMemoryContext());
cstore_init_write_state(relation);
@ -353,7 +354,7 @@ static void
cstore_multi_insert(Relation relation, TupleTableSlot **slots, int ntuples,
CommandId cid, int options, BulkInsertState bistate)
{
MemoryContext oldContext = MemoryContextSwitchTo(CStoreMemoryContext());
MemoryContext oldContext = MemoryContextSwitchTo(GetCStoreMemoryContext());
cstore_init_write_state(relation);
@ -563,23 +564,6 @@ cstore_estimate_rel_size(Relation rel, int32 *attr_widths,
}
static bool
cstore_scan_bitmap_next_block(TableScanDesc scan,
TBMIterateResult *tbmres)
{
elog(ERROR, "cstore_scan_bitmap_next_block not implemented");
}
static bool
cstore_scan_bitmap_next_tuple(TableScanDesc scan,
TBMIterateResult *tbmres,
TupleTableSlot *slot)
{
elog(ERROR, "cstore_scan_bitmap_next_tuple not implemented");
}
static bool
cstore_scan_sample_next_block(TableScanDesc scan, SampleScanState *scanstate)
{
@ -674,8 +658,8 @@ static const TableAmRoutine cstore_am_methods = {
.relation_estimate_size = cstore_estimate_rel_size,
.scan_bitmap_next_block = cstore_scan_bitmap_next_block,
.scan_bitmap_next_tuple = cstore_scan_bitmap_next_tuple,
.scan_bitmap_next_block = NULL,
.scan_bitmap_next_tuple = NULL,
.scan_sample_next_block = cstore_scan_sample_next_block,
.scan_sample_next_tuple = cstore_scan_sample_next_tuple
};

View File

@ -3,7 +3,5 @@
#include "access/tableam.h"
const TableAmRoutine * GetCstoreTableAmRoutine(void);
Datum cstore_tableam_handler(PG_FUNCTION_ARGS);
extern void cstore_free_write_state(void);
extern void cstore_tableam_init(void);
extern void cstore_tableam_finish(void);