summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavan Deolasee2016-07-06 09:46:47 +0000
committerPavan Deolasee2016-10-18 10:05:30 +0000
commit671432c6e693804c9701ae9622591c6b31fee593 (patch)
tree8b3a860d00817bb2ccefca5855314fc89a864877
parent1a389bc9194040a79082ac8b80626d9ea1545ab7 (diff)
Don't wait indefinitely while trying to abort a transaction on the remote node.
Treat this more as a work-around until we investigate the reasons for remote nodes not honouring query cancellation for some complicated queries, requiring nested remote subquery plans
-rw-r--r--src/backend/pgxc/pool/execRemote.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/backend/pgxc/pool/execRemote.c b/src/backend/pgxc/pool/execRemote.c
index a52fd7a732..930dc2d52b 100644
--- a/src/backend/pgxc/pool/execRemote.c
+++ b/src/backend/pgxc/pool/execRemote.c
@@ -2622,12 +2622,16 @@ pgxc_node_remote_abort(void)
PGXCNodeHandle *connections[MaxDataNodes + MaxCoords];
int conn_count = 0;
PGXCNodeAllHandles *handles = get_current_handles();
+ struct timeval timeout;
SetSendCommandId(false);
elog(DEBUG5, "pgxc_node_remote_abort - dn_conn_count %d, co_conn_count %d",
handles->dn_conn_count, handles->co_conn_count);
+ timeout.tv_sec = 60;
+ timeout.tv_usec = 0;
+
for (i = 0; i < handles->dn_conn_count; i++)
{
PGXCNodeHandle *conn = handles->datanode_handles[i];
@@ -2654,7 +2658,7 @@ pgxc_node_remote_abort(void)
if (conn->needSync)
{
pgxc_node_send_sync(conn);
- pgxc_node_receive(1, &conn, NULL);
+ pgxc_node_receive(1, &conn, &timeout);
}
/*
* Do not matter, is there committed or failed transaction,
@@ -2687,7 +2691,7 @@ pgxc_node_remote_abort(void)
if (conn->needSync)
{
pgxc_node_send_sync(conn);
- pgxc_node_receive(1, &conn, NULL);
+ pgxc_node_receive(1, &conn, &timeout);
}
/*
* Do not matter, is there committed or failed transaction,
@@ -2710,7 +2714,7 @@ pgxc_node_remote_abort(void)
{
InitResponseCombiner(&combiner, conn_count, COMBINE_TYPE_NONE);
/* Receive responses */
- result = pgxc_node_receive_responses(conn_count, connections, NULL, &combiner);
+ result = pgxc_node_receive_responses(conn_count, connections, &timeout, &combiner);
if (result || !validate_combiner(&combiner))
result = EOF;
else