pgpool2.git / summary / log / commit / refs

commit    51779fc0abbef7f25fe9d9d237d88bae286eb9f8
Author:   Tatsuo Ishii <ishii@postgresql.org>
Date:     Fri Apr 20 08:08:46 2012 +0000

    Fix hungup when query fetched from cache and then hit ^D with psql in
    an explicit transaction. First primary and standby state is 'T'(idle
    in transaction). After fetching cache, pool_fetch_from_memory_cache()
    unconditionally sets transaction state to 'I'(idle) on *only* primary.
    Then ABORT is going to be sent by reset_query_list. SimpleQuery calls
    pool_send_and_wait. However pool_send_and_wait does not send
    COMMIT/ABORT to the node which is in 'I' state, so only standby
    receives ABORT command. After this, ProcessBackendresponse expects to
    receive response from primary, which will never happen of course.
    Solution is, fix pool_fetch_from_memory_cache() not to set transaction
    state, rather inherit previous state.


pool_memqcache.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pool_memqcache.c b/pool_memqcache.c index 47491cc27..4618d279f 100644 --- a/pool_memqcache.c +++ b/pool_memqcache.c @@ -579,10 +579,10 @@ POOL_STATUS pool_fetch_from_memory_cache(POOL_CONNECTION *frontend, { signed char state; - state = 'I'; - - /* set transaction state */ - MASTER(backend)->tstate = state; + /* + * We keep previous transaction state. + */ + state = MASTER(backend)->tstate; send_message(frontend, 'Z', 5, (char *)&state); } else [parent: f9a4c92bb653]