Merge pull request #1108 from citusdata/feature/interruptible-router-queries

Use interrupt checking libpq wrappers in router executor.
pull/1109/head
Andres Freund 2017-01-09 16:33:57 -08:00 committed by GitHub
commit 4f6c2cac67
1 changed files with 10 additions and 9 deletions

View File

@ -1168,13 +1168,12 @@ SendQueryInSingleRowMode(MultiConnection *connection, char *query,
ExtractParametersFromParamListInfo(paramListInfo, &parameterTypes, ExtractParametersFromParamListInfo(paramListInfo, &parameterTypes,
&parameterValues); &parameterValues);
querySent = PQsendQueryParams(connection->pgConn, query, querySent = SendRemoteCommandParams(connection, query, parameterCount,
parameterCount, parameterTypes, parameterValues, parameterTypes, parameterValues);
NULL, NULL, 0);
} }
else else
{ {
querySent = PQsendQuery(connection->pgConn, query); querySent = SendRemoteCommand(connection, query);
} }
if (querySent == 0) if (querySent == 0)
@ -1307,8 +1306,9 @@ StoreQueryResult(MaterialState *routerState, MultiConnection *connection,
uint32 rowCount = 0; uint32 rowCount = 0;
uint32 columnCount = 0; uint32 columnCount = 0;
ExecStatusType resultStatus = 0; ExecStatusType resultStatus = 0;
bool doRaiseInterrupts = true;
PGresult *result = PQgetResult(connection->pgConn); PGresult *result = GetRemoteCommandResult(connection, doRaiseInterrupts);
if (result == NULL) if (result == NULL)
{ {
break; break;
@ -1410,13 +1410,14 @@ ConsumeQueryResult(MultiConnection *connection, bool failOnError, int64 *rows)
*rows = 0; *rows = 0;
/* /*
* Due to single row mode we have to do multiple PQgetResult() to finish * Due to single row mode we have to do multiple GetRemoteCommandResult()
* processing of this query, even without RETURNING. For single-row mode * to finish processing of this query, even without RETURNING. For
* we have to loop until all rows are consumed. * single-row mode we have to loop until all rows are consumed.
*/ */
while (true) while (true)
{ {
PGresult *result = PQgetResult(connection->pgConn); const bool doRaiseInterrupts = true;
PGresult *result = GetRemoteCommandResult(connection, doRaiseInterrupts);
ExecStatusType status = PGRES_COMMAND_OK; ExecStatusType status = PGRES_COMMAND_OK;
if (result == NULL) if (result == NULL)