From 31ab5012fd0ab4383727dcc987c31af91d00a11b Mon Sep 17 00:00:00 2001 From: Metin Doslu Date: Tue, 22 Mar 2016 14:46:20 -0700 Subject: [PATCH] Use better naming --- src/backend/distributed/commands/multi_copy.c | 24 +++++++++---------- .../worker/worker_partition_protocol.c | 8 +++---- src/include/distributed/multi_copy.h | 8 +++---- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/backend/distributed/commands/multi_copy.c b/src/backend/distributed/commands/multi_copy.c index 6a2db3e49..885ccf36f 100644 --- a/src/backend/distributed/commands/multi_copy.c +++ b/src/backend/distributed/commands/multi_copy.c @@ -125,7 +125,7 @@ static void OpenCopyTransactions(CopyStmt *copyStatement, ShardConnections *shardConnections, int64 shardId); static StringInfo ConstructCopyStatement(CopyStmt *copyStatement, int64 shardId); -static void SendCopyDataToPlacements(StringInfo lineBuf, +static void SendCopyDataToPlacements(StringInfo dataBuffer, ShardConnections *shardConnections); static List * ConnectionList(HTAB *connectionHash); static void EndRemoteCopy(List *connectionList, bool stopOnFailure); @@ -361,13 +361,13 @@ CitusCopyFrom(CopyStmt *copyStatement, char *completionTag) OpenCopyTransactions(copyStatement, shardConnections, shardId); - CopySendBinaryHeaders(copyOutState); + BuildCopyBinaryHeaders(copyOutState); SendCopyDataToPlacements(copyOutState->fe_msgbuf, shardConnections); } /* Replicate row to all shard placements */ - CopySendRow(columnValues, columnNulls, tupleDescriptor, copyOutState, - columnOutputFunctions); + BuildCopyRowData(columnValues, columnNulls, tupleDescriptor, + copyOutState, columnOutputFunctions); SendCopyDataToPlacements(copyOutState->fe_msgbuf, shardConnections); processedRowCount += 1; @@ -379,7 +379,7 @@ CitusCopyFrom(CopyStmt *copyStatement, char *completionTag) shardConnections = (ShardConnections *) hash_seq_search(&status); while (shardConnections != NULL) { - CopySendBinaryFooters(copyOutState); + BuildCopyBinaryFooters(copyOutState); SendCopyDataToPlacements(copyOutState->fe_msgbuf, shardConnections); shardConnections = (ShardConnections *) hash_seq_search(&status); @@ -732,7 +732,7 @@ ConstructCopyStatement(CopyStmt *copyStatement, int64 shardId) * a shard. */ static void -SendCopyDataToPlacements(StringInfo lineBuf, ShardConnections *shardConnections) +SendCopyDataToPlacements(StringInfo dataBuffer, ShardConnections *shardConnections) { ListCell *connectionCell = NULL; foreach(connectionCell, shardConnections->connectionList) @@ -743,7 +743,7 @@ SendCopyDataToPlacements(StringInfo lineBuf, ShardConnections *shardConnections) int64 shardId = shardConnections->shardId; /* copy the line buffer into the placement */ - int copyResult = PQputCopyData(connection, lineBuf->data, lineBuf->len); + int copyResult = PQputCopyData(connection, dataBuffer->data, dataBuffer->len); if (copyResult != 1) { char *nodeName = ConnectionGetOptionValue(connection, "host"); @@ -911,7 +911,7 @@ ColumnOutputFunctions(TupleDesc rowDescriptor, bool binaryFormat) /* - * CopySendRow serializes one row using the column output functions, + * BuildCopyRowData serializes one row using the column output functions, * and appends the data to the row output state object's message buffer. * This function is modeled after the CopyOneRowTo() function in * commands/copy.c, but only implements a subset of that functionality. @@ -919,8 +919,8 @@ ColumnOutputFunctions(TupleDesc rowDescriptor, bool binaryFormat) * to not bloat memory usage. */ void -CopySendRow(Datum *valueArray, bool *isNullArray, TupleDesc rowDescriptor, - CopyOutState rowOutputState, FmgrInfo *columnOutputFunctions) +BuildCopyRowData(Datum *valueArray, bool *isNullArray, TupleDesc rowDescriptor, + CopyOutState rowOutputState, FmgrInfo *columnOutputFunctions) { MemoryContext oldContext = NULL; uint32 columnIndex = 0; @@ -997,7 +997,7 @@ CopySendRow(Datum *valueArray, bool *isNullArray, TupleDesc rowDescriptor, /* Append binary headers to the copy buffer in headerOutputState. */ void -CopySendBinaryHeaders(CopyOutState headerOutputState) +BuildCopyBinaryHeaders(CopyOutState headerOutputState) { const int32 zero = 0; @@ -1016,7 +1016,7 @@ CopySendBinaryHeaders(CopyOutState headerOutputState) /* Append binary footers to the copy buffer in footerOutputState. */ void -CopySendBinaryFooters(CopyOutState footerOutputState) +BuildCopyBinaryFooters(CopyOutState footerOutputState) { int16 negative = -1; diff --git a/src/backend/distributed/worker/worker_partition_protocol.c b/src/backend/distributed/worker/worker_partition_protocol.c index 7bc46dbde..8fa2c3960 100644 --- a/src/backend/distributed/worker/worker_partition_protocol.c +++ b/src/backend/distributed/worker/worker_partition_protocol.c @@ -814,8 +814,8 @@ FilterAndPartitionTable(const char *filterQuery, /* deconstruct the tuple; this is faster than repeated heap_getattr */ heap_deform_tuple(row, rowDescriptor, valueArray, isNullArray); - CopySendRow(valueArray, isNullArray, rowDescriptor, rowOutputState, - columnOutputFunctions); + BuildCopyRowData(valueArray, isNullArray, rowDescriptor, + rowOutputState, columnOutputFunctions); rowText = rowOutputState->fe_msgbuf; partitionFile = partitionFileArray[partitionId]; @@ -973,7 +973,7 @@ OutputBinaryHeaders(FileOutputStream *partitionFileArray, uint32 fileCount) memset(headerOutputState, 0, sizeof(CopyOutStateData)); headerOutputState->fe_msgbuf = makeStringInfo(); - CopySendBinaryHeaders(headerOutputState); + BuildCopyBinaryHeaders(headerOutputState); partitionFile = partitionFileArray[fileIndex]; FileOutputStreamWrite(partitionFile, headerOutputState->fe_msgbuf); @@ -999,7 +999,7 @@ OutputBinaryFooters(FileOutputStream *partitionFileArray, uint32 fileCount) memset(footerOutputState, 0, sizeof(CopyOutStateData)); footerOutputState->fe_msgbuf = makeStringInfo(); - CopySendBinaryFooters(footerOutputState); + BuildCopyBinaryFooters(footerOutputState); partitionFile = partitionFileArray[fileIndex]; FileOutputStreamWrite(partitionFile, footerOutputState->fe_msgbuf); diff --git a/src/include/distributed/multi_copy.h b/src/include/distributed/multi_copy.h index e31558878..46afd4cb0 100644 --- a/src/include/distributed/multi_copy.h +++ b/src/include/distributed/multi_copy.h @@ -46,10 +46,10 @@ typedef struct CopyOutStateData *CopyOutState; /* function declarations for copying into a distributed table */ extern FmgrInfo * ColumnOutputFunctions(TupleDesc rowDescriptor, bool binaryFormat); -extern void CopySendRow(Datum *valueArray, bool *isNullArray, TupleDesc rowDescriptor, - CopyOutState rowOutputState, FmgrInfo *columnOutputFunctions); -extern void CopySendBinaryHeaders(CopyOutState headerOutputState); -extern void CopySendBinaryFooters(CopyOutState footerOutputState); +extern void BuildCopyRowData(Datum *valueArray, bool *isNullArray, TupleDesc rowDescriptor, + CopyOutState rowOutputState, FmgrInfo *columnOutputFunctions); +extern void BuildCopyBinaryHeaders(CopyOutState headerOutputState); +extern void BuildCopyBinaryFooters(CopyOutState footerOutputState); extern void CitusCopyFrom(CopyStmt *copyStatement, char *completionTag);