mirror of https://github.com/citusdata/citus.git
Add some asserts to pass static analysis (#3805)
parent
cbda951395
commit
c6f5d5fe88
|
@ -193,7 +193,16 @@ GetNodeConnection(uint32 flags, const char *hostname, int32 port)
|
|||
MultiConnection *
|
||||
StartNodeConnection(uint32 flags, const char *hostname, int32 port)
|
||||
{
|
||||
return StartNodeUserDatabaseConnection(flags, hostname, port, NULL, NULL);
|
||||
MultiConnection *connection = StartNodeUserDatabaseConnection(flags, hostname, port,
|
||||
NULL, NULL);
|
||||
|
||||
/*
|
||||
* connection can only be NULL for optional connections, which we don't
|
||||
* support in this codepath.
|
||||
*/
|
||||
Assert((flags & OPTIONAL_CONNECTION) == 0);
|
||||
Assert(connection != NULL);
|
||||
return connection;
|
||||
}
|
||||
|
||||
|
||||
|
@ -209,6 +218,13 @@ GetNodeUserDatabaseConnection(uint32 flags, const char *hostname, int32 port,
|
|||
MultiConnection *connection = StartNodeUserDatabaseConnection(flags, hostname, port,
|
||||
user, database);
|
||||
|
||||
/*
|
||||
* connection can only be NULL for optional connections, which we don't
|
||||
* support in this codepath.
|
||||
*/
|
||||
Assert((flags & OPTIONAL_CONNECTION) == 0);
|
||||
Assert(connection != NULL);
|
||||
|
||||
FinishConnectionEstablishment(connection);
|
||||
|
||||
return connection;
|
||||
|
@ -236,6 +252,13 @@ StartWorkerListConnections(List *workerNodeList, uint32 flags, const char *user,
|
|||
nodeName, nodePort,
|
||||
user, database);
|
||||
|
||||
/*
|
||||
* connection can only be NULL for optional connections, which we don't
|
||||
* support in this codepath.
|
||||
*/
|
||||
Assert((flags & OPTIONAL_CONNECTION) == 0);
|
||||
Assert(connection != NULL);
|
||||
|
||||
connectionList = lappend(connectionList, connection);
|
||||
}
|
||||
|
||||
|
|
|
@ -294,6 +294,13 @@ StartPlacementListConnection(uint32 flags, List *placementAccessList,
|
|||
chosenConnection = StartNodeUserDatabaseConnection(flags, nodeName, nodePort,
|
||||
userName, NULL);
|
||||
|
||||
/*
|
||||
* chosenConnection can only be NULL for optional connections, which we
|
||||
* don't support in this codepath.
|
||||
*/
|
||||
Assert((flags & OPTIONAL_CONNECTION) == 0);
|
||||
Assert(chosenConnection != NULL);
|
||||
|
||||
if ((flags & CONNECTION_PER_PLACEMENT) &&
|
||||
ConnectionAccessedDifferentPlacement(chosenConnection, placement))
|
||||
{
|
||||
|
@ -314,6 +321,13 @@ StartPlacementListConnection(uint32 flags, List *placementAccessList,
|
|||
nodeName, nodePort,
|
||||
userName, NULL);
|
||||
|
||||
/*
|
||||
* chosenConnection can only be NULL for optional connections,
|
||||
* which we don't support in this codepath.
|
||||
*/
|
||||
Assert((flags & OPTIONAL_CONNECTION) == 0);
|
||||
Assert(chosenConnection != NULL);
|
||||
|
||||
Assert(!ConnectionAccessedDifferentPlacement(chosenConnection, placement));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -150,6 +150,13 @@ MultiClientConnectStart(const char *nodeName, uint32 nodePort, const char *nodeD
|
|||
MultiConnection *connection = StartNodeUserDatabaseConnection(connectionFlags,
|
||||
nodeName, nodePort,
|
||||
userName, nodeDatabase);
|
||||
|
||||
/*
|
||||
* connection can only be NULL for optional connections, which we don't
|
||||
* support in this codepath.
|
||||
*/
|
||||
Assert((connectionFlags & OPTIONAL_CONNECTION) == 0);
|
||||
Assert(connection != NULL);
|
||||
ConnStatusType connStatusType = PQstatus(connection->pgConn);
|
||||
|
||||
/*
|
||||
|
|
|
@ -409,6 +409,13 @@ OpenConnectionsToWorkersInParallel(TargetWorkerSet targetWorkerSet, const char *
|
|||
MultiConnection *connection = StartNodeUserDatabaseConnection(connectionFlags,
|
||||
nodeName, nodePort,
|
||||
user, NULL);
|
||||
|
||||
/*
|
||||
* connection can only be NULL for optional connections, which we don't
|
||||
* support in this codepath.
|
||||
*/
|
||||
Assert((connectionFlags & OPTIONAL_CONNECTION) == 0);
|
||||
Assert(connection != NULL);
|
||||
connectionList = lappend(connectionList, connection);
|
||||
}
|
||||
return connectionList;
|
||||
|
@ -476,6 +483,12 @@ SendCommandToWorkersParamsInternal(TargetWorkerSet targetWorkerSet, const char *
|
|||
nodeName, nodePort,
|
||||
user, NULL);
|
||||
|
||||
/*
|
||||
* connection can only be NULL for optional connections, which we don't
|
||||
* support in this codepath.
|
||||
*/
|
||||
Assert((connectionFlags & OPTIONAL_CONNECTION) == 0);
|
||||
Assert(connection != NULL);
|
||||
MarkRemoteTransactionCritical(connection);
|
||||
|
||||
connectionList = lappend(connectionList, connection);
|
||||
|
|
Loading…
Reference in New Issue