mirror of https://github.com/citusdata/citus.git
Merge pull request #2031 from citusdata/fix_immediate_shut_down_issue
Improve error handling on failurespull/2038/head
commit
e7b28dd469
|
@ -65,24 +65,7 @@ IsResponseOK(PGresult *result)
|
||||||
void
|
void
|
||||||
ForgetResults(MultiConnection *connection)
|
ForgetResults(MultiConnection *connection)
|
||||||
{
|
{
|
||||||
while (true)
|
ClearResults(connection, false);
|
||||||
{
|
|
||||||
PGresult *result = NULL;
|
|
||||||
const bool dontRaiseErrors = false;
|
|
||||||
|
|
||||||
result = GetRemoteCommandResult(connection, dontRaiseErrors);
|
|
||||||
if (result == NULL)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (PQresultStatus(result) == PGRES_COPY_IN)
|
|
||||||
{
|
|
||||||
PQputCopyEnd(connection->pgConn, NULL);
|
|
||||||
|
|
||||||
/* TODO: mark transaction as failed, once we can. */
|
|
||||||
}
|
|
||||||
PQclear(result);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -123,6 +106,14 @@ ClearResults(MultiConnection *connection, bool raiseErrors)
|
||||||
MarkRemoteTransactionFailed(connection, raiseErrors);
|
MarkRemoteTransactionFailed(connection, raiseErrors);
|
||||||
|
|
||||||
success = false;
|
success = false;
|
||||||
|
|
||||||
|
/* an error happened, there is nothing we can do more */
|
||||||
|
if (PQresultStatus(result) == PGRES_FATAL_ERROR)
|
||||||
|
{
|
||||||
|
PQclear(result);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PQclear(result);
|
PQclear(result);
|
||||||
|
@ -550,6 +541,12 @@ GetRemoteCommandResult(MultiConnection *connection, bool raiseInterrupts)
|
||||||
|
|
||||||
if (!FinishConnectionIO(connection, raiseInterrupts))
|
if (!FinishConnectionIO(connection, raiseInterrupts))
|
||||||
{
|
{
|
||||||
|
/* some error(s) happened while doing the I/O, signal the callers */
|
||||||
|
if (PQstatus(pgConn) == CONNECTION_BAD)
|
||||||
|
{
|
||||||
|
return PQmakeEmptyPGresult(pgConn, PGRES_FATAL_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1446,6 +1446,12 @@ StoreQueryResult(CitusScanState *scanState, MultiConnection *connection,
|
||||||
|
|
||||||
commandFailed = true;
|
commandFailed = true;
|
||||||
|
|
||||||
|
/* an error happened, there is nothing we can do more */
|
||||||
|
if (resultStatus == PGRES_FATAL_ERROR)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* continue, there could be other lingering results due to row mode */
|
/* continue, there could be other lingering results due to row mode */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1565,6 +1571,12 @@ ConsumeQueryResult(MultiConnection *connection, bool failOnError, int64 *rows)
|
||||||
|
|
||||||
commandFailed = true;
|
commandFailed = true;
|
||||||
|
|
||||||
|
/* an error happened, there is nothing we can do more */
|
||||||
|
if (status == PGRES_FATAL_ERROR)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* continue, there could be other lingering results due to row mode */
|
/* continue, there could be other lingering results due to row mode */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -369,8 +369,8 @@ SELECT create_distributed_table('t1', 'a');
|
||||||
WARNING: function assign_distributed_transaction_id(integer, integer, unknown) does not exist
|
WARNING: function assign_distributed_transaction_id(integer, integer, unknown) does not exist
|
||||||
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
|
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
|
||||||
CONTEXT: while executing command on localhost:57637
|
CONTEXT: while executing command on localhost:57637
|
||||||
ERROR: current transaction is aborted, commands ignored until end of transaction block
|
ERROR: connection error: localhost:57637
|
||||||
CONTEXT: while executing command on localhost:57637
|
DETAIL: another command is already in progress
|
||||||
\c regression
|
\c regression
|
||||||
\c - - - :worker_1_port
|
\c - - - :worker_1_port
|
||||||
DROP DATABASE another;
|
DROP DATABASE another;
|
||||||
|
|
Loading…
Reference in New Issue