[pgpool-committers: 3351] pgpool: Fix for [pgpool-hackers: 1501] kind does not match error

Muhammad Usama m.usama at gmail.com
Sat Jul 16 04:51:55 JST 2016

Fix for  [pgpool-hackers: 1501]  kind does not match error

pgpool throws ".. kind does not match.." error message when all the attached
backend nodes do not return the same response to the query. Although this error
message can be a symptom of the backend node sync issue in most cases, but in
case when the message kind of backend nodes differs because one of the backend
returned the notice response while the other returned some other kind then that
case should not be considered as an error case.

Consider the scenario where a pgpool is connected to multiple backend nodes and
is expecting to receive "[C] command complete" message from all nodes.
But while processing the query one of the backend also produced an extra warning message.
... WARNING: database "testdb" must be vacuum within 11000000 transaction

Although that the query was eventually successful on all backends, but as soon
as pgpool reads this WARNING message from one backend it will throw an error
ERROR: read_kind_from_backend: 1 th kind N does not match with master or majority connection kind C

But if pgpool would have kept reading from the backend, It would have also got
the expected command complete message after that warning notice

The solution for this is to keep forwarding the notice/log messages to the
frontend while reading the backend response in read_kind_from_backend() function
until the ERROR or expected message is received.

Though there is also one slight drawback of this approach, If the backends are
configured to forward all log messages to the client application, then the client
applications will get multiple log messages for the queries that are sent to
more than one node by pgpool.

test=# begin;
LOG:  statement: begin;
LOG:  statement: begin;

But since it is a very rare scenario, and just a minor inconvenience so it's not
holding us back to commit this solution until a better one arrives.



Modified Files
src/protocol/pool_process_query.c | 125 ++++++++++++++++++++++++++++++++------
1 file changed, 106 insertions(+), 19 deletions(-)

More information about the pgpool-committers mailing list