Make minor changes

pull/366/head
Metin Doslu 2016-03-17 16:47:09 -07:00
parent e0559ceaad
commit a2de41fe14
2 changed files with 14 additions and 12 deletions

View File

@ -156,7 +156,7 @@ CitusCopyFrom(CopyStmt *copyStatement, char *completionTag)
HTAB *shardConnectionHash = NULL;
List *connectionList = NIL;
MemoryContext tupleContext = NULL;
MemoryContext outputContext = NULL;
MemoryContext outputRowContext = NULL;
CopyState copyState = NULL;
TupleDesc tupleDescriptor = NULL;
uint32 columnCount = 0;
@ -290,23 +290,25 @@ CitusCopyFrom(CopyStmt *copyStatement, char *completionTag)
* files.
*/
tupleContext = AllocSetContextCreate(CurrentMemoryContext,
"COPY Row Memory Context",
"COPY FROM Row Memory Context",
ALLOCSET_DEFAULT_MINSIZE,
ALLOCSET_DEFAULT_INITSIZE,
ALLOCSET_DEFAULT_MAXSIZE);
outputContext = AllocSetContextCreate(CurrentMemoryContext,
"COPY Output Memory Context",
/* we use outputRowContext to serialize row to send to workers */
outputRowContext = AllocSetContextCreate(CurrentMemoryContext,
"COPY TO Row Memory Context",
ALLOCSET_DEFAULT_MINSIZE,
ALLOCSET_DEFAULT_INITSIZE,
ALLOCSET_DEFAULT_MAXSIZE);
columnOutputFunctions = ColumnOutputFunctions(tupleDescriptor, true);
rowOutputState = (OutputCopyState) palloc0(sizeof(OutputCopyStateData));
rowOutputState->binary = true;
rowOutputState->fe_msgbuf = makeStringInfo();
rowOutputState->rowcontext = outputContext;
rowOutputState->rowcontext = outputRowContext;
columnOutputFunctions = ColumnOutputFunctions(tupleDescriptor,
rowOutputState->binary);
/* we use a PG_TRY block to roll back on errors (e.g. in NextCopyFrom) */
PG_TRY();

View File

@ -43,13 +43,13 @@ typedef struct OutputCopyStateData
typedef struct OutputCopyStateData *OutputCopyState;
/* function declarations for copying into a distributed table */
extern FmgrInfo * ColumnOutputFunctions(TupleDesc rowDescriptor, bool binaryFormat);
extern void OutputRow(Datum *valueArray, bool *isNullArray, TupleDesc rowDescriptor,
OutputCopyState rowOutputState, FmgrInfo *columnOutputFunctions);
extern void CopySendBinaryHeaders(OutputCopyState headerOutputState);
extern void CopySendBinaryFooters(OutputCopyState footerOutputState);
/* function declarations for copying into a distributed table */
extern void CitusCopyFrom(CopyStmt *copyStatement, char *completionTag);