Enhance error message while processing parse message.
authorTatsuo Ishii <ishii@sraoss.co.jp>
Sat, 12 Mar 2022 04:33:42 +0000 (13:33 +0900)
committerTatsuo Ishii <ishii@sraoss.co.jp>
Sat, 12 Mar 2022 04:40:24 +0000 (13:40 +0900)
In non-streaming replication mode, a sync message is sent to backend
after a parse message is sent to backend, expecting to get a ready for
query message.  If different message is returned, pgpool will complain
that. This commit adds more information: the message kind returned and
the backend node id.

src/protocol/pool_proto_modules.c

index 44744acbeefd8d0ba7f64d784adf8d7e586f3d67..3c5f679bec2be3d3644d6a1c1dcdffbbd84121d2 100644 (file)
@@ -1198,10 +1198,9 @@ POOL_STATUS Parse(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend,
 
                        kind = pool_read_kind(backend);
                        if (kind != 'Z')
-                ereport(ERROR,
-                    (errmsg("unable to parse the query"),
-                         errdetail("invalid read kind")));
-
+                               ereport(ERROR,
+                                               (errmsg("unable to parse the query"),
+                                                errdetail("invalid read kind \"%c\" returned from backend %d after Sync message sent", kind, i)));
                        /*
                         * SYNC message returns "Ready for Query" message.
                         */