Refactor pool_process_query(). Extract lengthy code in for loop and put into new function read_packets_and_process(). Also move pool_is_query_in_progress() to othe place to make cleaner and simpler if/else condition.
Refactor pool_process_query(). Extract lengthy code in for loop and
put into new function read_packets_and_process(). Also move
pool_is_query_in_progress() to othe place to make cleaner and simpler
if/else condition.

Deal with the case when: 1) query not in progress and 2) other than
master node has pending data. It is reported that pgpool goes into
infinite loop in this case.
http://www.pgpool.net/pipermail/pgpool-general/2011-December/000042.html

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