[Pgpool-general] Problem with cursors and pgpool

Brock b at pnl.gov
Fri Jun 10 23:48:23 UTC 2011


I have followed the tutorial on http://pgpool.projects.postgresql.org/pgpool-
II/doc/tutorial-en.html in order to set up parallel query with the database 
'bench_parallel'.  I have run `pgbench -i -s 3 -p 9999 bench_parallel -U 
postgres`  in order to initialize that database creating 300000 accounts in the 
accounts table.

I can verify parallel inserts are working just fine:
running a 'select min(aid), max(aid) from pgbench_accounts;' on each of the 
backends...

first backend:
 min |  max   
-----+--------
   1 | 100000
(1 row)

second backend:
  min   |  max   
--------+--------
 100001 | 200000
(1 row)

third backend;
  min   |  max   
--------+--------
 200001 | 300000


However, there is one thing that is not working and I consider this a bug.   
After you have everything set up with the parallel query in the tutorial, run 
the following select cursor statements:


bench_parallel=# begin; declare foo cursor for select * from pgbench_accounts 
where aid = 1; fetch 1 from foo; commit;
BEGIN
DECLARE CURSOR
ERROR:  kind mismatch among backends. Possible last query was: "fetch 1 from 
foo;" kind details are: 0[D] 1[C] 2[C]
HINT:  check data consistency among db nodes
server closed the connection unexpectedly
	This probably means the server terminated abnormally
	before or while processing the request.
The connection to the server was lost. Attempting reset: Succeeded.
WARNING:  there is no transaction in progress
COMMIT
bench_parallel=# 


So it looks to me like pgpool is expecting data from backends 2 & 3 but only got 
data from backend 1.  If you just run the select statement ( select * from 
pgbench_accounts where aid = 1; ) not in a cursor it works like a charm, but 
cursors seem to throw pgpool off.  I will be willing to take a look at the code 
to search for a solution, but this will take me some time to attempt to 
understand what is going on.



More information about the Pgpool-general mailing list