Rename GetConnection to address name conflict

cr: @onderkalaci
pull/341/head
Jason Petersen 2016-02-12 16:58:33 -07:00
commit 334f800016
4 changed files with 13 additions and 13 deletions

View File

@ -250,7 +250,7 @@ ExecuteDistributedModify(Task *task)
Assert(taskPlacement->shardState == FILE_FINALIZED); Assert(taskPlacement->shardState == FILE_FINALIZED);
connection = GetConnection(nodeName, nodePort); connection = GetOrEstablishConnection(nodeName, nodePort);
if (connection == NULL) if (connection == NULL)
{ {
failedPlacementList = lappend(failedPlacementList, taskPlacement); failedPlacementList = lappend(failedPlacementList, taskPlacement);
@ -383,7 +383,7 @@ ExecuteTaskAndStoreResults(Task *task, TupleDesc tupleDescriptor,
bool queryOK = false; bool queryOK = false;
bool storedOK = false; bool storedOK = false;
PGconn *connection = GetConnection(nodeName, nodePort); PGconn *connection = GetOrEstablishConnection(nodeName, nodePort);
if (connection == NULL) if (connection == NULL)
{ {
continue; continue;

View File

@ -48,7 +48,7 @@ initialize_remote_temp_table(PG_FUNCTION_ARGS)
int32 nodePort = PG_GETARG_INT32(1); int32 nodePort = PG_GETARG_INT32(1);
PGresult *result = NULL; PGresult *result = NULL;
PGconn *connection = GetConnection(nodeName, nodePort); PGconn *connection = GetOrEstablishConnection(nodeName, nodePort);
if (connection == NULL) if (connection == NULL)
{ {
PG_RETURN_BOOL(false); PG_RETURN_BOOL(false);
@ -79,7 +79,7 @@ count_remote_temp_table_rows(PG_FUNCTION_ARGS)
Datum count = Int32GetDatum(-1); Datum count = Int32GetDatum(-1);
PGresult *result = NULL; PGresult *result = NULL;
PGconn *connection = GetConnection(nodeName, nodePort); PGconn *connection = GetOrEstablishConnection(nodeName, nodePort);
if (connection == NULL) if (connection == NULL)
{ {
PG_RETURN_DATUM(count); PG_RETURN_DATUM(count);
@ -114,7 +114,7 @@ get_and_purge_connection(PG_FUNCTION_ARGS)
char *nodeName = PG_GETARG_CSTRING(0); char *nodeName = PG_GETARG_CSTRING(0);
int32 nodePort = PG_GETARG_INT32(1); int32 nodePort = PG_GETARG_INT32(1);
PGconn *connection = GetConnection(nodeName, nodePort); PGconn *connection = GetOrEstablishConnection(nodeName, nodePort);
if (connection == NULL) if (connection == NULL)
{ {
PG_RETURN_BOOL(false); PG_RETURN_BOOL(false);
@ -136,7 +136,7 @@ set_connection_status_bad(PG_FUNCTION_ARGS)
char *nodeName = PG_GETARG_CSTRING(0); char *nodeName = PG_GETARG_CSTRING(0);
int32 nodePort = PG_GETARG_INT32(1); int32 nodePort = PG_GETARG_INT32(1);
PGconn *connection = GetConnection(nodeName, nodePort); PGconn *connection = GetOrEstablishConnection(nodeName, nodePort);
if (connection == NULL) if (connection == NULL)
{ {
PG_RETURN_BOOL(false); PG_RETURN_BOOL(false);

View File

@ -32,7 +32,7 @@
/* /*
* NodeConnectionHash is the connection hash itself. It begins uninitialized. * NodeConnectionHash is the connection hash itself. It begins uninitialized.
* The first call to GetConnection triggers hash creation. * The first call to GetOrEstablishConnection triggers hash creation.
*/ */
static HTAB *NodeConnectionHash = NULL; static HTAB *NodeConnectionHash = NULL;
@ -44,10 +44,10 @@ static char * ConnectionGetOptionValue(PGconn *connection, char *optionKeyword);
/* /*
* GetConnection returns a PGconn which can be used to execute queries on a * GetOrEstablishConnection returns a PGconn which can be used to execute
* remote PostgreSQL server. If no suitable connection to the specified node on * queries on a remote PostgreSQL server. If no suitable connection to the
* the specified port yet exists, the function establishes a new connection and * specified node on the specified port yet exists, the function establishes
* returns that. * a new connection and adds it to the connection cache before returning it.
* *
* Returned connections are guaranteed to be in the CONNECTION_OK state. If the * Returned connections are guaranteed to be in the CONNECTION_OK state. If the
* requested connection cannot be established, or if it was previously created * requested connection cannot be established, or if it was previously created
@ -56,7 +56,7 @@ static char * ConnectionGetOptionValue(PGconn *connection, char *optionKeyword);
* This function throws an error if a hostname over 255 characters is provided. * This function throws an error if a hostname over 255 characters is provided.
*/ */
PGconn * PGconn *
GetConnection(char *nodeName, int32 nodePort) GetOrEstablishConnection(char *nodeName, int32 nodePort)
{ {
PGconn *connection = NULL; PGconn *connection = NULL;
NodeConnectionKey nodeConnectionKey; NodeConnectionKey nodeConnectionKey;

View File

@ -51,7 +51,7 @@ typedef struct NodeConnectionEntry
/* function declarations for obtaining and using a connection */ /* function declarations for obtaining and using a connection */
extern PGconn * GetConnection(char *nodeName, int32 nodePort); extern PGconn * GetOrEstablishConnection(char *nodeName, int32 nodePort);
extern void PurgeConnection(PGconn *connection); extern void PurgeConnection(PGconn *connection);
extern void ReportRemoteError(PGconn *connection, PGresult *result); extern void ReportRemoteError(PGconn *connection, PGresult *result);