pgpool2.git / summary / log / commit / refs
commit eee4c86c03546abe4e33396c808c8425c23a443c
Author: Takuma Hoshiai <hoshiai@sraoss.co.jp>
Date: Tue Apr 28 08:50:19 2020 +0000
Improve process status of extend query
Previously, pgpool status is incorrect with extend query.
For example, when query is executing, but process status
is idle. This fix can display process status correctly.
If 'Execute' message is received, pgpool display process
status the same as Simple query.
For example:
user databse SELECT
In addition, fix log_statement bug. Previously, statement
using extend query is not logged by log_statement parameter.
It was improved in this commit.
Other, log_per_node_statement can log query with BIND message.
src/context/pool_query_context.c | 4 +++-
src/protocol/pool_proto_modules.c | 8 +++++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/context/pool_query_context.c b/src/context/pool_query_context.c
index a75ea7443..b66a5e17a 100644
--- a/src/context/pool_query_context.c
+++ b/src/context/pool_query_context.c
@@ -977,7 +977,7 @@ pool_extended_send_and_wait(POOL_QUERY_CONTEXT * query_context,
char msgbuf[QUERY_STRING_BUFFER_LEN];
char *stmt;
- if (*kind == 'P' || *kind == 'E')
+ if (*kind == 'P' || *kind == 'E' || *kind == 'B')
{
if (query_context->rewritten_query)
{
@@ -1000,6 +1000,8 @@ pool_extended_send_and_wait(POOL_QUERY_CONTEXT * query_context,
if (*kind == 'P')
snprintf(msgbuf, sizeof(msgbuf), "Parse: %s", stmt);
+ else if (*kind == 'B')
+ snprintf(msgbuf, sizeof(msgbuf), "Bind: %s", stmt);
else
snprintf(msgbuf, sizeof(msgbuf), "Execute: %s", stmt);
}
diff --git a/src/protocol/pool_proto_modules.c b/src/protocol/pool_proto_modules.c
index fb8941e71..7bfbde46e 100644
--- a/src/protocol/pool_proto_modules.c
+++ b/src/protocol/pool_proto_modules.c
@@ -792,6 +792,10 @@ Execute(POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * backend,
pool_is_writing_transaction(),
TSTATE(backend, MASTER_SLAVE ? PRIMARY_NODE_ID : REAL_MASTER_NODE_ID))));
+ /* log query to log file if necessary */
+ if (pool_config->log_statement)
+ ereport(LOG, (errmsg("statement: %s", query)));
+
/*
* Fetch memory cache if possible
*/
@@ -889,7 +893,6 @@ Execute(POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * backend,
#ifdef DEBUG
extern bool stop_now;
#endif
- pool_ps_idle_display(backend);
pool_stats_count_up_num_cache_hits();
query_context->skip_cache_commit = true;
#ifdef DEBUG
@@ -908,6 +911,9 @@ Execute(POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * backend,
query_context->skip_cache_commit = false;
}
+ /* show ps status */
+ query_ps_status(query, backend);
+
session_context->query_context = query_context;
/*
[parent: a2a6005d8864]