[pgpool-hackers: 4275] Proposal: notice_per_node_statement

Tatsuo Ishii ishii at sraoss.co.jp
Wed Feb 1 10:42:23 JST 2023


I would like to add new "notice_per_node_statement" GUC variable to
4.5.  When this is enabled, clients receive NOTICE messages something
like below.

test=# BEGIN;
NOTICE:  DB node id: 0 statement: BEGIN;
NOTICE:  DB node id: 1 statement: BEGIN;
BEGIN
test=*# SELECT 1;
NOTICE:  DB node id: 1 statement: SELECT 1;
 ?column? 
----------
        1
(1 row)

test=*# INSERT INTO t1 VALUES(1);
NOTICE:  DB node id: 0 statement: INSERT INTO t1 VALUES(1);
INSERT 0 1
test=*# END;
NOTICE:  DB node id: 1 statement: END;
NOTICE:  DB node id: 0 statement: END;
COMMIT

This will allow users to know which backend the queries are sent on
their terminals.  However, this is not the all of the
objectives. Rather, my main objective is using this for regression
test. Currently we have lots of tests in the regression test to check
which backend receives a query. We do it in a hard way: enable
log_per_node_statement and grep log file. This is not only annoying
but makes us hard to add more test cases.

By adding this feature, we can do expected/results-compare-style tests
as PostgreSQL already does.

You may think we can achieve that by changing log_min_messages to LOG
too. Actually not. Because pgpool issues lots of internal queries which
makes it hard to create the expected files.

Attached is the PoC patch (it still lacks pgpool.conf sample updating,
show pool_status change and manual changes).

Comments and suggestions are welcome.

Best reagards,
--
Tatsuo Ishii
SRA OSS LLC
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp


More information about the pgpool-hackers mailing list