[pgpool-hackers: 1645] Re: kind does not match error in pgpool
Muhammad Usama
m.usama at gmail.com
Mon Jun 20 22:48:08 JST 2016
Hi Ishii-San
Can you please have a look at the attached patch, It try to solve this
"Kind does not match .." problem by ignoring the notice messages while
reading the backend response in read_kind_from_backend() function
Best Regards
Muhammad Usama
On Tue, Apr 19, 2016 at 1:50 PM, Ahsan Hadi <ahsan.hadi at enterprisedb.com>
wrote:
> I agree this cause lot of annoyance to pgpool users and something we
> should address for 3.6.
>
> Usama,
> Is this added to 3.6 wiki?
>
> On Fri, Apr 15, 2016 at 11:46 AM, Muhammad Usama <m.usama at gmail.com>
> wrote:
>
>> Hi
>>
>> 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 three backend nodes
>> and pgpool is expecting to receive "[C] command complete" message from
>> all nodes for the last query. But while processing the query one of the
>> backend also produced a warning message.
>>
>> ... WARNING: database "testdb" must be vacuum within 11000000 transaction
>>
>> Please note that the query was successful on all attached backend, but
>> one backend also produced an extra warning message along with the command
>> complete message.
>>
>> Now pgpool will throw an error something like
>>
>> ERROR: pid 720: read_kind_from_backend: 1 th kind N does not match
>> with master or majority connection kind C
>>
>> But since the node would also have sent the expected command complete
>> message after that warning notice, So Ideally, pgpool should ignore the
>> WARNING message and compare the subsequent message, and only throw an error
>> if the message from nodes after ignoring notification messages differs.
>>
>> What are your thoughts on this?
>>
>> Kind regards
>> Muhammad Usama
>>
>>
>> _______________________________________________
>> pgpool-hackers mailing list
>> pgpool-hackers at pgpool.net
>> http://www.pgpool.net/mailman/listinfo/pgpool-hackers
>>
>>
>
>
> --
> Ahsan Hadi
> Snr Director Product Development
> EnterpriseDB Corporation
> The Enterprise Postgres Company
>
> Phone: +92-51-8358874
> Mobile: +92-333-5162114
>
> Website: www.enterprisedb.com
> EnterpriseDB Blog: http://blogs.enterprisedb.com/
> Follow us on Twitter: http://www.twitter.com/enterprisedb
>
> This e-mail message (and any attachment) is intended for the use of the
> individual or entity to whom it is addressed. This message contains
> information from EnterpriseDB Corporation that may be privileged,
> confidential, or exempt from disclosure under applicable law. If you are
> not the intended recipient or authorized to receive this for the intended
> recipient, any use, dissemination, distribution, retention, archiving, or
> copying of this communication is strictly prohibited. If you have received
> this e-mail in error, please notify the sender immediately by reply e-mail
> and delete this message.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.sraoss.jp/pipermail/pgpool-hackers/attachments/20160620/9f451880/attachment-0001.html>
-------------- next part --------------
diff --git a/src/protocol/pool_process_query.c b/src/protocol/pool_process_query.c
index 2625628..da88ac1 100644
--- a/src/protocol/pool_process_query.c
+++ b/src/protocol/pool_process_query.c
@@ -3334,32 +3334,43 @@ void read_kind_from_backend(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *bac
errdetail("backend:%d kind:'%c'",i, kind)));
/*
- * Read and discard parameter status
+ * Read and discard parameter status and notice messages
*/
- if (kind != 'S')
+ if (kind == 'N')
{
- break;
+ char *message = NULL;
+ if (pool_extract_error_message(false, CONNECTION(backend, i), MAJOR(backend), false, &message) == 1)
+ {
+ ereport(LOG,
+ (errmsg("Notice message received from backend %d while reading backend data packet kind",i),
+ errdetail("message : \"%s\"",message)));
+ pfree(message);
+ }
}
-
- pool_read(CONNECTION(backend, i), &len, sizeof(len));
- len = htonl(len) - 4;
- p = pool_read2(CONNECTION(backend, i), len);
- if (p)
+ else if (kind == 'S')
{
- value = p + strlen(p) + 1;
- ereport(DEBUG1,
- (errmsg("reading backend data packet kind"),
- errdetail("parameter name: %s value: \"%s\"", p, value)));
+ pool_read(CONNECTION(backend, i), &len, sizeof(len));
+ len = htonl(len) - 4;
+ p = pool_read2(CONNECTION(backend, i), len);
+ if (p)
+ {
+ value = p + strlen(p) + 1;
+ ereport(DEBUG1,
+ (errmsg("reading backend data packet kind"),
+ errdetail("parameter name: %s value: \"%s\"", p, value)));
- if (IS_MASTER_NODE_ID(i))
- pool_add_param(&CONNECTION(backend, i)->params, p, value);
+ if (IS_MASTER_NODE_ID(i))
+ pool_add_param(&CONNECTION(backend, i)->params, p, value);
+ }
+ else
+ {
+ ereport(WARNING,
+ (errmsg("failed to read parameter status packet from backend %d", i),
+ errdetail("read from backend failed")));
+ }
}
- else
- ereport(WARNING,
- (errmsg("failed to read parameter status packet from backend %d", i),
- errdetail("read from backend failed")));
- } while (kind == 'S');
+ } while (kind == 'S' || kind == 'N' );
#ifdef DEALLOCATE_ERROR_TEST
if (i == 1 && kind == 'C' &&
More information about the pgpool-hackers
mailing list