mirror of https://github.com/citusdata/citus.git
citus indent and Makefile fixup
parent
4dfec401ce
commit
d352cd07dd
13
Makefile
13
Makefile
|
@ -7,21 +7,22 @@ MODULE_big = cstore_fdw
|
||||||
|
|
||||||
VER := $(lastword $(shell pg_config --version))
|
VER := $(lastword $(shell pg_config --version))
|
||||||
VER_WORDS = $(subst ., ,$(VER))
|
VER_WORDS = $(subst ., ,$(VER))
|
||||||
|
MVER = $(firstword $(VER_WORDS))
|
||||||
|
|
||||||
# versions prior to 10 (those with 3 version numbers) not supported
|
# error for versions earlier than 10 so that lex comparison will work
|
||||||
ifeq ($(words $(VER_WORDS)),3)
|
ifneq ($(shell printf '%02d' $(MVER)),$(MVER))
|
||||||
$(error version $(VER) not supported)
|
$(error version $(VER) not supported)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
MVER = $(firstword $(VER_WORDS))
|
# lexicographic comparison of version number
|
||||||
|
|
||||||
# version >= 12?
|
|
||||||
ifeq ($(lastword $(sort 12 $(MVER))),$(MVER))
|
ifeq ($(lastword $(sort 12 $(MVER))),$(MVER))
|
||||||
USE_TABLEAM = yes
|
USE_TABLEAM = yes
|
||||||
USE_FDW = yes
|
USE_FDW = yes
|
||||||
else
|
else ifeq ($(lastword $(sort 11 $(MVER))),$(MVER))
|
||||||
USE_TABLEAM = no
|
USE_TABLEAM = no
|
||||||
USE_FDW = yes
|
USE_FDW = yes
|
||||||
|
else
|
||||||
|
$(error version $(VER) is not supported)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
PG_CPPFLAGS = -std=c11
|
PG_CPPFLAGS = -std=c11
|
||||||
|
|
|
@ -56,15 +56,16 @@ CStoreGetDefaultOptions(void)
|
||||||
return cstoreOptions;
|
return cstoreOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cstore_init_write_state(Relation relation)
|
cstore_init_write_state(Relation relation)
|
||||||
{
|
{
|
||||||
//TODO: upgrade lock to serialize writes
|
/*TODO: upgrade lock to serialize writes */
|
||||||
|
|
||||||
if (CStoreWriteState != NULL)
|
if (CStoreWriteState != NULL)
|
||||||
{
|
{
|
||||||
// TODO: consider whether it's possible for a new write to start
|
/* TODO: consider whether it's possible for a new write to start */
|
||||||
// before an old one is flushed
|
/* before an old one is flushed */
|
||||||
Assert(CStoreWriteState->relation->rd_id == relation->rd_id);
|
Assert(CStoreWriteState->relation->rd_id == relation->rd_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,23 +94,27 @@ cstore_init_write_state(Relation relation)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
cstore_free_write_state()
|
cstore_free_write_state()
|
||||||
{
|
{
|
||||||
if (CStoreWriteState != NULL)
|
if (CStoreWriteState != NULL)
|
||||||
{
|
{
|
||||||
elog(LOG, "flushing write state for relation %d", CStoreWriteState->relation->rd_id);
|
elog(LOG, "flushing write state for relation %d",
|
||||||
|
CStoreWriteState->relation->rd_id);
|
||||||
CStoreEndWrite(CStoreWriteState);
|
CStoreEndWrite(CStoreWriteState);
|
||||||
CStoreWriteState = NULL;
|
CStoreWriteState = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static const TupleTableSlotOps *
|
static const TupleTableSlotOps *
|
||||||
cstore_slot_callbacks(Relation relation)
|
cstore_slot_callbacks(Relation relation)
|
||||||
{
|
{
|
||||||
return &TTSOpsVirtual;
|
return &TTSOpsVirtual;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static TableScanDesc
|
static TableScanDesc
|
||||||
cstore_beginscan(Relation relation, Snapshot snapshot,
|
cstore_beginscan(Relation relation, Snapshot snapshot,
|
||||||
int nkeys, ScanKey key,
|
int nkeys, ScanKey key,
|
||||||
|
@ -135,7 +140,7 @@ cstore_beginscan(Relation relation, Snapshot snapshot,
|
||||||
for (int i = 0; i < tupdesc->natts; i++)
|
for (int i = 0; i < tupdesc->natts; i++)
|
||||||
{
|
{
|
||||||
Index varno = 0;
|
Index varno = 0;
|
||||||
AttrNumber varattno = i+1;
|
AttrNumber varattno = i + 1;
|
||||||
Oid vartype = tupdesc->attrs[i].atttypid;
|
Oid vartype = tupdesc->attrs[i].atttypid;
|
||||||
int32 vartypmod = 0;
|
int32 vartypmod = 0;
|
||||||
Oid varcollid = 0;
|
Oid varcollid = 0;
|
||||||
|
@ -144,8 +149,10 @@ cstore_beginscan(Relation relation, Snapshot snapshot,
|
||||||
varcollid, varlevelsup);
|
varcollid, varlevelsup);
|
||||||
|
|
||||||
if (!tupdesc->attrs[i].attisdropped)
|
if (!tupdesc->attrs[i].attisdropped)
|
||||||
|
{
|
||||||
columnList = lappend(columnList, var);
|
columnList = lappend(columnList, var);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
readState = CStoreBeginRead(relid, tupdesc, columnList, NULL);
|
readState = CStoreBeginRead(relid, tupdesc, columnList, NULL);
|
||||||
readState->relation = relation;
|
readState->relation = relation;
|
||||||
|
@ -155,6 +162,7 @@ cstore_beginscan(Relation relation, Snapshot snapshot,
|
||||||
return ((TableScanDesc) scan);
|
return ((TableScanDesc) scan);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cstore_endscan(TableScanDesc sscan)
|
cstore_endscan(TableScanDesc sscan)
|
||||||
{
|
{
|
||||||
|
@ -162,6 +170,7 @@ cstore_endscan(TableScanDesc sscan)
|
||||||
CStoreEndRead(scan->cs_readState);
|
CStoreEndRead(scan->cs_readState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cstore_rescan(TableScanDesc sscan, ScanKey key, bool set_params,
|
cstore_rescan(TableScanDesc sscan, ScanKey key, bool set_params,
|
||||||
bool allow_strat, bool allow_sync, bool allow_pagemode)
|
bool allow_strat, bool allow_sync, bool allow_pagemode)
|
||||||
|
@ -169,6 +178,7 @@ cstore_rescan(TableScanDesc sscan, ScanKey key, bool set_params,
|
||||||
elog(ERROR, "cstore_rescan not implemented");
|
elog(ERROR, "cstore_rescan not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
cstore_getnextslot(TableScanDesc sscan, ScanDirection direction, TupleTableSlot *slot)
|
cstore_getnextslot(TableScanDesc sscan, ScanDirection direction, TupleTableSlot *slot)
|
||||||
{
|
{
|
||||||
|
@ -181,51 +191,61 @@ cstore_getnextslot(TableScanDesc sscan, ScanDirection direction, TupleTableSlot
|
||||||
memset(slot->tts_values, 0, sizeof(Datum) * natts);
|
memset(slot->tts_values, 0, sizeof(Datum) * natts);
|
||||||
memset(slot->tts_isnull, true, sizeof(bool) * natts);
|
memset(slot->tts_isnull, true, sizeof(bool) * natts);
|
||||||
|
|
||||||
nextRowFound = CStoreReadNextRow(scan->cs_readState, slot->tts_values, slot->tts_isnull);
|
nextRowFound = CStoreReadNextRow(scan->cs_readState, slot->tts_values,
|
||||||
|
slot->tts_isnull);
|
||||||
|
|
||||||
if (!nextRowFound)
|
if (!nextRowFound)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
ExecStoreVirtualTuple(slot);
|
ExecStoreVirtualTuple(slot);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static Size
|
static Size
|
||||||
cstore_parallelscan_estimate(Relation rel)
|
cstore_parallelscan_estimate(Relation rel)
|
||||||
{
|
{
|
||||||
elog(ERROR, "cstore_parallelscan_estimate not implemented");
|
elog(ERROR, "cstore_parallelscan_estimate not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static Size
|
static Size
|
||||||
cstore_parallelscan_initialize(Relation rel, ParallelTableScanDesc pscan)
|
cstore_parallelscan_initialize(Relation rel, ParallelTableScanDesc pscan)
|
||||||
{
|
{
|
||||||
elog(ERROR, "cstore_parallelscan_initialize not implemented");
|
elog(ERROR, "cstore_parallelscan_initialize not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cstore_parallelscan_reinitialize(Relation rel, ParallelTableScanDesc pscan)
|
cstore_parallelscan_reinitialize(Relation rel, ParallelTableScanDesc pscan)
|
||||||
{
|
{
|
||||||
elog(ERROR, "cstore_parallelscan_reinitialize not implemented");
|
elog(ERROR, "cstore_parallelscan_reinitialize not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static IndexFetchTableData *
|
static IndexFetchTableData *
|
||||||
cstore_index_fetch_begin(Relation rel)
|
cstore_index_fetch_begin(Relation rel)
|
||||||
{
|
{
|
||||||
elog(ERROR, "cstore_index_fetch_begin not implemented");
|
elog(ERROR, "cstore_index_fetch_begin not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cstore_index_fetch_reset(IndexFetchTableData *scan)
|
cstore_index_fetch_reset(IndexFetchTableData *scan)
|
||||||
{
|
{
|
||||||
elog(ERROR, "cstore_index_fetch_reset not implemented");
|
elog(ERROR, "cstore_index_fetch_reset not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cstore_index_fetch_end(IndexFetchTableData *scan)
|
cstore_index_fetch_end(IndexFetchTableData *scan)
|
||||||
{
|
{
|
||||||
elog(ERROR, "cstore_index_fetch_end not implemented");
|
elog(ERROR, "cstore_index_fetch_end not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
cstore_index_fetch_tuple(struct IndexFetchTableData *scan,
|
cstore_index_fetch_tuple(struct IndexFetchTableData *scan,
|
||||||
ItemPointer tid,
|
ItemPointer tid,
|
||||||
|
@ -236,6 +256,7 @@ cstore_index_fetch_tuple(struct IndexFetchTableData *scan,
|
||||||
elog(ERROR, "cstore_index_fetch_tuple not implemented");
|
elog(ERROR, "cstore_index_fetch_tuple not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
cstore_fetch_row_version(Relation relation,
|
cstore_fetch_row_version(Relation relation,
|
||||||
ItemPointer tid,
|
ItemPointer tid,
|
||||||
|
@ -245,6 +266,7 @@ cstore_fetch_row_version(Relation relation,
|
||||||
elog(ERROR, "cstore_fetch_row_version not implemented");
|
elog(ERROR, "cstore_fetch_row_version not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cstore_get_latest_tid(TableScanDesc sscan,
|
cstore_get_latest_tid(TableScanDesc sscan,
|
||||||
ItemPointer tid)
|
ItemPointer tid)
|
||||||
|
@ -252,12 +274,14 @@ cstore_get_latest_tid(TableScanDesc sscan,
|
||||||
elog(ERROR, "cstore_get_latest_tid not implemented");
|
elog(ERROR, "cstore_get_latest_tid not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
cstore_tuple_tid_valid(TableScanDesc scan, ItemPointer tid)
|
cstore_tuple_tid_valid(TableScanDesc scan, ItemPointer tid)
|
||||||
{
|
{
|
||||||
elog(ERROR, "cstore_tuple_tid_valid not implemented");
|
elog(ERROR, "cstore_tuple_tid_valid not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
cstore_tuple_satisfies_snapshot(Relation rel, TupleTableSlot *slot,
|
cstore_tuple_satisfies_snapshot(Relation rel, TupleTableSlot *slot,
|
||||||
Snapshot snapshot)
|
Snapshot snapshot)
|
||||||
|
@ -265,6 +289,7 @@ cstore_tuple_satisfies_snapshot(Relation rel, TupleTableSlot *slot,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static TransactionId
|
static TransactionId
|
||||||
cstore_compute_xid_horizon_for_tuples(Relation rel,
|
cstore_compute_xid_horizon_for_tuples(Relation rel,
|
||||||
ItemPointerData *tids,
|
ItemPointerData *tids,
|
||||||
|
@ -273,6 +298,7 @@ cstore_compute_xid_horizon_for_tuples(Relation rel,
|
||||||
elog(ERROR, "cstore_compute_xid_horizon_for_tuples not implemented");
|
elog(ERROR, "cstore_compute_xid_horizon_for_tuples not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cstore_tuple_insert(Relation relation, TupleTableSlot *slot, CommandId cid,
|
cstore_tuple_insert(Relation relation, TupleTableSlot *slot, CommandId cid,
|
||||||
int options, BulkInsertState bistate)
|
int options, BulkInsertState bistate)
|
||||||
|
@ -296,6 +322,7 @@ cstore_tuple_insert(Relation relation, TupleTableSlot *slot, CommandId cid,
|
||||||
CStoreWriteRow(CStoreWriteState, slot->tts_values, slot->tts_isnull);
|
CStoreWriteRow(CStoreWriteState, slot->tts_values, slot->tts_isnull);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cstore_tuple_insert_speculative(Relation relation, TupleTableSlot *slot,
|
cstore_tuple_insert_speculative(Relation relation, TupleTableSlot *slot,
|
||||||
CommandId cid, int options,
|
CommandId cid, int options,
|
||||||
|
@ -304,6 +331,7 @@ cstore_tuple_insert_speculative(Relation relation, TupleTableSlot *slot,
|
||||||
elog(ERROR, "cstore_tuple_insert_speculative not implemented");
|
elog(ERROR, "cstore_tuple_insert_speculative not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cstore_tuple_complete_speculative(Relation relation, TupleTableSlot *slot,
|
cstore_tuple_complete_speculative(Relation relation, TupleTableSlot *slot,
|
||||||
uint32 specToken, bool succeeded)
|
uint32 specToken, bool succeeded)
|
||||||
|
@ -311,6 +339,7 @@ cstore_tuple_complete_speculative(Relation relation, TupleTableSlot *slot,
|
||||||
elog(ERROR, "cstore_tuple_complete_speculative not implemented");
|
elog(ERROR, "cstore_tuple_complete_speculative not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
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)
|
||||||
|
@ -337,6 +366,7 @@ cstore_multi_insert(Relation relation, TupleTableSlot **slots, int ntuples,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static TM_Result
|
static TM_Result
|
||||||
cstore_tuple_delete(Relation relation, ItemPointer tid, CommandId cid,
|
cstore_tuple_delete(Relation relation, ItemPointer tid, CommandId cid,
|
||||||
Snapshot snapshot, Snapshot crosscheck, bool wait,
|
Snapshot snapshot, Snapshot crosscheck, bool wait,
|
||||||
|
@ -345,6 +375,7 @@ cstore_tuple_delete(Relation relation, ItemPointer tid, CommandId cid,
|
||||||
elog(ERROR, "cstore_tuple_delete not implemented");
|
elog(ERROR, "cstore_tuple_delete not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static TM_Result
|
static TM_Result
|
||||||
cstore_tuple_update(Relation relation, ItemPointer otid, TupleTableSlot *slot,
|
cstore_tuple_update(Relation relation, ItemPointer otid, TupleTableSlot *slot,
|
||||||
CommandId cid, Snapshot snapshot, Snapshot crosscheck,
|
CommandId cid, Snapshot snapshot, Snapshot crosscheck,
|
||||||
|
@ -354,6 +385,7 @@ cstore_tuple_update(Relation relation, ItemPointer otid, TupleTableSlot *slot,
|
||||||
elog(ERROR, "cstore_tuple_update not implemented");
|
elog(ERROR, "cstore_tuple_update not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static TM_Result
|
static TM_Result
|
||||||
cstore_tuple_lock(Relation relation, ItemPointer tid, Snapshot snapshot,
|
cstore_tuple_lock(Relation relation, ItemPointer tid, Snapshot snapshot,
|
||||||
TupleTableSlot *slot, CommandId cid, LockTupleMode mode,
|
TupleTableSlot *slot, CommandId cid, LockTupleMode mode,
|
||||||
|
@ -363,16 +395,18 @@ cstore_tuple_lock(Relation relation, ItemPointer tid, Snapshot snapshot,
|
||||||
elog(ERROR, "cstore_tuple_lock not implemented");
|
elog(ERROR, "cstore_tuple_lock not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cstore_finish_bulk_insert(Relation relation, int options)
|
cstore_finish_bulk_insert(Relation relation, int options)
|
||||||
{
|
{
|
||||||
//TODO: flush relation like for heap?
|
/*TODO: flush relation like for heap? */
|
||||||
// free write state or only in ExecutorEnd_hook?
|
/* free write state or only in ExecutorEnd_hook? */
|
||||||
|
|
||||||
// for COPY
|
/* for COPY */
|
||||||
cstore_free_write_state();
|
cstore_free_write_state();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cstore_relation_set_new_filenode(Relation rel,
|
cstore_relation_set_new_filenode(Relation rel,
|
||||||
const RelFileNode *newrnode,
|
const RelFileNode *newrnode,
|
||||||
|
@ -390,18 +424,21 @@ cstore_relation_set_new_filenode(Relation rel,
|
||||||
smgrclose(srel);
|
smgrclose(srel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cstore_relation_nontransactional_truncate(Relation rel)
|
cstore_relation_nontransactional_truncate(Relation rel)
|
||||||
{
|
{
|
||||||
elog(ERROR, "cstore_relation_nontransactional_truncate not implemented");
|
elog(ERROR, "cstore_relation_nontransactional_truncate not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cstore_relation_copy_data(Relation rel, const RelFileNode *newrnode)
|
cstore_relation_copy_data(Relation rel, const RelFileNode *newrnode)
|
||||||
{
|
{
|
||||||
elog(ERROR, "cstore_relation_copy_data not implemented");
|
elog(ERROR, "cstore_relation_copy_data not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cstore_relation_copy_for_cluster(Relation OldHeap, Relation NewHeap,
|
cstore_relation_copy_for_cluster(Relation OldHeap, Relation NewHeap,
|
||||||
Relation OldIndex, bool use_sort,
|
Relation OldIndex, bool use_sort,
|
||||||
|
@ -415,6 +452,7 @@ cstore_relation_copy_for_cluster(Relation OldHeap, Relation NewHeap,
|
||||||
elog(ERROR, "cstore_relation_copy_for_cluster not implemented");
|
elog(ERROR, "cstore_relation_copy_for_cluster not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
cstore_scan_analyze_next_block(TableScanDesc scan, BlockNumber blockno,
|
cstore_scan_analyze_next_block(TableScanDesc scan, BlockNumber blockno,
|
||||||
BufferAccessStrategy bstrategy)
|
BufferAccessStrategy bstrategy)
|
||||||
|
@ -422,6 +460,7 @@ cstore_scan_analyze_next_block(TableScanDesc scan, BlockNumber blockno,
|
||||||
elog(ERROR, "cstore_scan_analyze_next_block not implemented");
|
elog(ERROR, "cstore_scan_analyze_next_block not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
cstore_scan_analyze_next_tuple(TableScanDesc scan, TransactionId OldestXmin,
|
cstore_scan_analyze_next_tuple(TableScanDesc scan, TransactionId OldestXmin,
|
||||||
double *liverows, double *deadrows,
|
double *liverows, double *deadrows,
|
||||||
|
@ -430,6 +469,7 @@ cstore_scan_analyze_next_tuple(TableScanDesc scan, TransactionId OldestXmin,
|
||||||
elog(ERROR, "cstore_scan_analyze_next_tuple not implemented");
|
elog(ERROR, "cstore_scan_analyze_next_tuple not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static double
|
static double
|
||||||
cstore_index_build_range_scan(Relation heapRelation,
|
cstore_index_build_range_scan(Relation heapRelation,
|
||||||
Relation indexRelation,
|
Relation indexRelation,
|
||||||
|
@ -446,6 +486,7 @@ cstore_index_build_range_scan(Relation heapRelation,
|
||||||
elog(ERROR, "cstore_index_build_range_scan not implemented");
|
elog(ERROR, "cstore_index_build_range_scan not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cstore_index_validate_scan(Relation heapRelation,
|
cstore_index_validate_scan(Relation heapRelation,
|
||||||
Relation indexRelation,
|
Relation indexRelation,
|
||||||
|
@ -456,6 +497,7 @@ cstore_index_validate_scan(Relation heapRelation,
|
||||||
elog(ERROR, "cstore_index_validate_scan not implemented");
|
elog(ERROR, "cstore_index_validate_scan not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static uint64
|
static uint64
|
||||||
cstore_relation_size(Relation rel, ForkNumber forkNumber)
|
cstore_relation_size(Relation rel, ForkNumber forkNumber)
|
||||||
{
|
{
|
||||||
|
@ -468,20 +510,26 @@ cstore_relation_size(Relation rel, ForkNumber forkNumber)
|
||||||
if (forkNumber == InvalidForkNumber)
|
if (forkNumber == InvalidForkNumber)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MAX_FORKNUM; i++)
|
for (int i = 0; i < MAX_FORKNUM; i++)
|
||||||
|
{
|
||||||
nblocks += smgrnblocks(rel->rd_smgr, i);
|
nblocks += smgrnblocks(rel->rd_smgr, i);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
nblocks = smgrnblocks(rel->rd_smgr, forkNumber);
|
nblocks = smgrnblocks(rel->rd_smgr, forkNumber);
|
||||||
|
}
|
||||||
|
|
||||||
return nblocks * BLCKSZ;
|
return nblocks * BLCKSZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
cstore_relation_needs_toast_table(Relation rel)
|
cstore_relation_needs_toast_table(Relation rel)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cstore_estimate_rel_size(Relation rel, int32 *attr_widths,
|
cstore_estimate_rel_size(Relation rel, int32 *attr_widths,
|
||||||
BlockNumber *pages, double *tuples,
|
BlockNumber *pages, double *tuples,
|
||||||
|
@ -493,6 +541,7 @@ cstore_estimate_rel_size(Relation rel, int32 *attr_widths,
|
||||||
*allvisfrac = 1.0;
|
*allvisfrac = 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
cstore_scan_bitmap_next_block(TableScanDesc scan,
|
cstore_scan_bitmap_next_block(TableScanDesc scan,
|
||||||
TBMIterateResult *tbmres)
|
TBMIterateResult *tbmres)
|
||||||
|
@ -500,6 +549,7 @@ cstore_scan_bitmap_next_block(TableScanDesc scan,
|
||||||
elog(ERROR, "cstore_scan_bitmap_next_block not implemented");
|
elog(ERROR, "cstore_scan_bitmap_next_block not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
cstore_scan_bitmap_next_tuple(TableScanDesc scan,
|
cstore_scan_bitmap_next_tuple(TableScanDesc scan,
|
||||||
TBMIterateResult *tbmres,
|
TBMIterateResult *tbmres,
|
||||||
|
@ -508,12 +558,14 @@ cstore_scan_bitmap_next_tuple(TableScanDesc scan,
|
||||||
elog(ERROR, "cstore_scan_bitmap_next_tuple not implemented");
|
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)
|
||||||
{
|
{
|
||||||
elog(ERROR, "cstore_scan_sample_next_block not implemented");
|
elog(ERROR, "cstore_scan_sample_next_block not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
cstore_scan_sample_next_tuple(TableScanDesc scan, SampleScanState *scanstate,
|
cstore_scan_sample_next_tuple(TableScanDesc scan, SampleScanState *scanstate,
|
||||||
TupleTableSlot *slot)
|
TupleTableSlot *slot)
|
||||||
|
@ -521,16 +573,22 @@ cstore_scan_sample_next_tuple(TableScanDesc scan, SampleScanState *scanstate,
|
||||||
elog(ERROR, "cstore_scan_sample_next_tuple not implemented");
|
elog(ERROR, "cstore_scan_sample_next_tuple not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
CStoreExecutorEnd(QueryDesc *queryDesc)
|
CStoreExecutorEnd(QueryDesc *queryDesc)
|
||||||
{
|
{
|
||||||
cstore_free_write_state();
|
cstore_free_write_state();
|
||||||
if (PreviousExecutorEndHook)
|
if (PreviousExecutorEndHook)
|
||||||
|
{
|
||||||
PreviousExecutorEndHook(queryDesc);
|
PreviousExecutorEndHook(queryDesc);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
standard_ExecutorEnd(queryDesc);
|
standard_ExecutorEnd(queryDesc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
cstore_tableam_init()
|
cstore_tableam_init()
|
||||||
{
|
{
|
||||||
|
@ -538,12 +596,14 @@ cstore_tableam_init()
|
||||||
ExecutorEnd_hook = CStoreExecutorEnd;
|
ExecutorEnd_hook = CStoreExecutorEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
cstore_tableam_finish()
|
cstore_tableam_finish()
|
||||||
{
|
{
|
||||||
ExecutorEnd_hook = PreviousExecutorEndHook;
|
ExecutorEnd_hook = PreviousExecutorEndHook;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static const TableAmRoutine cstore_am_methods = {
|
static const TableAmRoutine cstore_am_methods = {
|
||||||
.type = T_TableAmRoutine,
|
.type = T_TableAmRoutine,
|
||||||
|
|
||||||
|
@ -606,6 +666,7 @@ GetCstoreTableAmRoutine(void)
|
||||||
return &cstore_am_methods;
|
return &cstore_am_methods;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PG_FUNCTION_INFO_V1(cstore_tableam_handler);
|
PG_FUNCTION_INFO_V1(cstore_tableam_handler);
|
||||||
Datum
|
Datum
|
||||||
cstore_tableam_handler(PG_FUNCTION_ARGS)
|
cstore_tableam_handler(PG_FUNCTION_ARGS)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "fmgr.h"
|
#include "fmgr.h"
|
||||||
#include "access/tableam.h"
|
#include "access/tableam.h"
|
||||||
|
|
||||||
const TableAmRoutine *GetCstoreTableAmRoutine(void);
|
const TableAmRoutine * GetCstoreTableAmRoutine(void);
|
||||||
Datum cstore_tableam_handler(PG_FUNCTION_ARGS);
|
Datum cstore_tableam_handler(PG_FUNCTION_ARGS);
|
||||||
extern void cstore_free_write_state(void);
|
extern void cstore_free_write_state(void);
|
||||||
extern void cstore_tableam_init(void);
|
extern void cstore_tableam_init(void);
|
||||||
|
|
Loading…
Reference in New Issue