Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 1 addition & 47 deletions src/columnar.h
Original file line number Diff line number Diff line change
Expand Up @@ -344,26 +344,8 @@ typedef struct PgColumnarProjection
* ------------------------------------------------------------------------- */
struct SMgrRelationData;

extern void PgColumnarWriteNewMetapage(const RelFileLocator *newrlocator,
struct SMgrRelationData *srel,
char persistence, uint64 storageId);
extern void PgColumnarReadMetapage(Relation rel, PgColumnarMetapage *meta);
extern uint64 PgColumnarStorageId(Relation rel);
extern void PgColumnarEnsureStorageRow(Relation rel); /* pre-create storage row (#300 parallel_copy) */
extern void PgColumnarReserveRowNumbers(Relation rel, uint64 rowCount,
uint64 *stripeId, uint64 *firstRowNumber);
extern void PgColumnarReserveOffset(Relation rel, uint64 dataLength,
uint64 *fileOffset);
extern void PgColumnarAdvanceReservedOffset(Relation rel, uint64 addBytes);
extern void PgColumnarDebugSetMetapageVersion(Relation rel, uint32 versionMajor,
uint32 versionMinor);
extern void PgColumnarSetReservedOffset(Relation rel, uint64 newOffset);
extern void PgColumnarTruncateMainFork(Relation rel, BlockNumber newnblocks);
extern void PgColumnarWriteLogicalData(Relation rel, uint64 logicalOffset,
char *data, uint64 length);
extern void PgColumnarReadLogicalData(Relation rel, uint64 logicalOffset,
char *dest, uint64 length);
extern void PgColumnarResetMetapage(Relation rel);

/* row number <-> item pointer (spec 6) */
extern void PgColumnarRowNumberToItemPointer(uint64 rowNumber, ItemPointer tid);
Expand Down Expand Up @@ -453,8 +435,7 @@ extern void PgColumnarCheckFreeSpaceNoOverlap(uint64 storageId);
extern uint64 PgColumnarNextStorageId(void);

/* projection: needed attnos (pull_varattnos form) -> the reader's 0-based set */
extern Bitmapset *PgColumnarProjectionFromAttnos(Bitmapset *needed, int natts,
int *nProjected);

extern void PgColumnarCheckNativeFormatVersion(uint64 storageId, const char *relName);
extern List *PgColumnarReadRowGroupList(uint64 storageId, Snapshot snapshot);
extern List *PgColumnarReadZoneMapList(uint64 storageId, uint64 groupNumber,
Expand Down Expand Up @@ -503,37 +484,17 @@ extern void PgColumnarUpsertDeleteVector(uint64 storageId, DeleteVectorMetadata
typedef struct PgColumnarWriteState PgColumnarWriteState;

extern PgColumnarWriteState *PgColumnarGetWriteState(Relation rel);
extern int PgColumnarWriteStateStripeCount(PgColumnarWriteState *ws);
extern uint64 *PgColumnarWriteStateStripeIds(PgColumnarWriteState *ws, int *n);
extern uint64 *PgColumnarWriteStateProjStripeIds(PgColumnarWriteState *ws, int *n);
extern uint64 PgColumnarWriteRow(PgColumnarWriteState *writeState, Relation rel,
Datum *values, bool *nulls);
extern void PgColumnarProjectionFanoutRow(Relation rel, PgColumnarWriteState *baseWs,
uint64 rowNumber, Datum *values,
bool *nulls);
extern void PgColumnarBackfillProjection(Relation rel,
const PgColumnarProjection *proj);
extern bool PgColumnarBufferedRowByNumber(Relation rel, uint64 rowNumber,
Datum *values, bool *nulls);
extern void PgColumnarFlushWriteStateForRelation(Oid relid);
extern void PgColumnarForgetWriteStateForRelation(Oid relid);
extern void PgColumnarFlushAllPendingWrites(void);
extern void PgColumnarDiscardAllPendingWrites(void);
extern void PgColumnarWriteStateDiscardSubXact(SubTransactionId subid);
extern void PgColumnarWriteStatePromoteSubXact(SubTransactionId subid,
SubTransactionId parent);

/* -------------------------------------------------------------------------
* delete vector / delete tracking (pgcolumnar_delete_vector.c, spec 7.5, 9)
* ------------------------------------------------------------------------- */
extern void PgColumnarMarkRowDeleted(Relation rel, uint64 rowNumber);
extern bool PgColumnarDeleteVectorBufferedDeleted(Relation rel, uint64 rowNumber);
extern void PgColumnarFlushDeleteVectorForRelation(Relation rel);
extern void PgColumnarFlushAllDeleteVectors(void);
extern void PgColumnarDiscardAllDeleteVectors(void);
extern void PgColumnarDeleteVectorDiscardSubXact(SubTransactionId subid);
extern void PgColumnarDeleteVectorPromoteSubXact(SubTransactionId subid,
SubTransactionId parent);

/* -------------------------------------------------------------------------
* reader (pgcolumnar_reader.c)
Expand Down Expand Up @@ -831,7 +792,6 @@ extern void PgColumnarUniqueInit(void);
/* -------------------------------------------------------------------------
* planner integration (pgcolumnar_customscan.c, spec 8.3, 9)
* ------------------------------------------------------------------------- */
extern void PgColumnarCustomScanInit(void);

/*
* The single registered CustomScanMethods, shared by the base custom scan and
Expand Down Expand Up @@ -899,12 +859,6 @@ typedef struct PgColumnarGroupStats
uint64 vectorsRuledOutByValue;
} PgColumnarGroupStats;

extern void PgColumnarExplainPushedDown(int64 nfilters, ExplainState *es);
extern void PgColumnarExplainVectorPredicates(int64 npreds, ExplainState *es);
extern int PgColumnarCountScanKeys(List *qual, Index scanrelid,
TupleDesc tupdesc);
extern void PgColumnarExplainGroupStats(const PgColumnarGroupStats *stats,
ExplainState *es);

extern ScanKey PgColumnarBuildScanKeys(List *qual, Index scanrelid,
TupleDesc tupdesc, int *nkeys);
Expand Down
1 change: 1 addition & 0 deletions src/columnar_customscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*/
#include "columnar.h"

#include "columnar_customscan.h"
#include "columnar_reader.h"
#include <math.h>

Expand Down
37 changes: 37 additions & 0 deletions src/columnar_customscan.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*-------------------------------------------------------------------------
*
* columnar_customscan.h
* The planner side: what columnar_customscan.c offers the table AM and the vectorized path.
*
* Split out of columnar.h (#496). Every declaration here had exactly ONE
* consumer outside its defining file, so it was a private arrangement between
* two files that the other twenty were forced to recompile for.
*
* The shared vocabulary these signatures take stays in columnar.h, which this
* includes.
*
* Written fresh for pgColumnar.
*
*-------------------------------------------------------------------------
*/
#ifndef PGCOLUMNAR_CUSTOMSCAN_H
#define PGCOLUMNAR_CUSTOMSCAN_H

#include "columnar.h"

extern Bitmapset *PgColumnarProjectionFromAttnos(Bitmapset *needed, int natts,
int *nProjected);

extern void PgColumnarCustomScanInit(void);

extern void PgColumnarExplainPushedDown(int64 nfilters, ExplainState *es);

extern void PgColumnarExplainVectorPredicates(int64 npreds, ExplainState *es);

extern int PgColumnarCountScanKeys(List *qual, Index scanrelid,
TupleDesc tupdesc);

extern void PgColumnarExplainGroupStats(const PgColumnarGroupStats *stats,
ExplainState *es);

#endif /* PGCOLUMNAR_CUSTOMSCAN_H */
1 change: 1 addition & 0 deletions src/columnar_delete_vector.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/
#include "columnar.h"

#include "columnar_delete_vector.h"
#include "access/xact.h"
#include "utils/memutils.h"
#include "utils/rel.h"
Expand Down
35 changes: 35 additions & 0 deletions src/columnar_delete_vector.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*-------------------------------------------------------------------------
*
* columnar_delete_vector.h
* Row deletion: what columnar_delete_vector.c offers the reader and the table AM.
*
* Split out of columnar.h (#496). Every declaration here had exactly ONE
* consumer outside its defining file, so it was a private arrangement between
* two files that the other twenty were forced to recompile for.
*
* The shared vocabulary these signatures take stays in columnar.h, which this
* includes.
*
* Written fresh for pgColumnar.
*
*-------------------------------------------------------------------------
*/
#ifndef PGCOLUMNAR_DELETE_VECTOR_H
#define PGCOLUMNAR_DELETE_VECTOR_H

#include "columnar.h"

extern void PgColumnarMarkRowDeleted(Relation rel, uint64 rowNumber);

extern bool PgColumnarDeleteVectorBufferedDeleted(Relation rel, uint64 rowNumber);

extern void PgColumnarFlushAllDeleteVectors(void);

extern void PgColumnarDiscardAllDeleteVectors(void);

extern void PgColumnarDeleteVectorDiscardSubXact(SubTransactionId subid);

extern void PgColumnarDeleteVectorPromoteSubXact(SubTransactionId subid,
SubTransactionId parent);

#endif /* PGCOLUMNAR_DELETE_VECTOR_H */
1 change: 1 addition & 0 deletions src/columnar_parallel_copy.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

#include "columnar.h"

#include "columnar_write_state.h"
#include "access/relation.h"
#include "access/table.h"
#include "access/twophase.h"
Expand Down
1 change: 1 addition & 0 deletions src/columnar_projection.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "columnar.h"

#include "columnar_metadata.h"
#include "columnar_write_state.h"
#include "access/table.h"
#include "catalog/pg_type.h"
#include "funcapi.h"
Expand Down
2 changes: 2 additions & 0 deletions src/columnar_reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
*/
#include "columnar.h"

#include "columnar_delete_vector.h"
#include "columnar_metadata.h"
#include "columnar_reader.h"
#include "columnar_storage.h"
#include "fmgr.h"
#include "access/detoast.h"
#include "access/htup_details.h"
Expand Down
1 change: 1 addition & 0 deletions src/columnar_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/
#include "columnar.h"

#include "columnar_storage.h"
#include "fmgr.h"
#include "columnar_compat.h"
#include "access/rmgr.h"
Expand Down
49 changes: 49 additions & 0 deletions src/columnar_storage.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*-------------------------------------------------------------------------
*
* columnar_storage.h
* The physical layer: what columnar_storage.c offers for metapages, offsets and logical data.
*
* Split out of columnar.h (#496). Every declaration here had exactly ONE
* consumer outside its defining file, so it was a private arrangement between
* two files that the other twenty were forced to recompile for.
*
* The shared vocabulary these signatures take stays in columnar.h, which this
* includes.
*
* Written fresh for pgColumnar.
*
*-------------------------------------------------------------------------
*/
#ifndef PGCOLUMNAR_STORAGE_H
#define PGCOLUMNAR_STORAGE_H

#include "columnar.h"

extern void PgColumnarWriteNewMetapage(const RelFileLocator *newrlocator,
struct SMgrRelationData *srel,
char persistence, uint64 storageId);

extern void PgColumnarReserveRowNumbers(Relation rel, uint64 rowCount,
uint64 *stripeId, uint64 *firstRowNumber);

extern void PgColumnarReserveOffset(Relation rel, uint64 dataLength,
uint64 *fileOffset);

extern void PgColumnarAdvanceReservedOffset(Relation rel, uint64 addBytes);

extern void PgColumnarDebugSetMetapageVersion(Relation rel, uint32 versionMajor,
uint32 versionMinor);

extern void PgColumnarSetReservedOffset(Relation rel, uint64 newOffset);

extern void PgColumnarTruncateMainFork(Relation rel, BlockNumber newnblocks);

extern void PgColumnarWriteLogicalData(Relation rel, uint64 logicalOffset,
char *data, uint64 length);

extern void PgColumnarReadLogicalData(Relation rel, uint64 logicalOffset,
char *dest, uint64 length);

extern void PgColumnarResetMetapage(Relation rel);

#endif /* PGCOLUMNAR_STORAGE_H */
4 changes: 4 additions & 0 deletions src/columnar_tableam.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@
*/
#include "columnar.h"

#include "columnar_customscan.h"
#include "columnar_delete_vector.h"
#include "columnar_metadata.h"
#include "columnar_reader.h"
#include "columnar_storage.h"
#include "columnar_write_state.h"
#include "access/multixact.h"
#include "access/genam.h"
#include "access/table.h"
Expand Down
2 changes: 2 additions & 0 deletions src/columnar_vacuum.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
*/
#include "columnar.h"
#include "columnar_metadata.h"
#include "columnar_storage.h"
#include "columnar_write_state.h"
#include "columnar_compat.h"

#include "fmgr.h"
Expand Down
1 change: 1 addition & 0 deletions src/columnar_vector.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
*/
#include "columnar.h"

#include "columnar_customscan.h"
#include "columnar_metadata.h"
#include "columnar_reader.h"
#include <math.h>
Expand Down
2 changes: 2 additions & 0 deletions src/columnar_write_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include "columnar.h"

#include "columnar_metadata.h"
#include "columnar_storage.h"
#include "columnar_write_state.h"
#include "columnar_compat.h"
#include "access/htup_details.h"
#include "access/table.h"
Expand Down
47 changes: 47 additions & 0 deletions src/columnar_write_state.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*-------------------------------------------------------------------------
*
* columnar_write_state.h
* The write side: what columnar_write_state.c offers the modules that stage and flush rows.
*
* Split out of columnar.h (#496). Every declaration here had exactly ONE
* consumer outside its defining file, so it was a private arrangement between
* two files that the other twenty were forced to recompile for.
*
* The shared vocabulary these signatures take stays in columnar.h, which this
* includes.
*
* Written fresh for pgColumnar.
*
*-------------------------------------------------------------------------
*/
#ifndef PGCOLUMNAR_WRITE_STATE_H
#define PGCOLUMNAR_WRITE_STATE_H

#include "columnar.h"

extern void PgColumnarEnsureStorageRow(Relation rel); /* pre-create storage row (#300 parallel_copy) */

extern int PgColumnarWriteStateStripeCount(PgColumnarWriteState *ws);

extern uint64 *PgColumnarWriteStateStripeIds(PgColumnarWriteState *ws, int *n);

extern uint64 *PgColumnarWriteStateProjStripeIds(PgColumnarWriteState *ws, int *n);

extern void PgColumnarBackfillProjection(Relation rel,
const PgColumnarProjection *proj);

extern bool PgColumnarBufferedRowByNumber(Relation rel, uint64 rowNumber,
Datum *values, bool *nulls);

extern void PgColumnarForgetWriteStateForRelation(Oid relid);

extern void PgColumnarFlushAllPendingWrites(void);

extern void PgColumnarDiscardAllPendingWrites(void);

extern void PgColumnarWriteStateDiscardSubXact(SubTransactionId subid);

extern void PgColumnarWriteStatePromoteSubXact(SubTransactionId subid,
SubTransactionId parent);

#endif /* PGCOLUMNAR_WRITE_STATE_H */
Loading