From 71d5d1c865fc530ab21d0df26c0d7649cda256f5 Mon Sep 17 00:00:00 2001 From: Jason Petersen Date: Tue, 16 Apr 2019 17:09:56 -0600 Subject: [PATCH] Enable variable shadowing warnings; fix all Rather than wait for another place like the previous commit to bite us, I think we should turn on this warning. --- configure | 35 ++++++++++++++++ configure.in | 1 + .../commands/create_distributed_table.c | 3 -- .../connection/placement_connection.c | 20 +++++----- .../executor/multi_real_time_executor.c | 4 +- .../executor/multi_task_tracker_executor.c | 13 +++--- .../distributed/master/master_node_protocol.c | 1 - .../planner/insert_select_planner.c | 2 - .../distributed/planner/multi_join_order.c | 5 +-- .../planner/multi_logical_optimizer.c | 8 ++-- .../planner/multi_physical_planner.c | 40 +++++++++---------- .../planner/multi_router_planner.c | 6 +-- .../test/run_from_same_connection.c | 33 +++++++-------- src/backend/distributed/utils/errormessage.c | 4 +- .../distributed/utils/shardinterval_utils.c | 4 +- .../distributed/multi_logical_optimizer.h | 2 +- 16 files changed, 104 insertions(+), 77 deletions(-) diff --git a/configure b/configure index c61422438..ed3090218 100755 --- a/configure +++ b/configure @@ -4008,6 +4008,41 @@ if test x"$citusac_cv_prog_cc_cflags__Wmissing_prototypes" = x"yes"; then CITUS_CFLAGS="$CITUS_CFLAGS -Wmissing-prototypes" fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wshadow" >&5 +$as_echo_n "checking whether $CC supports -Wshadow... " >&6; } +if ${citusac_cv_prog_cc_cflags__Wshadow+:} false; then : + $as_echo_n "(cached) " >&6 +else + citusac_save_CFLAGS=$CFLAGS +CFLAGS="$citusac_save_CFLAGS -Wshadow" +ac_save_c_werror_flag=$ac_c_werror_flag +ac_c_werror_flag=yes +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + citusac_cv_prog_cc_cflags__Wshadow=yes +else + citusac_cv_prog_cc_cflags__Wshadow=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_c_werror_flag=$ac_save_c_werror_flag +CFLAGS="$citusac_save_CFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $citusac_cv_prog_cc_cflags__Wshadow" >&5 +$as_echo "$citusac_cv_prog_cc_cflags__Wshadow" >&6; } +if test x"$citusac_cv_prog_cc_cflags__Wshadow" = x"yes"; then + CITUS_CFLAGS="$CITUS_CFLAGS -Wshadow" +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Werror=vla" >&5 $as_echo_n "checking whether $CC supports -Werror=vla... " >&6; } if ${citusac_cv_prog_cc_cflags__Werror_vla+:} false; then : diff --git a/configure.in b/configure.in index 315a03393..af9ebc2a3 100644 --- a/configure.in +++ b/configure.in @@ -163,6 +163,7 @@ CITUSAC_PROG_CC_CFLAGS_OPT([-Wendif-labels]) CITUSAC_PROG_CC_CFLAGS_OPT([-Wmissing-format-attribute]) CITUSAC_PROG_CC_CFLAGS_OPT([-Wmissing-declarations]) CITUSAC_PROG_CC_CFLAGS_OPT([-Wmissing-prototypes]) +CITUSAC_PROG_CC_CFLAGS_OPT([-Wshadow]) CITUSAC_PROG_CC_CFLAGS_OPT([-Werror=vla]) # visual studio does not support these # diff --git a/src/backend/distributed/commands/create_distributed_table.c b/src/backend/distributed/commands/create_distributed_table.c index 03af30755..ab755835b 100644 --- a/src/backend/distributed/commands/create_distributed_table.c +++ b/src/backend/distributed/commands/create_distributed_table.c @@ -696,7 +696,6 @@ EnsureRelationCanBeDistributed(Oid relationId, Var *distributionColumn, /* partitions cannot be distributed if their parent is not distributed */ if (PartitionTable(relationId) && !IsDistributedTable(parentRelationId)) { - char *relationName = get_rel_name(relationId); char *parentRelationName = get_rel_name(parentRelationId); ereport(ERROR, (errmsg("cannot distribute relation \"%s\" which is partition of " @@ -734,8 +733,6 @@ EnsureRelationCanBeDistributed(Oid relationId, Var *distributionColumn, /* we don't support distributing tables with multi-level partitioning */ if (PartitionTable(relationId)) { - char *relationName = get_rel_name(relationId); - Oid parentRelationId = PartitionParentOid(relationId); char *parentRelationName = get_rel_name(parentRelationId); ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), diff --git a/src/backend/distributed/connection/placement_connection.c b/src/backend/distributed/connection/placement_connection.c index 20303e58b..693213049 100644 --- a/src/backend/distributed/connection/placement_connection.c +++ b/src/backend/distributed/connection/placement_connection.c @@ -667,13 +667,13 @@ FindPlacementListConnection(int flags, List *placementAccessList, const char *us static ConnectionPlacementHashEntry * FindOrCreatePlacementEntry(ShardPlacement *placement) { - ConnectionPlacementHashKey key; + ConnectionPlacementHashKey connKey; ConnectionPlacementHashEntry *placementEntry = NULL; bool found = false; - key.placementId = placement->placementId; + connKey.placementId = placement->placementId; - placementEntry = hash_search(ConnectionPlacementHash, &key, HASH_ENTER, &found); + placementEntry = hash_search(ConnectionPlacementHash, &connKey, HASH_ENTER, &found); if (!found) { /* no connection has been chosen for this placement */ @@ -685,15 +685,15 @@ FindOrCreatePlacementEntry(ShardPlacement *placement) if (placement->partitionMethod == DISTRIBUTE_BY_HASH || placement->partitionMethod == DISTRIBUTE_BY_NONE) { - ColocatedPlacementsHashKey key; + ColocatedPlacementsHashKey coloKey; ColocatedPlacementsHashEntry *colocatedEntry = NULL; - key.nodeId = placement->nodeId; - key.colocationGroupId = placement->colocationGroupId; - key.representativeValue = placement->representativeValue; + coloKey.nodeId = placement->nodeId; + coloKey.colocationGroupId = placement->colocationGroupId; + coloKey.representativeValue = placement->representativeValue; /* look for a connection assigned to co-located placements */ - colocatedEntry = hash_search(ColocatedPlacementsHash, &key, HASH_ENTER, + colocatedEntry = hash_search(ColocatedPlacementsHash, &coloKey, HASH_ENTER, &found); if (!found) { @@ -857,10 +857,10 @@ AssociatePlacementWithShard(ConnectionPlacementHashEntry *placementEntry, */ dlist_foreach(placementIter, &shardEntry->placementConnections) { - ConnectionPlacementHashEntry *placementEntry = + ConnectionPlacementHashEntry *currPlacementEntry = dlist_container(ConnectionPlacementHashEntry, shardNode, placementIter.cur); - if (placementEntry->key.placementId == placement->placementId) + if (currPlacementEntry->key.placementId == placement->placementId) { return; } diff --git a/src/backend/distributed/executor/multi_real_time_executor.c b/src/backend/distributed/executor/multi_real_time_executor.c index e7126a7c6..9c77ccf4c 100644 --- a/src/backend/distributed/executor/multi_real_time_executor.c +++ b/src/backend/distributed/executor/multi_real_time_executor.c @@ -133,8 +133,8 @@ MultiRealTimeExecute(Job *job) uint32 completedTaskCount = 0; /* loop around all tasks and manage them */ - ListCell *taskCell = NULL; - ListCell *taskExecutionCell = NULL; + taskCell = NULL; + taskExecutionCell = NULL; MultiClientResetWaitInfo(waitInfo); diff --git a/src/backend/distributed/executor/multi_task_tracker_executor.c b/src/backend/distributed/executor/multi_task_tracker_executor.c index ae175f510..1a81ada48 100644 --- a/src/backend/distributed/executor/multi_task_tracker_executor.c +++ b/src/backend/distributed/executor/multi_task_tracker_executor.c @@ -235,7 +235,6 @@ MultiTaskTrackerExecute(Job *job) double acceptableHealthyTrackerCount = 0.0; /* first, loop around all tasks and manage them */ - ListCell *taskAndExecutionCell = NULL; foreach(taskAndExecutionCell, taskAndExecutionList) { Task *task = (Task *) lfirst(taskAndExecutionCell); @@ -259,7 +258,6 @@ MultiTaskTrackerExecute(Job *job) if (taskExecutionStatus == EXEC_TASK_TRACKER_FAILED) { List *taskList = NIL; - TaskTracker *transmitTracker = NULL; /* mark task tracker as failed, in case it isn't marked already */ execTaskTracker->trackerFailureCount = MAX_TRACKER_FAILURE_COUNT; @@ -343,7 +341,6 @@ MultiTaskTrackerExecute(Job *job) if (transmitExecutionStatus == EXEC_TRANSMIT_TRACKER_FAILED) { List *taskList = NIL; - TaskTracker *taskTracker = NULL; taskTracker = ResolveTaskTracker(taskTrackerHash, task, taskExecution); @@ -2358,7 +2355,7 @@ AssignQueuedTasks(TaskTracker *taskTracker) foreach(taskCell, tasksToAssignList) { - TrackerTaskState *taskState = (TrackerTaskState *) lfirst(taskCell); + taskState = (TrackerTaskState *) lfirst(taskCell); BatchQueryStatus queryStatus = CLIENT_INVALID_BATCH_QUERY; if (!batchSuccess) @@ -2663,14 +2660,14 @@ JobIdList(Job *job) uint64 *jobIdPointer = (uint64 *) palloc0(sizeof(uint64)); List *jobChildrenList = NIL; - Job *job = (Job *) linitial(jobQueue); + Job *currJob = (Job *) linitial(jobQueue); jobQueue = list_delete_first(jobQueue); - (*jobIdPointer) = job->jobId; + (*jobIdPointer) = currJob->jobId; jobIdList = lappend(jobIdList, jobIdPointer); /* prevent dependedJobList being modified on list_concat() call */ - jobChildrenList = list_copy(job->dependedJobList); + jobChildrenList = list_copy(currJob->dependedJobList); if (jobChildrenList != NIL) { jobQueue = list_concat(jobQueue, jobChildrenList); @@ -2907,7 +2904,7 @@ TrackerHashCleanupJob(HTAB *taskTrackerHash, Task *jobCleanupTask) foreach(activeTaskTrackerCell, activeTackTrackerList) { - TaskTracker *taskTracker = (TaskTracker *) lfirst(activeTaskTrackerCell); + taskTracker = (TaskTracker *) lfirst(activeTaskTrackerCell); int32 connectionId = taskTracker->connectionId; const char *nodeName = taskTracker->workerName; uint32 nodePort = taskTracker->workerPort; diff --git a/src/backend/distributed/master/master_node_protocol.c b/src/backend/distributed/master/master_node_protocol.c index 8ddaf833c..edc330a0d 100644 --- a/src/backend/distributed/master/master_node_protocol.c +++ b/src/backend/distributed/master/master_node_protocol.c @@ -471,7 +471,6 @@ master_get_active_worker_nodes(PG_FUNCTION_ARGS) { MemoryContext oldContext = NULL; List *workerNodeList = NIL; - uint32 workerNodeCount = 0; TupleDesc tupleDescriptor = NULL; bool hasOid = false; diff --git a/src/backend/distributed/planner/insert_select_planner.c b/src/backend/distributed/planner/insert_select_planner.c index 7b96c8f50..62820bee9 100644 --- a/src/backend/distributed/planner/insert_select_planner.c +++ b/src/backend/distributed/planner/insert_select_planner.c @@ -378,8 +378,6 @@ DistributedInsertSelectSupported(Query *queryTree, RangeTblEntry *insertRte, } else { - DeferredErrorMessage *error = NULL; - /* ensure that INSERT's partition column comes from SELECT's partition column */ error = InsertPartitionColumnMatchesSelect(queryTree, insertRte, subqueryRte, &selectPartitionColumnTableId); diff --git a/src/backend/distributed/planner/multi_join_order.c b/src/backend/distributed/planner/multi_join_order.c index ffdc1f9ec..dd219d6ed 100644 --- a/src/backend/distributed/planner/multi_join_order.c +++ b/src/backend/distributed/planner/multi_join_order.c @@ -939,9 +939,8 @@ SinglePartitionJoin(JoinOrderNode *currentJoinNode, TableEntry *candidateTable, /* evaluate re-partitioning the current table only if the rule didn't apply above */ if (nextJoinNode == NULL && candidatePartitionMethod != DISTRIBUTE_BY_NONE) { - OpExpr *joinClause = SinglePartitionJoinClause(candidatePartitionColumn, - applicableJoinClauses); - + joinClause = SinglePartitionJoinClause(candidatePartitionColumn, + applicableJoinClauses); if (joinClause != NULL) { if (candidatePartitionMethod == DISTRIBUTE_BY_HASH) diff --git a/src/backend/distributed/planner/multi_logical_optimizer.c b/src/backend/distributed/planner/multi_logical_optimizer.c index a568c4943..f59f522f6 100644 --- a/src/backend/distributed/planner/multi_logical_optimizer.c +++ b/src/backend/distributed/planner/multi_logical_optimizer.c @@ -4239,23 +4239,23 @@ HasOrderByHllType(List *sortClauseList, List *targetList) * of distinct clause. */ bool -IsGroupBySubsetOfDistinct(List *groupClause, List *distinctClause) +IsGroupBySubsetOfDistinct(List *groupClauses, List *distinctClauses) { ListCell *distinctCell = NULL; ListCell *groupCell = NULL; /* There must be a group clause */ - if (list_length(groupClause) == 0) + if (list_length(groupClauses) == 0) { return false; } - foreach(groupCell, groupClause) + foreach(groupCell, groupClauses) { SortGroupClause *groupClause = (SortGroupClause *) lfirst(groupCell); bool isFound = false; - foreach(distinctCell, distinctClause) + foreach(distinctCell, distinctClauses) { SortGroupClause *distinctClause = (SortGroupClause *) lfirst(distinctCell); diff --git a/src/backend/distributed/planner/multi_physical_planner.c b/src/backend/distributed/planner/multi_physical_planner.c index 073dd12bc..a2f41465b 100644 --- a/src/backend/distributed/planner/multi_physical_planner.c +++ b/src/backend/distributed/planner/multi_physical_planner.c @@ -814,8 +814,8 @@ BaseRangeTableList(MultiNode *multiNode) while (pendingNodeList != NIL) { - MultiNode *multiNode = (MultiNode *) linitial(pendingNodeList); - CitusNodeTag nodeType = CitusNodeTag(multiNode); + MultiNode *currMultiNode = (MultiNode *) linitial(pendingNodeList); + CitusNodeTag nodeType = CitusNodeTag(currMultiNode); pendingNodeList = list_delete_first(pendingNodeList); if (nodeType == T_MultiTable) @@ -824,7 +824,7 @@ BaseRangeTableList(MultiNode *multiNode) * We represent subqueries as MultiTables, and so for base table * entries we skip the subquery ones. */ - MultiTable *multiTable = (MultiTable *) multiNode; + MultiTable *multiTable = (MultiTable *) currMultiNode; if (multiTable->relationId != SUBQUERY_RELATION_ID && multiTable->relationId != SUBQUERY_PUSHDOWN_RELATION_ID) { @@ -843,7 +843,7 @@ BaseRangeTableList(MultiNode *multiNode) /* do not visit nodes that belong to remote queries */ if (nodeType != T_MultiCollect) { - List *childNodeList = ChildNodeList(multiNode); + List *childNodeList = ChildNodeList(currMultiNode); pendingNodeList = list_concat(pendingNodeList, childNodeList); } } @@ -963,21 +963,21 @@ QueryGroupClauseList(MultiNode *multiNode) while (pendingNodeList != NIL) { - MultiNode *multiNode = (MultiNode *) linitial(pendingNodeList); - CitusNodeTag nodeType = CitusNodeTag(multiNode); + MultiNode *currMultiNode = (MultiNode *) linitial(pendingNodeList); + CitusNodeTag nodeType = CitusNodeTag(currMultiNode); pendingNodeList = list_delete_first(pendingNodeList); /* extract the group clause list from the extended operator */ if (nodeType == T_MultiExtendedOp) { - MultiExtendedOp *extendedOpNode = (MultiExtendedOp *) multiNode; + MultiExtendedOp *extendedOpNode = (MultiExtendedOp *) currMultiNode; groupClauseList = extendedOpNode->groupClauseList; } /* add children only if this node isn't a multi collect and multi table */ if (nodeType != T_MultiCollect && nodeType != T_MultiTable) { - List *childNodeList = ChildNodeList(multiNode); + List *childNodeList = ChildNodeList(currMultiNode); pendingNodeList = list_concat(pendingNodeList, childNodeList); } } @@ -1000,14 +1000,14 @@ QuerySelectClauseList(MultiNode *multiNode) while (pendingNodeList != NIL) { - MultiNode *multiNode = (MultiNode *) linitial(pendingNodeList); - CitusNodeTag nodeType = CitusNodeTag(multiNode); + MultiNode *currMultiNode = (MultiNode *) linitial(pendingNodeList); + CitusNodeTag nodeType = CitusNodeTag(currMultiNode); pendingNodeList = list_delete_first(pendingNodeList); /* extract select clauses from the multi select node */ if (nodeType == T_MultiSelect) { - MultiSelect *selectNode = (MultiSelect *) multiNode; + MultiSelect *selectNode = (MultiSelect *) currMultiNode; List *clauseList = copyObject(selectNode->selectClauseList); selectClauseList = list_concat(selectClauseList, clauseList); } @@ -1015,7 +1015,7 @@ QuerySelectClauseList(MultiNode *multiNode) /* add children only if this node isn't a multi collect */ if (nodeType != T_MultiCollect) { - List *childNodeList = ChildNodeList(multiNode); + List *childNodeList = ChildNodeList(currMultiNode); pendingNodeList = list_concat(pendingNodeList, childNodeList); } } @@ -1038,14 +1038,14 @@ QueryJoinClauseList(MultiNode *multiNode) while (pendingNodeList != NIL) { - MultiNode *multiNode = (MultiNode *) linitial(pendingNodeList); - CitusNodeTag nodeType = CitusNodeTag(multiNode); + MultiNode *currMultiNode = (MultiNode *) linitial(pendingNodeList); + CitusNodeTag nodeType = CitusNodeTag(currMultiNode); pendingNodeList = list_delete_first(pendingNodeList); /* extract join clauses from the multi join node */ if (nodeType == T_MultiJoin) { - MultiJoin *joinNode = (MultiJoin *) multiNode; + MultiJoin *joinNode = (MultiJoin *) currMultiNode; List *clauseList = copyObject(joinNode->joinClauseList); joinClauseList = list_concat(joinClauseList, clauseList); } @@ -1053,7 +1053,7 @@ QueryJoinClauseList(MultiNode *multiNode) /* add this node's children only if the node isn't a multi collect */ if (nodeType != T_MultiCollect) { - List *childNodeList = ChildNodeList(multiNode); + List *childNodeList = ChildNodeList(currMultiNode); pendingNodeList = list_concat(pendingNodeList, childNodeList); } } @@ -1726,8 +1726,8 @@ static List * ChildNodeList(MultiNode *multiNode) { List *childNodeList = NIL; - bool unaryNode = UnaryOperator(multiNode); - bool binaryNode = BinaryOperator(multiNode); + bool isUnaryNode = UnaryOperator(multiNode); + bool isBinaryNode = BinaryOperator(multiNode); /* relation table nodes don't have any children */ if (CitusIsA(multiNode, MultiTable)) @@ -1739,12 +1739,12 @@ ChildNodeList(MultiNode *multiNode) } } - if (unaryNode) + if (isUnaryNode) { MultiUnaryNode *unaryNode = (MultiUnaryNode *) multiNode; childNodeList = list_make1(unaryNode->childNode); } - else if (binaryNode) + else if (isBinaryNode) { MultiBinaryNode *binaryNode = (MultiBinaryNode *) multiNode; childNodeList = list_make2(binaryNode->leftChildNode, diff --git a/src/backend/distributed/planner/multi_router_planner.c b/src/backend/distributed/planner/multi_router_planner.c index 914506faa..0c5541995 100644 --- a/src/backend/distributed/planner/multi_router_planner.c +++ b/src/backend/distributed/planner/multi_router_planner.c @@ -2416,10 +2416,10 @@ BuildRoutesForInsert(Query *query, DeferredErrorMessage **planningError) DISTRIBUTE_BY_RANGE) { Datum partitionValue = partitionValueConst->constvalue; - DistTableCacheEntry *cacheEntry = DistributedTableCacheEntry( - distributedTableId); - ShardInterval *shardInterval = FindShardInterval(partitionValue, cacheEntry); + ShardInterval *shardInterval = NULL; + cacheEntry = DistributedTableCacheEntry(distributedTableId); + shardInterval = FindShardInterval(partitionValue, cacheEntry); if (shardInterval != NULL) { prunedShardList = list_make1(shardInterval); diff --git a/src/backend/distributed/test/run_from_same_connection.c b/src/backend/distributed/test/run_from_same_connection.c index 508fc133a..d472e1264 100644 --- a/src/backend/distributed/test/run_from_same_connection.c +++ b/src/backend/distributed/test/run_from_same_connection.c @@ -40,7 +40,7 @@ static bool allowNonIdleRemoteTransactionOnXactHandling = false; -static MultiConnection *connection = NULL; +static MultiConnection *singleConnection = NULL; /* @@ -51,7 +51,7 @@ int IsolationTestSessionRemoteProcessID = -1; int IsolationTestSessionProcessID = -1; -static int64 GetRemoteProcessId(MultiConnection *connection); +static int64 GetRemoteProcessId(void); /* declarations for dynamic loading */ PG_FUNCTION_INFO_V1(start_session_level_connection_to_node); @@ -88,8 +88,9 @@ start_session_level_connection_to_node(PG_FUNCTION_ARGS) CheckCitusVersion(ERROR); - if (connection != NULL && (strcmp(connection->hostname, nodeNameString) != 0 || - connection->port != nodePort)) + if (singleConnection != NULL && (strcmp(singleConnection->hostname, + nodeNameString) != 0 || + singleConnection->port != nodePort)) { elog(ERROR, "can not connect different worker nodes from the same session using start_session_level_connection_to_node"); @@ -99,13 +100,13 @@ start_session_level_connection_to_node(PG_FUNCTION_ARGS) * In order to keep connection open even with an open transaction, * allowSessionLifeSpanWithOpenTransaction is set to true. */ - if (connection == NULL) + if (singleConnection == NULL) { - connection = GetNodeConnection(SESSION_LIFESPAN, nodeNameString, nodePort); + singleConnection = GetNodeConnection(SESSION_LIFESPAN, nodeNameString, nodePort); allowNonIdleRemoteTransactionOnXactHandling = true; } - if (PQstatus(connection->pgConn) != CONNECTION_OK) + if (PQstatus(singleConnection->pgConn) != CONNECTION_OK) { elog(ERROR, "failed to connect to %s:%d", nodeNameString, (int) nodePort); } @@ -136,7 +137,7 @@ run_commands_on_session_level_connection_to_node(PG_FUNCTION_ARGS) PostPortNumber); Oid pgReloadConfOid = InvalidOid; - if (!connection) + if (!singleConnection) { elog(ERROR, "start_session_level_connection_to_node must be called first to open a session level connection"); @@ -144,9 +145,9 @@ run_commands_on_session_level_connection_to_node(PG_FUNCTION_ARGS) appendStringInfo(processStringInfo, ALTER_CURRENT_PROCESS_ID, MyProcPid); appendStringInfo(workerProcessStringInfo, ALTER_CURRENT_WORKER_PROCESS_ID, - GetRemoteProcessId(connection)); + GetRemoteProcessId()); - ExecuteCriticalRemoteCommand(connection, queryString); + ExecuteCriticalRemoteCommand(singleConnection, queryString); /* * Since we cannot run `ALTER SYSTEM` command within a transaction, we are @@ -176,10 +177,10 @@ stop_session_level_connection_to_node(PG_FUNCTION_ARGS) { allowNonIdleRemoteTransactionOnXactHandling = false; - if (connection != NULL) + if (singleConnection != NULL) { - CloseConnection(connection); - connection = NULL; + CloseConnection(singleConnection); + singleConnection = NULL; } PG_RETURN_VOID(); @@ -191,7 +192,7 @@ stop_session_level_connection_to_node(PG_FUNCTION_ARGS) * by the connection. */ static int64 -GetRemoteProcessId(MultiConnection *connection) +GetRemoteProcessId() { StringInfo queryStringInfo = makeStringInfo(); PGresult *result = NULL; @@ -200,7 +201,7 @@ GetRemoteProcessId(MultiConnection *connection) appendStringInfo(queryStringInfo, GET_PROCESS_ID); - ExecuteOptionalRemoteCommand(connection, queryStringInfo->data, &result); + ExecuteOptionalRemoteCommand(singleConnection, queryStringInfo->data, &result); rowCount = PQntuples(result); @@ -212,7 +213,7 @@ GetRemoteProcessId(MultiConnection *connection) resultValue = ParseIntField(result, 0, 0); PQclear(result); - ClearResults(connection, false); + ClearResults(singleConnection, false); return resultValue; } diff --git a/src/backend/distributed/utils/errormessage.c b/src/backend/distributed/utils/errormessage.c index e0ba27771..fa4ae3329 100644 --- a/src/backend/distributed/utils/errormessage.c +++ b/src/backend/distributed/utils/errormessage.c @@ -16,9 +16,9 @@ * ApplyLogRedaction is only supported in Citus Enterprise */ char * -ApplyLogRedaction(const char *text) +ApplyLogRedaction(const char *logText) { - return (char *) text; + return (char *) logText; } diff --git a/src/backend/distributed/utils/shardinterval_utils.c b/src/backend/distributed/utils/shardinterval_utils.c index 7825c7f40..048b860e9 100644 --- a/src/backend/distributed/utils/shardinterval_utils.c +++ b/src/backend/distributed/utils/shardinterval_utils.c @@ -445,8 +445,8 @@ SingleReplicatedTable(Oid relationId) foreach(shardIntervalCell, shardIntervalList) { uint64 *shardIdPointer = (uint64 *) lfirst(shardIntervalCell); - uint64 shardId = (*shardIdPointer); - List *shardPlacementList = ShardPlacementList(shardId); + shardId = (*shardIdPointer); + shardPlacementList = ShardPlacementList(shardId); if (list_length(shardPlacementList) != 1) { diff --git a/src/include/distributed/multi_logical_optimizer.h b/src/include/distributed/multi_logical_optimizer.h index 9512f84e1..7ffcabf71 100644 --- a/src/include/distributed/multi_logical_optimizer.h +++ b/src/include/distributed/multi_logical_optimizer.h @@ -146,6 +146,6 @@ extern bool IsPartitionColumn(Expr *columnExpression, Query *query); extern void FindReferencedTableColumn(Expr *columnExpression, List *parentQueryList, Query *query, Oid *relationId, Var **column); -extern bool IsGroupBySubsetOfDistinct(List *groupClause, List *distinctClause); +extern bool IsGroupBySubsetOfDistinct(List *groupClauses, List *distinctClauses); #endif /* MULTI_LOGICAL_OPTIMIZER_H */