From: Pavan Deolasee Date: Wed, 6 Jul 2016 09:46:47 +0000 (+0530) Subject: Don't wait indefinitely while trying to abort a transaction on the remote node. X-Git-Tag: XL9_5_R1_2~35 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=56879e3ba66e1fdc62f69f94fd31ff49fedb4ff4;p=postgres-xl.git 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 --- diff --git a/src/backend/pgxc/pool/execRemote.c b/src/backend/pgxc/pool/execRemote.c index ac5fa800ff..9d9d20add5 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