pgpool2.git / summary / log / commit / refs

commit    6c2d73da42689eaba2f192052896a0229c9bbaef
Author:   Tatsuo Ishii <ishii@postgresql.org>
Date:     Mon Jan 30 06:29:29 2017 +0000

    Fix yet another kind mismatch error in streaming replication mode.
    
    1) Parse "BEGIN" using statement S1, and it is sent to both node 0 and 1.
    
    2) Close S1.
    
    3) Parse SELECT using S1, and it is sent to node 0 (or 1).
    
    4) Bind retrieves info (sent_messages) regarding S1. Since Pgpool-II
       only removes info on S1 when CloseComplete received, Bind decides
       to send bind message to both node 0 & 1 because it was the info
       regarding BEGIN. Node 0 or 1 tries to bind to non existent
       statement S1.
    
       As a result, something like "failed to read kind from backend.
       kind mismatch among backends. Possible last query was: "BEGIN" kind
       details are: 0[E: prepared statement "S1" does not exist] 1[3]
       check data consistency among db nodes" occurs.
    
    Note that in 3) if other than S1 is used, the problem does not occur.
    Solution is, removing S1 when Close message is received. This problem
    has been there since 3.5.0 was out.


src/protocol/pool_proto_modules.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/protocol/pool_proto_modules.c b/src/protocol/pool_proto_modules.c index 638225073..cde397be1 100644 --- a/src/protocol/pool_proto_modules.c +++ b/src/protocol/pool_proto_modules.c @@ -1521,6 +1521,14 @@ POOL_STATUS Close(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend, * Remeber that we send flush or sync message to backend. */ pool_unset_pending_response(); + + /* + * Remove send message + */ + ereport(DEBUG1, + (errmsg("Close: removing sent message %c %s", *contents, contents+1))); + + pool_remove_sent_message(*contents == 'S'?'P':'B', contents+1); } return POOL_CONTINUE; [parent: e3fc50a13818]