pgpool2.git / summary / log / commit / refs

commit    d48e4d1d6d2f85d2ae3ec5c866776e59bfb77ed3
Author:   Tatsuo Ishii <ishii at sraoss.co.jp>
Date:     Fri Oct 02 07:57:59 2009 +0000

    Fix Parse() to use wait_for_query_response() instead of synchronize().


pool_proto_modules.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/pool_proto_modules.c b/pool_proto_modules.c index 5cf1b48c3..4f7abcc2a 100644 --- a/pool_proto_modules.c +++ b/pool_proto_modules.c @@ -996,12 +996,22 @@ POOL_STATUS Parse(POOL_CONNECTION *frontend, if (REPLICATION || PARALLEL_MODE || MASTER_SLAVE) { - /* We must synchronize because Parse message acquires table + /* + * We must synchronize because Parse message acquires table * locks. */ - pool_debug("waiting for master completing the query"); - if (synchronize(MASTER(backend))) + pool_debug("Parse: waiting for master completing the query"); + if (wait_for_query_response(frontend, MASTER(backend), string, MAJOR(backend)) != POOL_CONTINUE) + { + /* Cancel current transaction */ + CancelPacket cancel_packet; + + cancel_packet.protoVersion = htonl(PROTO_CANCEL); + cancel_packet.pid = MASTER_CONNECTION(backend)->pid; + cancel_packet.key= MASTER_CONNECTION(backend)->key; + cancel_request(&cancel_packet); return POOL_END; + } /* * We must check deadlock error because a aborted transaction @@ -1039,9 +1049,18 @@ POOL_STATUS Parse(POOL_CONNECTION *frontend, if (!VALID_BACKEND(i) || IS_MASTER_NODE_ID(i)) continue; - pool_debug("waiting for %dth backend completing the query", i); - if (synchronize(CONNECTION(backend, i))) + pool_debug("Parse: waiting for %dth backend completing the query", i); + if (wait_for_query_response(frontend, CONNECTION(backend), string, MAJOR(backend)) != POOL_CONTINUE) + { + /* Cancel current transaction */ + CancelPacket cancel_packet; + + cancel_packet.protoVersion = htonl(PROTO_CANCEL); + cancel_packet.pid = MASTER_CONNECTION(backend)->pid; + cancel_packet.key= MASTER_CONNECTION(backend)->key; + cancel_request(&cancel_packet); return POOL_END; + } } } [parent: 5010555d8e25]