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.
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.

treasure-data/prestogres,treasure-data/prestogres,treasure-data/prestogres,treasure-data/prestogres,treasure-data/prestogres,treasure-data/prestogres,treasure-data/prestogres