pgpool2.git / summary / log / commit / refs
commit 14dbf727aa436e96e4300790a0ca1626b2bf615e
Author: Tatsuo Ishii <ishii at sraoss.co.jp>
Date: Tue Feb 24 02:20:40 2009 +0000
Prpare for receiving parameter status packets.
If postgresql.conf was changed and reloaded, PostgreSQL sends
parameter status packets asynchronously even those changed parameters
are not one of session_authorization etc., which is marked as
GUC_REPORT in guc.c(GUC_REPORT means parameter status packet is sent
if its value is changed).
After receiving those packets, they are discarded. I think this is
harmless since most of changes are not affected to the frontend
behavior.
pool_auth.c | 2 +-
pool_process_query.c | 38 +++++++++++++++++++++++++++++++++-----
2 files changed, 34 insertions(+), 6 deletions(-)
diff --git a/pool_auth.c b/pool_auth.c
index e4f2f6add..f77709efa 100644
--- a/pool_auth.c
+++ b/pool_auth.c
@@ -1036,7 +1036,7 @@ int *pool_read_message_length2(POOL_CONNECTION_POOL *cp)
if (length != length0)
{
- pool_error("pool_read_message_length2: message length (%d) in slot %d does not match with slot 0(%d)", length, i, length0);
+ pool_log("pool_read_message_length2: message length (%d) in slot %d does not match with slot 0(%d)", length, i, length0);
}
if (length < 0)
diff --git a/pool_process_query.c b/pool_process_query.c
index 75adf71d5..26e0273df 100644
--- a/pool_process_query.c
+++ b/pool_process_query.c
@@ -3434,11 +3434,39 @@ POOL_STATUS read_kind_from_backend(POOL_CONNECTION *frontend, POOL_CONNECTION_PO
if (VALID_BACKEND(i))
{
- if (pool_read(CONNECTION(backend, i), &kind, 1) < 0)
+ do
{
- pool_error("pool_process_query: failed to read kind from %d th backend", i);
- return POOL_ERROR;
- }
+ char *p, *value;
+ int len;
+
+ if (pool_read(CONNECTION(backend, i), &kind, 1) < 0)
+ {
+ pool_error("read_kind_from_backend: failed to read kind from %d th backend", i);
+ return POOL_ERROR;
+ }
+
+ /*
+ * Read and discard parameter status
+ */
+ if (kind != 'S')
+ {
+ break;
+ }
+
+ if (pool_read(CONNECTION(backend, i), &len, sizeof(len)) < 0)
+ {
+ pool_error("read_kind_from_backend: failed to read parameter status packet length from %d th backend", i);
+ return POOL_ERROR;
+ }
+ len = htonl(len) - 4;
+ p = pool_read2(CONNECTION(backend, i), len);
+ if (p == NULL)
+ {
+ pool_error("read_kind_from_backend: failed to read parameter status packet from %d th backend", i);
+ }
+ value = p + strlen(p) + 1;
+ pool_log("read_kind_from_backend: parameter name: %s value: %s", p, value);
+ } while (kind == 'S');
kind_list[i] = kind;
@@ -3502,7 +3530,7 @@ POOL_STATUS read_kind_from_backend(POOL_CONNECTION *frontend, POOL_CONNECTION_PO
if (kind_list[i] != 0 && trust_kind != kind_list[i])
{
/* degenerate */
- pool_error("pool_process_query: %d th kind %c does not match with master or majority connection kind %c",
+ pool_error("read_kind_from_backend: %d th kind %c does not match with master or majority connection kind %c",
i, kind_list[i], trust_kind);
degenerate_node[degenerate_node_num++] = i;
}
[parent: cf1e530fda24]