mirror of https://github.com/citusdata/citus.git
address review comments
parent
c303f0f135
commit
8af9c91540
6
cstore.c
6
cstore.c
|
@ -42,7 +42,7 @@ void
|
||||||
cstore_init()
|
cstore_init()
|
||||||
{
|
{
|
||||||
DefineCustomEnumVariable("cstore.compression",
|
DefineCustomEnumVariable("cstore.compression",
|
||||||
"Sets the maximum number of statements tracked by pg_stat_statements.",
|
"Compression type for cstore.",
|
||||||
NULL,
|
NULL,
|
||||||
&cstore_compression,
|
&cstore_compression,
|
||||||
DEFAULT_COMPRESSION_TYPE,
|
DEFAULT_COMPRESSION_TYPE,
|
||||||
|
@ -54,7 +54,7 @@ cstore_init()
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
DefineCustomIntVariable("cstore.stripe_row_count",
|
DefineCustomIntVariable("cstore.stripe_row_count",
|
||||||
"Sets the maximum number of statements tracked by pg_stat_statements.",
|
"Maximum number of tuples per stripe.",
|
||||||
NULL,
|
NULL,
|
||||||
&cstore_stripe_row_count,
|
&cstore_stripe_row_count,
|
||||||
DEFAULT_STRIPE_ROW_COUNT,
|
DEFAULT_STRIPE_ROW_COUNT,
|
||||||
|
@ -67,7 +67,7 @@ cstore_init()
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
DefineCustomIntVariable("cstore.block_row_count",
|
DefineCustomIntVariable("cstore.block_row_count",
|
||||||
"Sets the maximum number of statements tracked by pg_stat_statements.",
|
"Maximum number of rows per block.",
|
||||||
NULL,
|
NULL,
|
||||||
&cstore_block_row_count,
|
&cstore_block_row_count,
|
||||||
DEFAULT_BLOCK_ROW_COUNT,
|
DEFAULT_BLOCK_ROW_COUNT,
|
||||||
|
|
|
@ -58,7 +58,7 @@ CStoreTableAMGetOptions(void)
|
||||||
|
|
||||||
|
|
||||||
static MemoryContext
|
static MemoryContext
|
||||||
CStoreMemoryContext(void)
|
GetCStoreMemoryContext(void)
|
||||||
{
|
{
|
||||||
if (CStoreContext == NULL)
|
if (CStoreContext == NULL)
|
||||||
{
|
{
|
||||||
|
@ -98,7 +98,7 @@ cstore_init_write_state(Relation relation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
static void
|
||||||
cstore_free_write_state()
|
cstore_free_write_state()
|
||||||
{
|
{
|
||||||
if (CStoreWriteState != NULL)
|
if (CStoreWriteState != NULL)
|
||||||
|
@ -130,7 +130,7 @@ cstore_beginscan(Relation relation, Snapshot snapshot,
|
||||||
TableReadState *readState = NULL;
|
TableReadState *readState = NULL;
|
||||||
CStoreScanDesc scan = palloc(sizeof(CStoreScanDescData));
|
CStoreScanDesc scan = palloc(sizeof(CStoreScanDescData));
|
||||||
List *columnList = NIL;
|
List *columnList = NIL;
|
||||||
MemoryContext oldContext = MemoryContextSwitchTo(CStoreMemoryContext());
|
MemoryContext oldContext = MemoryContextSwitchTo(GetCStoreMemoryContext());
|
||||||
|
|
||||||
cstoreOptions = CStoreTableAMGetOptions();
|
cstoreOptions = CStoreTableAMGetOptions();
|
||||||
|
|
||||||
|
@ -176,6 +176,7 @@ cstore_endscan(TableScanDesc sscan)
|
||||||
{
|
{
|
||||||
CStoreScanDesc scan = (CStoreScanDesc) sscan;
|
CStoreScanDesc scan = (CStoreScanDesc) sscan;
|
||||||
CStoreEndRead(scan->cs_readState);
|
CStoreEndRead(scan->cs_readState);
|
||||||
|
scan->cs_readState = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -192,7 +193,7 @@ cstore_getnextslot(TableScanDesc sscan, ScanDirection direction, TupleTableSlot
|
||||||
{
|
{
|
||||||
CStoreScanDesc scan = (CStoreScanDesc) sscan;
|
CStoreScanDesc scan = (CStoreScanDesc) sscan;
|
||||||
bool nextRowFound;
|
bool nextRowFound;
|
||||||
MemoryContext oldContext = MemoryContextSwitchTo(CStoreMemoryContext());
|
MemoryContext oldContext = MemoryContextSwitchTo(GetCStoreMemoryContext());
|
||||||
|
|
||||||
ExecClearTuple(slot);
|
ExecClearTuple(slot);
|
||||||
|
|
||||||
|
@ -311,7 +312,7 @@ cstore_tuple_insert(Relation relation, TupleTableSlot *slot, CommandId cid,
|
||||||
int options, BulkInsertState bistate)
|
int options, BulkInsertState bistate)
|
||||||
{
|
{
|
||||||
HeapTuple heapTuple;
|
HeapTuple heapTuple;
|
||||||
MemoryContext oldContext = MemoryContextSwitchTo(CStoreMemoryContext());
|
MemoryContext oldContext = MemoryContextSwitchTo(GetCStoreMemoryContext());
|
||||||
|
|
||||||
cstore_init_write_state(relation);
|
cstore_init_write_state(relation);
|
||||||
|
|
||||||
|
@ -353,7 +354,7 @@ static void
|
||||||
cstore_multi_insert(Relation relation, TupleTableSlot **slots, int ntuples,
|
cstore_multi_insert(Relation relation, TupleTableSlot **slots, int ntuples,
|
||||||
CommandId cid, int options, BulkInsertState bistate)
|
CommandId cid, int options, BulkInsertState bistate)
|
||||||
{
|
{
|
||||||
MemoryContext oldContext = MemoryContextSwitchTo(CStoreMemoryContext());
|
MemoryContext oldContext = MemoryContextSwitchTo(GetCStoreMemoryContext());
|
||||||
|
|
||||||
cstore_init_write_state(relation);
|
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
|
static bool
|
||||||
cstore_scan_sample_next_block(TableScanDesc scan, SampleScanState *scanstate)
|
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,
|
.relation_estimate_size = cstore_estimate_rel_size,
|
||||||
|
|
||||||
.scan_bitmap_next_block = cstore_scan_bitmap_next_block,
|
.scan_bitmap_next_block = NULL,
|
||||||
.scan_bitmap_next_tuple = cstore_scan_bitmap_next_tuple,
|
.scan_bitmap_next_tuple = NULL,
|
||||||
.scan_sample_next_block = cstore_scan_sample_next_block,
|
.scan_sample_next_block = cstore_scan_sample_next_block,
|
||||||
.scan_sample_next_tuple = cstore_scan_sample_next_tuple
|
.scan_sample_next_tuple = cstore_scan_sample_next_tuple
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,7 +3,5 @@
|
||||||
#include "access/tableam.h"
|
#include "access/tableam.h"
|
||||||
|
|
||||||
const TableAmRoutine * GetCstoreTableAmRoutine(void);
|
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_init(void);
|
||||||
extern void cstore_tableam_finish(void);
|
extern void cstore_tableam_finish(void);
|
||||||
|
|
Loading…
Reference in New Issue