mirror of https://github.com/citusdata/citus.git
Format csql's stage files
These are entirely Citus-produced, so need full formatting.pull/327/head
parent
19c529f311
commit
920e0c406d
|
@ -26,7 +26,8 @@
|
|||
static bool FileSize(char *filename, uint64 *fileSize);
|
||||
static PGconn * ConnectToWorkerNode(const char *nodeName, uint32 nodePort,
|
||||
const char *nodeDatabase);
|
||||
static PGresult * ExecuteRemoteCommand(PGconn *remoteConnection, const char *remoteCommand,
|
||||
static PGresult * ExecuteRemoteCommand(PGconn *remoteConnection,
|
||||
const char *remoteCommand,
|
||||
const char **parameterValues, int parameterCount);
|
||||
static TableMetadata * InitTableMetadata(const char *tableName);
|
||||
static ShardMetadata * InitShardMetadata(int shardPlacementPolicy);
|
||||
|
@ -41,7 +42,8 @@ static uint64 GetValueUint64(const PGresult *result, int rowNumber, int columnNu
|
|||
static bool MasterGetTableMetadata(const char *tableName, TableMetadata *tableMetadata);
|
||||
static bool MasterGetTableDDLEvents(const char *tableName, TableMetadata *tableMetadata);
|
||||
static bool MasterGetNewShardId(ShardMetadata *shardMetadata);
|
||||
static bool MasterGetCandidateNodes(ShardMetadata *shardMetadata, int shardPlacementPolicy);
|
||||
static bool MasterGetCandidateNodes(ShardMetadata *shardMetadata,
|
||||
int shardPlacementPolicy);
|
||||
static bool MasterInsertShardRow(uint32 logicalRelid, char storageType,
|
||||
const ShardMetadata *shardMetadata);
|
||||
static bool MasterInsertPlacementRows(const ShardMetadata *shardMetadata);
|
||||
|
@ -62,7 +64,8 @@ static bool ApplyShardDDLCommand(PGconn *workerNode, uint64 shardId, const char
|
|||
static bool TransmitTableData(PGconn *workerNode, uint64 shardId,
|
||||
uint64 shardMaxSize, copy_options *stageOptions,
|
||||
uint64 currentFileOffset, uint64 *nextFileOffset);
|
||||
static bool TransmitFile(PGconn *workerNode, const char *localPath, const char *remotePath);
|
||||
static bool TransmitFile(PGconn *workerNode, const char *localPath,
|
||||
const char *remotePath);
|
||||
static bool FileStreamOK(const copy_options *stageOptions);
|
||||
static PQExpBuffer CreateCopyQueryString(const char *tableName, const char *columnList,
|
||||
const char *afterToFrom);
|
||||
|
@ -341,7 +344,6 @@ DoStageData(const char *stageCommand)
|
|||
|
||||
/* update current file offset */
|
||||
currentFileOffset = nextFileOffset;
|
||||
|
||||
} /* while more file data left for sharding */
|
||||
|
||||
/*
|
||||
|
|
|
@ -33,17 +33,19 @@
|
|||
#define MASTER_GET_TABLE_METADATA "SELECT * FROM master_get_table_metadata($1::text)"
|
||||
#define MASTER_GET_TABLE_DDL_EVENTS "SELECT * FROM master_get_table_ddl_events($1::text)"
|
||||
#define MASTER_GET_NEW_SHARDID "SELECT * FROM master_get_new_shardid()"
|
||||
#define MASTER_GET_LOCAL_FIRST_CANDIDATE_NODES "SELECT * FROM \
|
||||
master_get_local_first_candidate_nodes()"
|
||||
#define MASTER_GET_ROUND_ROBIN_CANDIDATE_NODES "SELECT * FROM \
|
||||
master_get_round_robin_candidate_nodes($1::int8)"
|
||||
#define MASTER_GET_LOCAL_FIRST_CANDIDATE_NODES \
|
||||
"SELECT * FROM master_get_local_first_candidate_nodes()"
|
||||
#define MASTER_GET_ROUND_ROBIN_CANDIDATE_NODES \
|
||||
"SELECT * FROM master_get_round_robin_candidate_nodes($1::int8)"
|
||||
|
||||
#define MASTER_INSERT_SHARD_ROW "INSERT INTO pg_dist_shard \
|
||||
(logicalrelid, shardid, shardstorage, shardminvalue, shardmaxvalue) VALUES \
|
||||
($1::oid, $2::int8, $3::char, $4::text, $5::text)"
|
||||
#define MASTER_INSERT_PLACEMENT_ROW "INSERT INTO pg_dist_shard_placement \
|
||||
(shardid, shardstate, shardlength, nodename, nodeport) VALUES \
|
||||
($1::int8, $2::int4, $3::int8, $4::text, $5::int4)"
|
||||
#define MASTER_INSERT_SHARD_ROW \
|
||||
"INSERT INTO pg_dist_shard " \
|
||||
"(logicalrelid, shardid, shardstorage, shardminvalue, shardmaxvalue) VALUES " \
|
||||
"($1::oid, $2::int8, $3::char, $4::text, $5::text)"
|
||||
#define MASTER_INSERT_PLACEMENT_ROW \
|
||||
"INSERT INTO pg_dist_shard_placement " \
|
||||
"(shardid, shardstate, shardlength, nodename, nodeport) VALUES " \
|
||||
"($1::int8, $2::int4, $3::int8, $4::text, $5::int4)"
|
||||
|
||||
/* Column names used to identify response fields as returned from the master. */
|
||||
#define LOGICAL_RELID_FIELD "logical_relid"
|
||||
|
@ -61,11 +63,11 @@
|
|||
#define SHARD_MIN_MAX_COMMAND "SELECT min(%s), max(%s) FROM %s"
|
||||
#define SHARD_TABLE_SIZE_COMMAND "SELECT pg_table_size('%s')"
|
||||
#define SET_FOREIGN_TABLE_FILENAME "ALTER FOREIGN TABLE %s OPTIONS (SET filename '%s')"
|
||||
#define GET_COLUMNAR_TABLE_FILENAME_OPTION "SELECT * FROM \
|
||||
(SELECT (pg_options_to_table(ftoptions)).* FROM pg_foreign_table \
|
||||
WHERE ftrelid = %u) AS Q WHERE option_name = 'filename';"
|
||||
#define APPLY_SHARD_DDL_COMMAND "SELECT * FROM worker_apply_shard_ddl_command \
|
||||
($1::int8, $2::text)"
|
||||
#define GET_COLUMNAR_TABLE_FILENAME_OPTION \
|
||||
"SELECT * FROM (SELECT (pg_options_to_table(ftoptions)).* FROM pg_foreign_table " \
|
||||
"WHERE ftrelid = %u) AS Q WHERE option_name = 'filename';"
|
||||
#define APPLY_SHARD_DDL_COMMAND \
|
||||
"SELECT * FROM worker_apply_shard_ddl_command ($1::int8, $2::text)"
|
||||
#define REMOTE_FILE_SIZE_COMMAND "SELECT size FROM pg_stat_file('%s')"
|
||||
#define SHARD_COLUMNAR_TABLE_SIZE_COMMAND "SELECT cstore_table_size('%s')"
|
||||
|
||||
|
@ -100,7 +102,6 @@ typedef struct TableMetadata
|
|||
|
||||
char **ddlEventList; /* DDL statements used for creating new shard */
|
||||
uint32 ddlEventCount; /* DDL statement count; statement list size */
|
||||
|
||||
} TableMetadata;
|
||||
|
||||
|
||||
|
@ -122,7 +123,6 @@ typedef struct ShardMetadata
|
|||
char *shardMinValue; /* partition key's minimum value in shard */
|
||||
char *shardMaxValue; /* partition key's maximum value in shard */
|
||||
uint64 shardSize; /* shard size; updated during staging */
|
||||
|
||||
} ShardMetadata;
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue