Make several COPY-related functions public

pull/1829/head
Marco Slot 2017-11-24 14:15:01 +01:00
parent 73989b07eb
commit bfcc76df69
2 changed files with 4 additions and 6 deletions

View File

@ -97,22 +97,18 @@ static void OpenCopyConnections(CopyStmt *copyStatement,
ShardConnections *shardConnections, bool stopOnFailure, ShardConnections *shardConnections, bool stopOnFailure,
bool useBinaryCopyFormat); bool useBinaryCopyFormat);
static bool CanUseBinaryCopyFormat(TupleDesc tupleDescription);
static bool BinaryOutputFunctionDefined(Oid typeId); static bool BinaryOutputFunctionDefined(Oid typeId);
static List * MasterShardPlacementList(uint64 shardId); static List * MasterShardPlacementList(uint64 shardId);
static List * RemoteFinalizedShardPlacementList(uint64 shardId); static List * RemoteFinalizedShardPlacementList(uint64 shardId);
static void SendCopyBinaryHeaders(CopyOutState copyOutState, int64 shardId, static void SendCopyBinaryHeaders(CopyOutState copyOutState, int64 shardId,
List *connectionList); List *connectionList);
static void SendCopyBinaryFooters(CopyOutState copyOutState, int64 shardId, static void SendCopyBinaryFooters(CopyOutState copyOutState, int64 shardId,
List *connectionList); List *connectionList);
static StringInfo ConstructCopyStatement(CopyStmt *copyStatement, int64 shardId, static StringInfo ConstructCopyStatement(CopyStmt *copyStatement, int64 shardId,
bool useBinaryCopyFormat); bool useBinaryCopyFormat);
static void SendCopyDataToAll(StringInfo dataBuffer, int64 shardId, List *connectionList); static void SendCopyDataToAll(StringInfo dataBuffer, int64 shardId, List *connectionList);
static void SendCopyDataToPlacement(StringInfo dataBuffer, int64 shardId, static void SendCopyDataToPlacement(StringInfo dataBuffer, int64 shardId,
MultiConnection *connection); MultiConnection *connection);
static void EndRemoteCopy(int64 shardId, List *connectionList, bool stopOnFailure);
static void ReportCopyError(MultiConnection *connection, PGresult *result); static void ReportCopyError(MultiConnection *connection, PGresult *result);
static uint32 AvailableColumnCount(TupleDesc tupleDescriptor); static uint32 AvailableColumnCount(TupleDesc tupleDescriptor);
static int64 StartCopyToNewShard(ShardConnections *shardConnections, static int64 StartCopyToNewShard(ShardConnections *shardConnections,
@ -904,7 +900,7 @@ OpenCopyConnections(CopyStmt *copyStatement, ShardConnections *shardConnections,
* worker nodes for user-defined types. If the function can not detect a binary * worker nodes for user-defined types. If the function can not detect a binary
* output function for any of the column, it returns false. * output function for any of the column, it returns false.
*/ */
static bool bool
CanUseBinaryCopyFormat(TupleDesc tupleDescription) CanUseBinaryCopyFormat(TupleDesc tupleDescription)
{ {
bool useBinaryCopyFormat = true; bool useBinaryCopyFormat = true;
@ -1169,7 +1165,7 @@ SendCopyDataToPlacement(StringInfo dataBuffer, int64 shardId, MultiConnection *c
* If stopOnFailure is true, then EndRemoteCopy reports an error on failure, * If stopOnFailure is true, then EndRemoteCopy reports an error on failure,
* otherwise it reports a warning or continues. * otherwise it reports a warning or continues.
*/ */
static void void
EndRemoteCopy(int64 shardId, List *connectionList, bool stopOnFailure) EndRemoteCopy(int64 shardId, List *connectionList, bool stopOnFailure)
{ {
ListCell *connectionCell = NULL; ListCell *connectionCell = NULL;

View File

@ -115,6 +115,7 @@ extern CitusCopyDestReceiver * CreateCitusCopyDestReceiver(Oid relationId,
EState *executorState, EState *executorState,
bool stopOnFailure); bool stopOnFailure);
extern FmgrInfo * ColumnOutputFunctions(TupleDesc rowDescriptor, bool binaryFormat); extern FmgrInfo * ColumnOutputFunctions(TupleDesc rowDescriptor, bool binaryFormat);
extern bool CanUseBinaryCopyFormat(TupleDesc tupleDescription);
extern void AppendCopyRowData(Datum *valueArray, bool *isNullArray, extern void AppendCopyRowData(Datum *valueArray, bool *isNullArray,
TupleDesc rowDescriptor, TupleDesc rowDescriptor,
CopyOutState rowOutputState, CopyOutState rowOutputState,
@ -122,6 +123,7 @@ extern void AppendCopyRowData(Datum *valueArray, bool *isNullArray,
CopyCoercionData *columnCoercionPaths); CopyCoercionData *columnCoercionPaths);
extern void AppendCopyBinaryHeaders(CopyOutState headerOutputState); extern void AppendCopyBinaryHeaders(CopyOutState headerOutputState);
extern void AppendCopyBinaryFooters(CopyOutState footerOutputState); extern void AppendCopyBinaryFooters(CopyOutState footerOutputState);
extern void EndRemoteCopy(int64 shardId, List *connectionList, bool stopOnFailure);
extern void CitusCopyFrom(CopyStmt *copyStatement, char *completionTag); extern void CitusCopyFrom(CopyStmt *copyStatement, char *completionTag);
extern bool IsCopyFromWorker(CopyStmt *copyStatement); extern bool IsCopyFromWorker(CopyStmt *copyStatement);
extern NodeAddress * MasterNodeAddress(CopyStmt *copyStatement); extern NodeAddress * MasterNodeAddress(CopyStmt *copyStatement);