[pgpool-committers: 4071] pgpool: Fix query cache hang when used by node.js.

Tatsuo Ishii ishii at postgresql.org
Wed May 31 10:57:22 JST 2017


Fix query cache hang when used by node.js.

node.js sends a query in following pattern:

Parse
Bind
Describe
Execute
Flush
Sync

Notice the "Flush" message. This is unnecessary message and Pgpool-II
did not prepare for it. Since Pgpool-I supposed that next message to
Execute is "Sync" in pool_fetch_from_memory_cache(), it actually read
the "Flush" message and forwarded to backend, then discarded
subsequent "Ready for query" message, which was actually a "Sync"
message. That results in no "ready for query" message from backend.

Fix is, do not have any assumption regarding messages after Execute,
instead returns to the message processing loop. This way, whatever
messages coming after Execute should be properly processed.

Following is the test data for pgproto.

'Q'	"DROP TABLE IF EXISTS pgproto_test1"
'Y'
'Q'	"CREATE TABLE pgproto_test1(i INT)"
'Y'
'Q'	"INSERT INTO pgproto_test1 VALUES(1)"
'Y'

'P'	"S2"	"SELECT 1 FROM pgproto_test1"	0
'B'	""	"S2"	0	0	0
'D'	'S'	"S2"
'E'	""	0
'H'
'C'	'S'	"S2"
'S'
'Y'

'P'	"S2"	"SELECT 1 FROM pgproto_test1"	0
'B'	""	"S2"	0	0	0
'D'	'S'	"S2"
'E'	""	0
'H'
'C'	'S'	"S2"
'S'
'Y'
'X'

Discussion: http://www.pgpool.net/pipermail/pgpool-general/2017-May/005569.html

Branch
------
V3_4_STABLE

Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=4d2281ef24bba3dba847a8cd5bcf68a44c29701a

Modified Files
--------------
src/query_cache/pool_memqcache.c | 45 ++++------------------------------------
1 file changed, 4 insertions(+), 41 deletions(-)



More information about the pgpool-committers mailing list