Run check_indent on COPY changes

pull/390/head
Marco Slot 2016-03-01 12:05:58 +01:00
parent be86f40f4c
commit 0fb1b9eea4
5 changed files with 38 additions and 34 deletions

View File

@ -239,14 +239,15 @@ typedef struct ShardConnections
static HTAB * CreateShardConnectionHash(void);
static bool IsUniformHashDistribution(ShardInterval **shardIntervalArray,
int shardCount);
static FmgrInfo * ShardIntervalCompareFunction(Var *partitionColumn, char partitionMethod);
static FmgrInfo * ShardIntervalCompareFunction(Var *partitionColumn, char
partitionMethod);
static ShardInterval * FindShardInterval(Datum partitionColumnValue,
ShardInterval **shardIntervalCache,
int shardCount, char partitionMethod,
FmgrInfo *compareFunction,
FmgrInfo *hashFunction, bool useBinarySearch);
static ShardInterval * SearchCachedShardInterval(Datum partitionColumnValue,
ShardInterval** shardIntervalCache,
ShardInterval **shardIntervalCache,
int shardCount,
FmgrInfo *compareFunction);
static void OpenShardConnections(CopyStmt *copyStatement,
@ -266,7 +267,7 @@ static void ReportCopyError(PGconn *connection, PGresult *result);
* and range-partitioned tables.
*/
void
CitusCopyFrom(CopyStmt *copyStatement, char* completionTag)
CitusCopyFrom(CopyStmt *copyStatement, char *completionTag)
{
RangeVar *relation = copyStatement->relation;
Oid tableId = RangeVarGetRelid(relation, NoLock, false);
@ -319,7 +320,8 @@ CitusCopyFrom(CopyStmt *copyStatement, char* completionTag)
if (partitionMethod != DISTRIBUTE_BY_RANGE && partitionMethod != DISTRIBUTE_BY_HASH)
{
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("COPY is only supported for hash- and range-partitioned tables")));
errmsg(
"COPY is only supported for hash- and range-partitioned tables")));
}
/* resolve hash function for partition column */
@ -450,14 +452,14 @@ CitusCopyFrom(CopyStmt *copyStatement, char* completionTag)
/* find the partition column value */
if (columnNulls[partitionColumn->varattno-1])
if (columnNulls[partitionColumn->varattno - 1])
{
ereport(ERROR, (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
errmsg("cannot copy row with NULL value "
"in partition column")));
}
partitionColumnValue = columnValues[partitionColumn->varattno-1];
partitionColumnValue = columnValues[partitionColumn->varattno - 1];
/* find the shard interval and id for the partition column value */
shardInterval = FindShardInterval(partitionColumnValue, shardIntervalCache,
@ -649,7 +651,7 @@ FindShardInterval(Datum partitionColumnValue, ShardInterval **shardIntervalCache
else
{
uint32 hashTokenIncrement = (uint32) (HASH_TOKEN_COUNT / shardCount);
int shardHashCode = ((uint32) (hashedValue-INT32_MIN)/hashTokenIncrement);
int shardHashCode = ((uint32) (hashedValue - INT32_MIN) / hashTokenIncrement);
shardInterval = shardIntervalCache[shardHashCode];
}
@ -670,7 +672,7 @@ FindShardInterval(Datum partitionColumnValue, ShardInterval **shardIntervalCache
* given partition column value and returns it.
*/
static ShardInterval *
SearchCachedShardInterval(Datum partitionColumnValue, ShardInterval** shardIntervalCache,
SearchCachedShardInterval(Datum partitionColumnValue, ShardInterval **shardIntervalCache,
int shardCount, FmgrInfo *compareFunction)
{
int lowerBoundIndex = 0;
@ -682,17 +684,18 @@ SearchCachedShardInterval(Datum partitionColumnValue, ShardInterval** shardInter
if (DatumGetInt32(FunctionCall2Coll(compareFunction,
DEFAULT_COLLATION_OID,
partitionColumnValue,
shardIntervalCache[middleIndex]->minValue)) < 0)
shardIntervalCache[middleIndex]->minValue)) <
0)
{
upperBoundIndex = middleIndex;
}
else if (DatumGetInt32(FunctionCall2Coll(compareFunction,
DEFAULT_COLLATION_OID,
partitionColumnValue,
shardIntervalCache[middleIndex]->maxValue)) <= 0)
shardIntervalCache[middleIndex]->maxValue))
<= 0)
{
return shardIntervalCache[middleIndex];
}
else
{
@ -848,7 +851,8 @@ AppendCopyOptions(StringInfo command, List *copyOptionList)
{
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("argument to option \"%s\" must be a list of column names",
errmsg(
"argument to option \"%s\" must be a list of column names",
option->defname)));
}
else
@ -924,7 +928,7 @@ ConnectionList(HTAB *connectionHash)
{
List *connectionList = NIL;
HASH_SEQ_STATUS status;
ShardConnections* shardConnections = NULL;
ShardConnections *shardConnections = NULL;
hash_seq_init(&status, connectionHash);
while ((shardConnections = (ShardConnections *) hash_seq_search(&status)) != NULL)

View File

@ -21,7 +21,7 @@ extern int CopyTransactionManager;
/* function declarations for copying into a distributed table */
extern void CitusCopyFrom(CopyStmt *copyStatement, char* completionTag);
extern void CitusCopyFrom(CopyStmt *copyStatement, char *completionTag);
#endif /* MULTI_COPY_H */

View File

@ -43,7 +43,7 @@ typedef struct TransactionConnection
{
int64 connectionId;
TransactionState transactionState;
PGconn* connection;
PGconn *connection;
} TransactionConnection;