mirror of https://github.com/citusdata/citus.git
fix indentation via citus_indent
parent
20a8bca426
commit
1e93e15a8d
2
cstore.h
2
cstore.h
|
@ -204,6 +204,7 @@ typedef struct TableReadState
|
|||
TableMetadata *tableMetadata;
|
||||
TupleDesc tupleDescriptor;
|
||||
Relation relation;
|
||||
|
||||
/*
|
||||
* List of Var pointers for columns in the query. We use this both for
|
||||
* getting vector of projected columns, and also when we want to build
|
||||
|
@ -320,4 +321,5 @@ logical_to_smgr(uint64 logicalOffset)
|
|||
return addr;
|
||||
}
|
||||
|
||||
|
||||
#endif /* CSTORE_H */
|
||||
|
|
18
cstore_fdw.c
18
cstore_fdw.c
|
@ -833,6 +833,7 @@ TruncateCStoreTables(List *cstoreRelationList)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Version 11 and earlier already assign a relfilenode for foreign
|
||||
* tables. Version 12 and later do not, so we need to create one manually.
|
||||
|
@ -849,8 +850,10 @@ FdwNewRelFileNode(Relation relation)
|
|||
tuple = SearchSysCacheCopy1(RELOID,
|
||||
ObjectIdGetDatum(RelationGetRelid(relation)));
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
{
|
||||
elog(ERROR, "could not find tuple for relation %u",
|
||||
RelationGetRelid(relation));
|
||||
}
|
||||
classform = (Form_pg_class) GETSTRUCT(tuple);
|
||||
|
||||
if (true)
|
||||
|
@ -870,12 +873,18 @@ FdwNewRelFileNode(Relation relation)
|
|||
heap_close(tmprel, NoLock);
|
||||
|
||||
if (OidIsValid(relation->rd_rel->relfilenode))
|
||||
{
|
||||
RelationDropStorage(relation);
|
||||
}
|
||||
|
||||
if (OidIsValid(relation->rd_rel->reltablespace))
|
||||
{
|
||||
tablespace = relation->rd_rel->reltablespace;
|
||||
}
|
||||
else
|
||||
{
|
||||
tablespace = MyDatabaseTableSpace;
|
||||
}
|
||||
|
||||
filenode = GetNewRelFileNode(tablespace, NULL, persistence);
|
||||
|
||||
|
@ -898,6 +907,7 @@ FdwNewRelFileNode(Relation relation)
|
|||
heap_close(pg_class, RowExclusiveLock);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
FdwCreateStorage(Relation relation)
|
||||
{
|
||||
|
@ -2187,16 +2197,22 @@ cstore_fdw_initrel(Relation rel)
|
|||
{
|
||||
#if PG_VERSION_NUM >= 120000
|
||||
if (rel->rd_rel->relfilenode == InvalidOid)
|
||||
{
|
||||
FdwNewRelFileNode(rel);
|
||||
}
|
||||
|
||||
/*
|
||||
* Copied code from RelationInitPhysicalAddr(), which doesn't
|
||||
* work on foreign tables.
|
||||
*/
|
||||
if (OidIsValid(rel->rd_rel->reltablespace))
|
||||
{
|
||||
rel->rd_node.spcNode = rel->rd_rel->reltablespace;
|
||||
}
|
||||
else
|
||||
{
|
||||
rel->rd_node.spcNode = MyDatabaseTableSpace;
|
||||
}
|
||||
|
||||
rel->rd_node.dbNode = MyDatabaseId;
|
||||
rel->rd_node.relNode = rel->rd_rel->relfilenode;
|
||||
|
@ -2204,6 +2220,7 @@ cstore_fdw_initrel(Relation rel)
|
|||
FdwCreateStorage(rel);
|
||||
}
|
||||
|
||||
|
||||
static Relation
|
||||
cstore_fdw_open(Oid relationId, LOCKMODE lockmode)
|
||||
{
|
||||
|
@ -2214,6 +2231,7 @@ cstore_fdw_open(Oid relationId, LOCKMODE lockmode)
|
|||
return rel;
|
||||
}
|
||||
|
||||
|
||||
static Relation
|
||||
cstore_fdw_openrv(RangeVar *relation, LOCKMODE lockmode)
|
||||
{
|
||||
|
|
|
@ -692,9 +692,12 @@ create_estate_for_relation(Relation rel)
|
|||
estate->es_output_cid = GetCurrentCommandId(true);
|
||||
|
||||
#if PG_VERSION_NUM < 120000
|
||||
|
||||
/* Triggers might need a slot */
|
||||
if (resultRelInfo->ri_TrigDesc)
|
||||
{
|
||||
estate->es_trig_tuple_slot = ExecInitExtraTupleSlot(estate, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Prepare to catch AFTER triggers. */
|
||||
|
|
|
@ -1037,6 +1037,7 @@ ColumnDefaultValue(TupleConstr *tupleConstraints, Form_pg_attribute attributeFor
|
|||
return defaultValue;
|
||||
}
|
||||
|
||||
|
||||
static StringInfo
|
||||
ReadFromSmgr(Relation rel, uint64 offset, uint32 size)
|
||||
{
|
||||
|
@ -1067,6 +1068,7 @@ ReadFromSmgr(Relation rel, uint64 offset, uint32 size)
|
|||
return resultBuffer;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ResetUncompressedBlockData iterates over deserialized column block data
|
||||
* and sets valueBuffer field to empty buffer. This field is allocated in stripe
|
||||
|
|
|
@ -363,6 +363,7 @@ CreateEmptyStripeSkipList(uint32 stripeMaxRowCount, uint32 blockRowCount,
|
|||
return stripeSkipList;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
WriteToSmgr(TableWriteState *writeState, char *data, uint32 dataLength)
|
||||
{
|
||||
|
@ -397,7 +398,9 @@ WriteToSmgr(TableWriteState *writeState, char *data, uint32 dataLength)
|
|||
page = BufferGetPage(buffer);
|
||||
phdr = (PageHeader) page;
|
||||
if (PageIsNew(page))
|
||||
{
|
||||
PageInit(page, BLCKSZ, 0);
|
||||
}
|
||||
|
||||
/* always appending */
|
||||
Assert(phdr->pd_lower == addr.offset);
|
||||
|
@ -434,6 +437,7 @@ WriteToSmgr(TableWriteState *writeState, char *data, uint32 dataLength)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* FlushStripe flushes current stripe data into the file. The function first ensures
|
||||
* the last data block for each column is properly serialized and compressed. Then,
|
||||
|
@ -832,6 +836,7 @@ AppendStripeMetadata(TableMetadata *tableMetadata, StripeMetadata stripeMetadata
|
|||
stripeMetadataCopy);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* CopyStringInfo creates a deep copy of given source string allocating only needed
|
||||
* amount of memory.
|
||||
|
|
Loading…
Reference in New Issue