diff --git a/src/backend/distributed/commands/multi_copy.c b/src/backend/distributed/commands/multi_copy.c index c857ad417..57d3024cd 100644 --- a/src/backend/distributed/commands/multi_copy.c +++ b/src/backend/distributed/commands/multi_copy.c @@ -3216,14 +3216,14 @@ GetConnectionState(HTAB *connectionStateHash, MultiConnection *connection) CopyConnectionState *connectionState = NULL; bool found = false; - int socket = PQsocket(connection->pgConn); - Assert(socket != -1); + int sock = PQsocket(connection->pgConn); + Assert(sock != -1); - connectionState = (CopyConnectionState *) hash_search(connectionStateHash, &socket, + connectionState = (CopyConnectionState *) hash_search(connectionStateHash, &sock, HASH_ENTER, &found); if (!found) { - connectionState->socket = socket; + connectionState->socket = sock; connectionState->connection = connection; connectionState->activePlacementState = NULL; dlist_init(&connectionState->bufferedPlacementList); diff --git a/src/backend/distributed/connection/connection_management.c b/src/backend/distributed/connection/connection_management.c index 95f593e8a..b31195171 100644 --- a/src/backend/distributed/connection/connection_management.c +++ b/src/backend/distributed/connection/connection_management.c @@ -598,7 +598,7 @@ WaitEventSetFromMultiConnectionStates(List *connections, int *waitCount) { MultiConnectionPollState *connectionState = (MultiConnectionPollState *) lfirst( connectionCell); - int socket = 0; + int sock = 0; int eventMask = 0; if (numEventsAdded >= eventSetSize) @@ -613,11 +613,11 @@ WaitEventSetFromMultiConnectionStates(List *connections, int *waitCount) continue; } - socket = PQsocket(connectionState->connection->pgConn); + sock = PQsocket(connectionState->connection->pgConn); eventMask = MultiConnectionStateEventMask(connectionState); - AddWaitEventToSet(waitEventSet, eventMask, socket, NULL, connectionState); + AddWaitEventToSet(waitEventSet, eventMask, sock, NULL, connectionState); numEventsAdded++; if (waitCount) diff --git a/src/backend/distributed/connection/remote_commands.c b/src/backend/distributed/connection/remote_commands.c index 7a866983f..8666d6079 100644 --- a/src/backend/distributed/connection/remote_commands.c +++ b/src/backend/distributed/connection/remote_commands.c @@ -706,7 +706,7 @@ static bool FinishConnectionIO(MultiConnection *connection, bool raiseInterrupts) { PGconn *pgConn = connection->pgConn; - int socket = PQsocket(pgConn); + int sock = PQsocket(pgConn); Assert(pgConn); Assert(PQisnonblocking(pgConn)); @@ -752,7 +752,7 @@ FinishConnectionIO(MultiConnection *connection, bool raiseInterrupts) return true; } - rc = WaitLatchOrSocket(MyLatch, waitFlags, socket, 0, PG_WAIT_EXTENSION); + rc = WaitLatchOrSocket(MyLatch, waitFlags, sock, 0, PG_WAIT_EXTENSION); if (rc & WL_POSTMASTER_DEATH) { ereport(ERROR, (errmsg("postmaster was shut down, exiting"))); @@ -1047,7 +1047,7 @@ BuildWaitEventSet(MultiConnection **allConnections, int totalConnectionCount, { MultiConnection *connection = allConnections[pendingConnectionsStartIndex + connectionIndex]; - int socket = PQsocket(connection->pgConn); + int sock = PQsocket(connection->pgConn); /* * Always start by polling for both readability (server sent bytes) @@ -1055,7 +1055,7 @@ BuildWaitEventSet(MultiConnection **allConnections, int totalConnectionCount, */ int eventMask = WL_SOCKET_READABLE | WL_SOCKET_WRITEABLE; - AddWaitEventToSet(waitEventSet, eventMask, socket, NULL, (void *) connection); + AddWaitEventToSet(waitEventSet, eventMask, sock, NULL, (void *) connection); } /* diff --git a/src/backend/distributed/executor/adaptive_executor.c b/src/backend/distributed/executor/adaptive_executor.c index cc53687cf..ec724c9da 100644 --- a/src/backend/distributed/executor/adaptive_executor.c +++ b/src/backend/distributed/executor/adaptive_executor.c @@ -3611,7 +3611,7 @@ BuildWaitEventSet(List *sessionList) { WorkerSession *session = lfirst(sessionCell); MultiConnection *connection = session->connection; - int socket = 0; + int sock = 0; int waitEventSetIndex = 0; if (connection->pgConn == NULL) @@ -3626,14 +3626,14 @@ BuildWaitEventSet(List *sessionList) continue; } - socket = PQsocket(connection->pgConn); - if (socket == -1) + sock = PQsocket(connection->pgConn); + if (sock == -1) { /* connection was closed */ continue; } - waitEventSetIndex = AddWaitEventToSet(waitEventSet, connection->waitFlags, socket, + waitEventSetIndex = AddWaitEventToSet(waitEventSet, connection->waitFlags, sock, NULL, (void *) session); session->waitEventSetIndex = waitEventSetIndex; } @@ -3658,7 +3658,7 @@ UpdateWaitEventSetFlags(WaitEventSet *waitEventSet, List *sessionList) { WorkerSession *session = lfirst(sessionCell); MultiConnection *connection = session->connection; - int socket = 0; + int sock = 0; int waitEventSetIndex = session->waitEventSetIndex; if (connection->pgConn == NULL) @@ -3673,8 +3673,8 @@ UpdateWaitEventSetFlags(WaitEventSet *waitEventSet, List *sessionList) continue; } - socket = PQsocket(connection->pgConn); - if (socket == -1) + sock = PQsocket(connection->pgConn); + if (sock == -1) { /* connection was closed */ continue; diff --git a/src/backend/distributed/planner/distributed_planner.c b/src/backend/distributed/planner/distributed_planner.c index 3b86ed638..e97ed1c3d 100644 --- a/src/backend/distributed/planner/distributed_planner.c +++ b/src/backend/distributed/planner/distributed_planner.c @@ -1348,8 +1348,8 @@ multi_join_restriction_hook(PlannerInfo *root, * it to retrieve restrictions on relations. */ void -multi_relation_restriction_hook(PlannerInfo *root, RelOptInfo *relOptInfo, Index index, - RangeTblEntry *rte) +multi_relation_restriction_hook(PlannerInfo *root, RelOptInfo *relOptInfo, + Index restrictionIndex, RangeTblEntry *rte) { PlannerRestrictionContext *plannerRestrictionContext = NULL; RelationRestrictionContext *relationRestrictionContext = NULL; @@ -1379,7 +1379,7 @@ multi_relation_restriction_hook(PlannerInfo *root, RelOptInfo *relOptInfo, Index localTable = !distributedTable; relationRestriction = palloc0(sizeof(RelationRestriction)); - relationRestriction->index = index; + relationRestriction->index = restrictionIndex; relationRestriction->relationId = rte->relid; relationRestriction->rte = rte; relationRestriction->relOptInfo = relOptInfo; diff --git a/src/backend/distributed/planner/multi_logical_planner.c b/src/backend/distributed/planner/multi_logical_planner.c index b591d08db..c7a70c030 100644 --- a/src/backend/distributed/planner/multi_logical_planner.c +++ b/src/backend/distributed/planner/multi_logical_planner.c @@ -457,7 +457,6 @@ FullCompositeFieldList(List *compositeFieldList) foreach(fieldSelectCell, compositeFieldList) { FieldSelect *fieldSelect = (FieldSelect *) lfirst(fieldSelectCell); - uint32 compositeFieldIndex = 0; Expr *fieldExpression = fieldSelect->arg; if (!IsA(fieldExpression, Var)) @@ -467,7 +466,6 @@ FullCompositeFieldList(List *compositeFieldList) if (compositeFieldArray == NULL) { - uint32 index = 0; Var *compositeColumn = (Var *) fieldExpression; Oid compositeTypeId = compositeColumn->vartype; Oid compositeRelationId = get_typ_typrelid(compositeTypeId); @@ -478,13 +476,15 @@ FullCompositeFieldList(List *compositeFieldList) compositeFieldArray = palloc0(compositeFieldCount * sizeof(bool)); relation_close(relation, AccessShareLock); - for (index = 0; index < compositeFieldCount; index++) + for (uint32 compositeFieldIndex = 0; + compositeFieldIndex < compositeFieldCount; + compositeFieldIndex++) { - compositeFieldArray[index] = false; + compositeFieldArray[compositeFieldIndex] = false; } } - compositeFieldIndex = fieldSelect->fieldnum - 1; + uint32 compositeFieldIndex = fieldSelect->fieldnum - 1; compositeFieldArray[compositeFieldIndex] = true; } diff --git a/src/include/distributed/distributed_planner.h b/src/include/distributed/distributed_planner.h index 58bb2344d..4bc7314ce 100644 --- a/src/include/distributed/distributed_planner.h +++ b/src/include/distributed/distributed_planner.h @@ -108,7 +108,7 @@ extern List * ExtractRangeTableEntryList(Query *query); extern bool NeedsDistributedPlanning(Query *query); extern struct DistributedPlan * GetDistributedPlan(CustomScan *node); extern void multi_relation_restriction_hook(PlannerInfo *root, RelOptInfo *relOptInfo, - Index index, RangeTblEntry *rte); + Index restrictionIndex, RangeTblEntry *rte); extern void multi_join_restriction_hook(PlannerInfo *root, RelOptInfo *joinrel, RelOptInfo *outerrel,