mirror of https://github.com/citusdata/citus.git
Delete ExecuteRemoteCommand function
parent
173fe137af
commit
a17ab6408a
|
@ -1125,65 +1125,6 @@ ExecuteRemoteQuery(const char *nodeName, uint32 nodePort, char *runAsUser,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* ExecuteRemoteCommand executes the given SQL command. This command could be an
|
|
||||||
* Insert, Update, or Delete statement, or a utility command that returns
|
|
||||||
* nothing. If query is successfuly executed, the function returns true.
|
|
||||||
* Otherwise, it returns false.
|
|
||||||
*/
|
|
||||||
bool
|
|
||||||
ExecuteRemoteCommand(const char *nodeName, uint32 nodePort, StringInfo queryString)
|
|
||||||
{
|
|
||||||
char *nodeDatabase = get_database_name(MyDatabaseId);
|
|
||||||
int32 connectionId = -1;
|
|
||||||
QueryStatus queryStatus = CLIENT_INVALID_QUERY;
|
|
||||||
bool querySent = false;
|
|
||||||
bool queryReady = false;
|
|
||||||
bool queryDone = false;
|
|
||||||
|
|
||||||
connectionId = MultiClientConnect(nodeName, nodePort, nodeDatabase, NULL);
|
|
||||||
if (connectionId == INVALID_CONNECTION_ID)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
querySent = MultiClientSendQuery(connectionId, queryString->data);
|
|
||||||
if (!querySent)
|
|
||||||
{
|
|
||||||
MultiClientDisconnect(connectionId);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (!queryReady)
|
|
||||||
{
|
|
||||||
ResultStatus resultStatus = MultiClientResultStatus(connectionId);
|
|
||||||
if (resultStatus == CLIENT_RESULT_READY)
|
|
||||||
{
|
|
||||||
queryReady = true;
|
|
||||||
}
|
|
||||||
else if (resultStatus == CLIENT_RESULT_BUSY)
|
|
||||||
{
|
|
||||||
long sleepIntervalPerCycle = RemoteTaskCheckInterval * 1000L;
|
|
||||||
pg_usleep(sleepIntervalPerCycle);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MultiClientDisconnect(connectionId);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
queryStatus = MultiClientQueryStatus(connectionId);
|
|
||||||
if (queryStatus == CLIENT_QUERY_DONE)
|
|
||||||
{
|
|
||||||
queryDone = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
MultiClientDisconnect(connectionId);
|
|
||||||
return queryDone;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parses the given DDL command, and returns the tree node for parsed command.
|
* Parses the given DDL command, and returns the tree node for parsed command.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -128,8 +128,6 @@ extern List * TableDDLCommandList(const char *nodeName, uint32 nodePort,
|
||||||
extern StringInfo TaskFilename(StringInfo directoryName, uint32 taskId);
|
extern StringInfo TaskFilename(StringInfo directoryName, uint32 taskId);
|
||||||
extern List * ExecuteRemoteQuery(const char *nodeName, uint32 nodePort, char *runAsUser,
|
extern List * ExecuteRemoteQuery(const char *nodeName, uint32 nodePort, char *runAsUser,
|
||||||
StringInfo queryString);
|
StringInfo queryString);
|
||||||
extern bool ExecuteRemoteCommand(const char *nodeName, uint32 nodePort,
|
|
||||||
StringInfo queryString);
|
|
||||||
extern List * ColumnDefinitionList(List *columnNameList, List *columnTypeList);
|
extern List * ColumnDefinitionList(List *columnNameList, List *columnTypeList);
|
||||||
extern CreateStmt * CreateStatement(RangeVar *relation, List *columnDefinitionList);
|
extern CreateStmt * CreateStatement(RangeVar *relation, List *columnDefinitionList);
|
||||||
extern CopyStmt * CopyStatement(RangeVar *relation, char *sourceFilename);
|
extern CopyStmt * CopyStatement(RangeVar *relation, char *sourceFilename);
|
||||||
|
|
Loading…
Reference in New Issue