Fix load balancing bug in streaming replication mode.
authorTatsuo Ishii <ishii@postgresql.org>
Mon, 30 Jan 2017 07:30:57 +0000 (16:30 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Mon, 30 Jan 2017 07:30:57 +0000 (16:30 +0900)
commitf217239c0b92aaa6324c2c4ade8a3a7622af8a09
treebb17a3715b34a13c05c77ca946c1e72d0c12fc99
parent6c2d73da42689eaba2f192052896a0229c9bbaef
Fix load balancing bug in streaming replication mode.

In an explicit transaction, any SELECT will be load balanced until
write query is sent. After writing query is sent, any SELECT should be
sent to the primary node. However if a SELECT is sent before a sync
message is sent, this does not work since the treatment of writing
query is done after ready for query message arrives. Solution is, the
treatment for writing query is done in executing the writing query as
well.

The bug has been there since V3.5.
src/protocol/pool_proto_modules.c