pgpool2.git / summary / log / commit / refs
commit eb6c5b179adf6804199e3c2aaac5cf0cc698bce8
Author: Tatsuo Ishii <ishii@sraoss.co.jp>
Date: Sat Feb 09 11:34:40 2019 +0000
Avoid error or notice message analysis if it's not necessary.
After sending query to backend, Pgpool-II always calls
pool_extract_error_message() via per_node_error_log(). In the function
memory allocation is performed even if error or notice message is
returned from backend. To avoid the waste of CPU cycle, check message
kind and avoid calling pool_extract_error_message() if it's not error
or notice message.
Discussion: [pgpool-hackers: 3230] https://www.pgpool.net/pipermail/pgpool-hackers/2019-February/003230.html
src/protocol/pool_proto_modules.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/protocol/pool_proto_modules.c b/src/protocol/pool_proto_modules.c
index b146da90d..0f0964515 100644
--- a/src/protocol/pool_proto_modules.c
+++ b/src/protocol/pool_proto_modules.c
@@ -3319,6 +3319,15 @@ per_node_error_log(POOL_CONNECTION_POOL * backend, int node_id, char *query, cha
{
POOL_CONNECTION_POOL_SLOT *slot = backend->slots[node_id];
char *message;
+ char kind;
+
+ pool_read(CONNECTION(backend, node_id), &kind, sizeof(kind));
+ pool_unread(CONNECTION(backend, node_id), &kind, sizeof(kind));
+
+ if (kind != 'E' && kind != 'N')
+ {
+ return;
+ }
if (pool_extract_error_message(true, CONNECTION(backend, node_id), MAJOR(backend), true, &message) == 1)
{
[parent: 5f259f3b5e1b]