pgpool2.git
2 years agoJudge multi statement query using psqlscan.
Tatsuo Ishii [Sat, 25 Mar 2023 07:21:27 +0000 (16:21 +0900)]
Judge multi statement query using psqlscan.

Psqlscan is a module in the PostgreSQL source tree. It is essentially
subset of PostgreSQL SQL scanner but it is specialized for detecting
the end of each SQL statement. Therefore we can count the number of
SQL statements in a query string by using it.

Because psqlscan is not designed as an external library, it is hard to
call it from outside of PostgreSQL source tree. So I decided to import
psqlscan source code. This module consists of multiple files.  Program
sources are deployed in src/utils directory and header files are
deployed in src/include/utils directory.

psqlscan module was originally designed for frontend programs and uses
malloc directly. So I changed them so that it calls palloc and
friends. Additionally pgstrcasecmp.c and pqexpbuffer.c are also
imported. They are used by psqlscan.

The example usage of psqlscan can be found in
multi_statement_query():src/protocol/pool_proto_modules.c.

Discussion:
https://www.pgpool.net/pipermail/pgpool-hackers/2023-February/004291.html

2 years agoUse schema qualification for internal queries.
Tatsuo Ishii [Tue, 28 Mar 2023 01:55:59 +0000 (10:55 +0900)]
Use schema qualification for internal queries.

Some of objects such as function and cast did not use "pg_catalog."
schema qualification.  This does not lead to immediate security
concern but using the schema qualification is always good practice.

Not that for this I had to increase some buffer length:

- POOL_RELCACHE.query was changed from 1024 to 1500.
- query buffer size in pool_search_relcache was changed from 1024 to 1500.

Back patch to all supported branches: 4.4 to 4.0

2 years agoDoc: fix typo in the description of backend_application_name.
Tatsuo Ishii [Tue, 28 Mar 2023 00:49:08 +0000 (09:49 +0900)]
Doc: fix typo in the description of backend_application_name.

2 years agoFix compile error on systems using musl libc.
Tatsuo Ishii [Wed, 22 Mar 2023 11:53:38 +0000 (20:53 +0900)]
Fix compile error on systems using musl libc.

Patch provided by leimaohui.
https://www.pgpool.net/mantisbt/view.php?id=790

2 years agoDoc: mention that the target node to promote must be up and running.
Tatsuo Ishii [Wed, 22 Mar 2023 05:15:20 +0000 (14:15 +0900)]
Doc: mention that the target node to promote must be up and running.

Back patch to 4.3 in which the -n option of pcp_promote_node was
introduced.

2 years agoAdd notice_per_node_statement to "show pool_status".
Tatsuo Ishii [Fri, 10 Mar 2023 04:23:59 +0000 (13:23 +0900)]
Add notice_per_node_statement to "show pool_status".

This was missed in commit: 85ce852329c0e9775076234cd4a82c20fa173659

2 years agoTest: simplify 001.load_balance test.
Tatsuo Ishii [Sat, 25 Feb 2023 01:31:55 +0000 (10:31 +0900)]
Test: simplify 001.load_balance test.

Previously we checked the version of psql, so that we could adapt the
change in psql: i.e. SHOW_ALL_RESULTS addition.
By doing:
\set SHOW_ALL_RESULTS off
in 7.sql, the test results are now identical PostgreSQL 15 and before.
As a result, expected*-pre15 files were removed.

2 years agoAllow to run certain multi-statement queries.
Tatsuo Ishii [Thu, 23 Feb 2023 10:35:08 +0000 (19:35 +0900)]
Allow to run certain multi-statement queries.

Previously multi-statement queries including INSERT/UPDATE was not
recognized as a multi-statement because of optimization for lengthy
INSERT/UPDATE queries in streaming replication mode. This commit
temporarily turns off the optimization and adds regression test for
that.

Hopefully before releasing 4.5 we find a way to determine whether the
query is a multi-statement query or not in less expensive way. And if
it is not a multi-statement query, we can turn on the optimization.

Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2023-February/004291.html

2 years agoDoc: mention that AES256 support requires --with-openssl option.
Tatsuo Ishii [Wed, 22 Feb 2023 01:20:15 +0000 (10:20 +0900)]
Doc: mention that AES256 support requires --with-openssl option.

2 years agoDoc: add index for "AES256".
Tatsuo Ishii [Tue, 21 Feb 2023 08:25:20 +0000 (17:25 +0900)]
Doc: add index for "AES256".

Also fix previous commit for adding index ".pcppass" and "PCPPASSFILE".

2 years agoDoc: explicitly stat that it is -w option of pcp command is needed to use .pcppass.
Tatsuo Ishii [Tue, 21 Feb 2023 05:49:02 +0000 (14:49 +0900)]
Doc: explicitly stat that it is -w option of pcp command is needed to use .pcppass.

Also add .pcppass and PCPPASSFILE to index.

Backpatch-through: master and 4.4 to 4.0.

2 years agoFix that show pool_version shows row description twice.
Tatsuo Ishii [Sat, 18 Feb 2023 07:34:14 +0000 (16:34 +0900)]
Fix that show pool_version shows row description twice.

test=# show pool_version;
 pool_version
--------------
(0 rows)

     pool_version
-----------------------
 4.3.5 (tamahomeboshi)
(1 row)

2 years agoTest: fix 001.loadbalance test failure.
Tatsuo Ishii [Fri, 17 Feb 2023 08:06:20 +0000 (17:06 +0900)]
Test: fix 001.loadbalance test failure.

Since this commit:
https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commit;h=f8c3d7b49a1c6496eca2203e95248b86c204bbfa

001.loadbalance test fails on pre PostgreSQL 15, because of the change
in psql.  PostgreSQL 15's psql now prints the whole query results in a
multi-statement query.  Consider following example:

SELECT \BEGIN\;SELECT 1;ROLLBACK;

In 15, the result of SELECT will be printed by psql, while pre-15 will
not.  This causes some test results not to match with expected
results.  To fix this, I added expected7-r-pre15 etc. for pre-15.
test.sh now recognizes "-pre15" suffix. If the server version is
pre-15 and an expected file with suffix "pre-15" exists, the file will
be used.

2 years agoDoc: fix "2.8 Creating insert lock table" section.
Tatsuo Ishii [Wed, 15 Feb 2023 11:13:03 +0000 (20:13 +0900)]
Doc: fix "2.8 Creating insert lock table" section.

It only refereed to the native replication where it should have refereed
to the snapshot isolation mode.  Also enhance some xreflabels for
clustering mode.

2 years agoTest: enhance regression 001.load_balance.
Tatsuo Ishii [Sun, 12 Feb 2023 11:08:08 +0000 (20:08 +0900)]
Test: enhance regression 001.load_balance.

2 years agoAllow to use multiple statements extensively.
Tatsuo Ishii [Sun, 12 Feb 2023 10:59:00 +0000 (19:59 +0900)]
Allow to use multiple statements extensively.

This commit tries to eliminate pgpool's long standing limitations
regarding multiple statements (multi-statements).

Previously

BEGIN;SELECT;
SAVEPOINT foo;

will fail in streaming replication mode because "BEGIN" was sent to
the primar node, but "SAVEPOINT" will be sent to both the primary and
standbys, and standbys will complain "SAVEPOINT can only be used in
transaction blocks".

Basic idea to solve the problem is, tracking explicit transactions
started by multi-statement queries so that all commands including
PREPARE, EXECUTE, DEALLOCATE, SAVEPOINT and COMMIT/ROLLBACK are sent
to the primary node in streaming replication mode or logical
replication mode.  In native replication or snapshot isolation mode,
those queries are sent to all of the backend nodes.

For this purpose new member: is_tx_started_by_multi_statement is added
to session context and also support functions are added.

extern bool is_tx_started_by_multi_statement_query(void);
extern void set_tx_started_by_multi_statement_query(void);
extern void unset_tx_started_by_multi_statement_query(void);

Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2023-February/004287.html
Back-patch-through: 4.2 as backport to 4.1 and before looks difficult

2 years agoTest: simplify 001.load_balance.
Tatsuo Ishii [Tue, 7 Feb 2023 10:39:37 +0000 (19:39 +0900)]
Test: simplify 001.load_balance.

Commit 85ce8523 allows to use expected/result style tests.  This
commit applies it to 001.load_balance.  The expected files are under
"expected" directory. Suffix "-s" is for streaming replication mode
and "-r" is for native replication and snapshot isolation mode.

2 years agoAdd notice_per_node_statement.
Tatsuo Ishii [Tue, 7 Feb 2023 08:25:17 +0000 (17:25 +0900)]
Add notice_per_node_statement.

The new GUC variable allows to emit NOTICE message of queries per
backend basis.  It's similar to log_per_node_statement but as the log
level is NOTICE, the log is printed on client's terminal, thus users
can know where their queries go to without looking into pgpool log
files.

Also this is useful to create expected/results style test cases.

Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2023-February/004276.html

2 years agoFix multiple query cache bug.
Tatsuo Ishii [Sun, 5 Feb 2023 09:56:05 +0000 (18:56 +0900)]
Fix multiple query cache bug.

1) pool_add_item_shmem_cache() calls pool_init_cache_block() when
   there's no free cache item hash table entry. But this is
   unnecessary since pool_reuse_block() is already called from
   pool_add_item_shmem_cache(). This is actually harmless because the
   second pool_init_cache_block() call just set the same data as the
   first call of pool_init_cache_block(). It's just a waste of CPU
   cycle.

2) The cache blocks are supposed to be initialized while Pgpool-II
   starts up but actually not. Each cache block has the free space
   length in the block header after initialization. Since the free
   space length is not set, pool_get_block() fails to find a cache
   block which has enough free space, and it calls pool_reuse_block(),
   which is actually unnecessary (you will see something like
   "pool_reuse_block: blockid: 0" in pgpool log). Since
   pool_reuse_block() returns a free block anyway, this is just a
   waste of CPU cycle but better to fix.

Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2023-January/004259.html
Backpatch-through: 4.0

2 years agoFix sr worker to not send wrong query to standby server in corner case.
Tatsuo Ishii [Sun, 5 Feb 2023 07:13:15 +0000 (16:13 +0900)]
Fix sr worker to not send wrong query to standby server in corner case.

When ALWAYS_PRIMARY flag is set, PRIMARY_NODE_ID macro returns node
id, rather than -1 even if the primary is down. This confuses the test
if a node is primary or not, because PRIMARY_NODE_ID macro returns
main node id.  In this case streaming replication delay check worker
sends "SELECT pg_current_wal_lsn()" or "SELECT
pg_current_xlog_location()" depending on PostgreSQL's version to
standby which of course raises an error.

To fix this, test the primary node is down or not, and if it's down,
skip the replication delay loop. If primary is down, there's no point
to perform streaming replication delay checking anyway.

Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2023-February/004279.html
Backpatch-through: 4.0

2 years agoFix comment mistakes.
Tatsuo Ishii [Thu, 2 Feb 2023 10:34:00 +0000 (19:34 +0900)]
Fix comment mistakes.

2 years agoFix comment mistakes.
Tatsuo Ishii [Thu, 2 Feb 2023 05:29:33 +0000 (14:29 +0900)]
Fix comment mistakes.

2 years agoDoc: enhance show pool_cache manual.
Tatsuo Ishii [Wed, 1 Feb 2023 13:39:41 +0000 (22:39 +0900)]
Doc: enhance show pool_cache manual.

Add a table to explain each items shown by show pool_cache.

2 years agoRemove unnecessary macro.
Tatsuo Ishii [Tue, 31 Jan 2023 11:36:29 +0000 (20:36 +0900)]
Remove unnecessary macro.

The macro "DUAL_MODE" is no longer used anywhere.
Moreover, if it is used, it causes a compile error.

2 years agoFix kind mimatch error with DEALLOCATE
Tatsuo Ishii [Tue, 31 Jan 2023 09:49:48 +0000 (18:49 +0900)]
Fix kind mimatch error with DEALLOCATE

When conditions below are all met:
- streaming replication mode
- load balance node is other than primary
- PREPARE is used in a multi-statement query

Kind mimatch error occurs.

For DEALLOCATE pool_where_to_send() sets the nodes to be sent to all
backend if pgpool failed to find a prepared statement previously
received. For example with "SELECT 1\;PREPARE foo;", pgpool ignores
"PREPARE" part and just sends the whole multi-statement query to
primary. So primary actually has the prepared statement "foo" but
pgpool thinks that there's no prepared statement named "foo". And
pgpool sends DEALLOCATE to both primary and standby, then a kind
mismatch error raised. Fix is, just sending DEALLOCATE to primary node
in this case if pgpool is in streaming replication mode.  Same thing
can be said to EXECUTE too. I fixed this and merge similar treatment
with EXECUTE into where_to_send_deallocate() to make the code simpler.

I also found another bug: in replication mode or SI mode, pgpool needs
to send multi-statement query to all backend because the
multi-statement query maybe a write query. However pgpool sends to
main node only in this case.

Test cases are added to 071..execute_and_deallocate.

Backpatch-through: 4.0

Problem reported in:
https://www.pgpool.net/mantisbt/view.php?id=780

2 years agoObtain stronger lock while commiting shared relcache.
Tatsuo Ishii [Mon, 30 Jan 2023 02:02:22 +0000 (11:02 +0900)]
Obtain stronger lock while commiting shared relcache.

Previously pool_search_relcache() obtained only shared lock, which is
not safe enough to call pool_catalog_commit_cache() because it
registers new cache entry. Unfortunately our locking system does not
allow to escalate a shared lock to an exclusive lock. So we release
the shared lock then acquire the exclusive lock before calling
pool_catalog_commit_cache(). There's a window between them and we may
end up with an effort to register duplicate cache entry. But
underlying infrastructure of the query system will reject it and
should be safe.

Back-patch through 4.4 where the shared locking of the query cache
system was introduced.

2 years agoTest: refactor 071.execute_and_deallocate/test.sh.
Tatsuo Ishii [Sat, 28 Jan 2023 03:17:23 +0000 (12:17 +0900)]
Test: refactor 071.execute_and_deallocate/test.sh.

Previously the test was performed on only streaming replication mode.
Now the test covers native replication mode, snapshot isolation mode
and raw mode. Note that since case 6 test tries to test load balancing
on node 1, the case is not applied to raw mode.

2 years agoTest: fix indentation for further refactoring.
Tatsuo Ishii [Sat, 28 Jan 2023 02:37:18 +0000 (11:37 +0900)]
Test: fix indentation for further refactoring.

2 years agoDoc: fix typo in the description of read_only_function_list.
Tatsuo Ishii [Wed, 25 Jan 2023 05:45:34 +0000 (14:45 +0900)]
Doc: fix typo in the description of read_only_function_list.

2 years agoFix compile error of regression test
Takuma Hoshiai [Tue, 24 Jan 2023 15:48:33 +0000 (00:48 +0900)]
Fix compile error of regression test

The error occurred by timestamp test using gcc10.

2 years agoDoc: update copy right.
Bo Peng [Sat, 21 Jan 2023 15:00:17 +0000 (00:00 +0900)]
Doc: update copy right.

2 years agoDoc: Add release notes.
Bo Peng [Sat, 21 Jan 2023 15:00:04 +0000 (00:00 +0900)]
Doc: Add release notes.

2 years agoChange the default value for wd_lifecheck_password to empty string as documented.
Bo Peng [Sat, 21 Jan 2023 14:54:35 +0000 (23:54 +0900)]
Change the default value for wd_lifecheck_password to empty string as documented.

2 years agoDo not expose wd_lifecheck_password in show pool_status command.
Bo Peng [Sat, 21 Jan 2023 14:54:24 +0000 (23:54 +0900)]
Do not expose wd_lifecheck_password in show pool_status command.

2 years agoAdd pgpool_adm--1.5.sql and pgpool_adm--1.4--1.5.sql.
Bo Peng [Mon, 16 Jan 2023 13:43:41 +0000 (22:43 +0900)]
Add pgpool_adm--1.5.sql and pgpool_adm--1.4--1.5.sql.

2 years agoAdd patch files to EXTRA_DIST.
Bo Peng [Mon, 16 Jan 2023 13:42:45 +0000 (22:42 +0900)]
Add patch files to EXTRA_DIST.

2 years agoFix pgpool_adm: pcp_pool_status.
Tatsuo Ishii [Mon, 16 Jan 2023 09:45:59 +0000 (18:45 +0900)]
Fix pgpool_adm: pcp_pool_status.

If the function is used with PostgreSQL 15, it fails with:

ERROR:  table-function protocol for value-per-call mode was not followed

pcp_pool_status actually returns set of record but it was declared as
"returns record".  This sloppiness had been tolerated until 14 but 15
becomes more strict. To fix this we need to change the return type of
pcp_pool_status from "returns record" to "returns setof record".
So the pgpool_adm extension version is bumped up.

2 years agoRemove pgpool-II-head.patch from SPEC file.
Bo Peng [Mon, 16 Jan 2023 08:27:50 +0000 (17:27 +0900)]
Remove pgpool-II-head.patch from SPEC file.

2 years agoTest: tweak 028.watchdog_enable_consensus_with_half_votes.
Tatsuo Ishii [Sat, 14 Jan 2023 11:10:06 +0000 (20:10 +0900)]
Test: tweak 028.watchdog_enable_consensus_with_half_votes.

Sometimes buildfarm fails by:

bind on socket failed with error "Address already in use".

This happens after shutting down all pgpools then start them again. So
wait for 5 seconds between them instead of 1 second.  Let's see if
things are going to get better.

2 years agoFix integer overflow in streaming replication check.
Tatsuo Ishii [Fri, 13 Jan 2023 00:21:59 +0000 (09:21 +0900)]
Fix integer overflow in streaming replication check.

When delay_threshold_by_time is enabled, following query is
periodically sent to the primary node to obtain the replication delay
in micro seconds.

SELECT application_name, state, sync_state,(EXTRACT(EPOCH FROM
replay_lag)*1000000)::integer FROM pg_stat_replication";

Unfortunately the result from EXTRACT::integer overflows if replay_lag
is bigger than 2147483647/1000000 (that is about 35 minutes and 47
seconds). Fix is, changing "integer" to "bigint". By this, the result
will not overflow unless it becomes bigger than 292,472 years.
Discussion: https://www.pgpool.net/pipermail/pgpool-general/2023-January/008600.html
Backpatch-through: 4.4

2 years agoFix Uninitialized variables pointed out by Coverity
Takuma Hoshiai [Mon, 9 Jan 2023 18:05:48 +0000 (03:05 +0900)]
Fix Uninitialized variables pointed out by Coverity

Fix Uninitialized variables pointed out by Coverity.

2 years agoFix comment.
Tatsuo Ishii [Sat, 7 Jan 2023 04:27:34 +0000 (13:27 +0900)]
Fix comment.

sizeof(POOL_CACHE_ITEM_HEADER) is 16 bytes, not 24 bytes.

2 years agoDoc: enhance "Configurations to use shared memory" chapter.
Tatsuo Ishii [Fri, 6 Jan 2023 01:37:21 +0000 (10:37 +0900)]
Doc: enhance "Configurations to use shared memory" chapter.

Enhance the description to try to explain what the parameters actually
mean. Also fix wrong number, i.e. the size of data management area is
64 bytes, not 48 bytes.

2 years agoAdd comment to query cache module header file.
Tatsuo Ishii [Thu, 5 Jan 2023 07:50:43 +0000 (16:50 +0900)]
Add comment to query cache module header file.

Some struct size added to explain required shared memory size.

2 years agoDoc: enhance explanation of delay_threshold_by_time.
Tatsuo Ishii [Tue, 3 Jan 2023 09:05:03 +0000 (18:05 +0900)]
Doc: enhance explanation of delay_threshold_by_time.

Explicitly mention that in order to show delay_threshold_by_time,
backend_application_name is correctly set and match the
application_name in primary_conninfo.

Suggestion by zam bak.
Discussion: https://www.pgpool.net/pipermail/pgpool-general/2022-December/008584.html

2 years agoFix compiler warning.
Tatsuo Ishii [Sat, 24 Dec 2022 03:41:01 +0000 (12:41 +0900)]
Fix compiler warning.

pgpool-regclass.c needed to include "utils/varlena.h".  Also sort out
the header files order (except postgres.h which needs to be appear at
the top among PostgreSQL header files).

The compiler warning was reported by Florian Weimer.
https://www.pgpool.net/pipermail/pgpool-hackers/2022-December/004241.html

2 years agoDoc: update repo package version.
Bo Peng [Thu, 22 Dec 2022 06:37:25 +0000 (15:37 +0900)]
Doc: update repo package version.

2 years agoDoc: add release note.
Bo Peng [Thu, 22 Dec 2022 06:11:16 +0000 (15:11 +0900)]
Doc: add release note.

2 years agoFix time stamp rewrite bug.
Tatsuo Ishii [Tue, 20 Dec 2022 10:06:22 +0000 (19:06 +0900)]
Fix time stamp rewrite bug.

In native replication/snapshot isolation mode, any write query
including timestamp/date/time data are rewritten so that all
PostgreSQL servers accept same timestamp etc. value. From 4.4 outfuncs
module which is used to generate rewritten query was broken for
boolean data. In a parse tree constant data is represented as
"A_Const". 4.4 updated the module by using PostgreSQL 15's outfuncs
module. Starting from PostgreSQL 15 A_Const handles more data type
including boolean. Unfortunately the pgpool's outfuncs module did not
adopt the change. As a result boolean constant was ignored and turned
into empty string in the rewritten query string, which caused syntax
errors.

This commit fixes the issue. Also modify _outA_Const() so that it uses
_out* functions to handle other data types to save a few lines of
code.

Per report from Michiel van Leening.
Discussion: at: https://www.pgpool.net/pipermail/pgpool-general/2022-December/008581.html
Back-patch to: 4.4.

2 years agoFix for :[pgpool-hackers: 4227] Issue with failover_require_consensus
Muhammad Usama [Mon, 19 Dec 2022 19:39:32 +0000 (00:39 +0500)]
Fix for :[pgpool-hackers: 4227] Issue with failover_require_consensus

The fix is to dynamically set the failover command timeout based on the maximum
value of health check parameters across the watchdog cluster.

Reviewed and tested by Tatsuo Ishii

2 years agoDoc: enhance the performance section.
Tatsuo Ishii [Mon, 19 Dec 2022 07:04:39 +0000 (16:04 +0900)]
Doc: enhance the performance section.

Mention about dynamic process management.

2 years agoDoc: fix Japanese documentation to sync with English docs.
Tatsuo Ishii [Mon, 19 Dec 2022 04:50:33 +0000 (13:50 +0900)]
Doc: fix Japanese documentation to sync with English docs.

2 years agoAllow to define PGPOOLDIR uing environment variable.
Bo Peng [Sat, 17 Dec 2022 00:57:37 +0000 (09:57 +0900)]
Allow to define PGPOOLDIR uing environment variable.

per bug766.

2 years agoDowngrade streaming replication debugging message.
Tatsuo Ishii [Fri, 16 Dec 2022 09:49:02 +0000 (18:49 +0900)]
Downgrade streaming replication debugging message.

The log line "standby_delay: 54" was actually for debugging and should
have been down graded.  So I have downgraded to DEBUG1 from LOG. Also
tweaked the message to be saner.

2 years agoEnhance status file reading log.
Tatsuo Ishii [Thu, 15 Dec 2022 05:56:25 +0000 (14:56 +0900)]
Enhance status file reading log.

Previously only if pgpool_status exists and the status is down, a log
message was printed.  However it is more useful no matter what the
status (up or unused) is because it also represents that pgpool_status
exists and it is read while pgpool starting up, which is useful
information.

2 years agoDoc: fix typo in Aurora example.
Tatsuo Ishii [Wed, 14 Dec 2022 08:38:29 +0000 (17:38 +0900)]
Doc: fix typo in Aurora example.

2 years agoAdd more .gitignore files.
Tatsuo Ishii [Wed, 14 Dec 2022 01:23:08 +0000 (10:23 +0900)]
Add more .gitignore files.

src/include/config.h.in
some files under test/regression

2 years agoRemove more files under parser directory.
Tatsuo Ishii [Wed, 14 Dec 2022 00:23:17 +0000 (09:23 +0900)]
Remove more files under parser directory.

This is following commit caeb3a8681d7aa0f5b24539de12d29dd5a8d9997
"Remove Makefile.in etc. generated by autoconf."  Create .gitignore
under src/parser and add generated files by bison and flex.

2 years agoRemove Makefile.in etc. generated by autoconf.
Tatsuo Ishii [Tue, 13 Dec 2022 09:21:15 +0000 (18:21 +0900)]
Remove Makefile.in etc. generated by autoconf.

Also update some .ignore files and add some new .gitignore files.  Now
developers need to run autoconf/autoreconf before compiling since the
generated files are not provided by git anymore.

2 years agoDoc: enhance dynamic process management document.
Tatsuo Ishii [Mon, 12 Dec 2022 06:56:22 +0000 (15:56 +0900)]
Doc: enhance dynamic process management document.

2 years agoDowngrade "we have hit the ceiling" log.
Tatsuo Ishii [Mon, 12 Dec 2022 06:20:55 +0000 (15:20 +0900)]
Downgrade "we have hit the ceiling" log.

Under dynamic process management, when connection request exceeds
num_init_children, pgpool keeps on logging every 2 seconds "we have
hit the ceiling", which is flooding log file. So downgrade the log
level from LOG to DEBUG5.

2 years agoDoc: fix typo.
Tatsuo Ishii [Mon, 12 Dec 2022 05:48:06 +0000 (14:48 +0900)]
Doc: fix typo.

2 years agoFix typo in comments.
Tatsuo Ishii [Sat, 10 Dec 2022 06:23:30 +0000 (15:23 +0900)]
Fix typo in comments.

2 years agoUpdate version to 4.5devel.
Bo Peng [Tue, 6 Dec 2022 01:53:19 +0000 (10:53 +0900)]
Update version to 4.5devel.

2 years agoUpdate PGPOOLVERSION to "hotooriboshi".
Bo Peng [Tue, 6 Dec 2022 01:51:50 +0000 (10:51 +0900)]
Update PGPOOLVERSION to "hotooriboshi".

2 years agoUpdate SPEC file BuildRequires.
Bo Peng [Tue, 6 Dec 2022 01:34:06 +0000 (10:34 +0900)]
Update SPEC file BuildRequires.

2 years agoDoc: update release note.
Bo Peng [Mon, 5 Dec 2022 15:46:16 +0000 (00:46 +0900)]
Doc: update release note.

2 years agoDoc: fix doc typos.
Bo Peng [Mon, 5 Dec 2022 15:29:43 +0000 (00:29 +0900)]
Doc: fix doc typos.

Patch is created by Youichi Yabuki.

2 years agoFix typo in pgpool.spec.
Bo Peng [Sun, 4 Dec 2022 08:34:32 +0000 (17:34 +0900)]
Fix typo in pgpool.spec.

2 years agoDoc: update 4.4 release note.
Bo Peng [Sat, 3 Dec 2022 15:27:14 +0000 (00:27 +0900)]
Doc: update 4.4 release note.

2 years agoDowngrade LOG messages "new IPC connection received" to DEBUG1.
Bo Peng [Sat, 3 Dec 2022 13:31:15 +0000 (22:31 +0900)]
Downgrade LOG messages "new IPC connection received" to DEBUG1.

It is a normal messages and should not be logged as LOG.
Patch is created by pstef and reviewed by Bo Peng.

2 years agoDoc: update exapmles
Bo Peng [Tue, 29 Nov 2022 06:20:01 +0000 (15:20 +0900)]
Doc: update exapmles

2 years agoUpdate PostgreSQL version of sample scripts
Bo Peng [Tue, 29 Nov 2022 05:59:32 +0000 (14:59 +0900)]
Update PostgreSQL version of sample scripts

2 years agoUpdate pgpool.spec to generate /var/run/pgpool
Bo Peng [Tue, 29 Nov 2022 05:52:50 +0000 (14:52 +0900)]
Update pgpool.spec to generate /var/run/pgpool

2 years agoFix ROLLBACK TO command to work in aborted transaction.
Tatsuo Ishii [Fri, 25 Nov 2022 07:33:17 +0000 (16:33 +0900)]
Fix ROLLBACK TO command to work in aborted transaction.

Commit:

https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commit;h=eea522ebfcf791a623e865deaa1aa6fb59e3c50b

fixed some cases in aborted transaction so that SQL commands except
COMMIT/ROLLBACK are not forwarded to backend. But it missed ROLLBACK
TO command. As a result even if ROLLBACK TO command is issued, the
command was not forwarded to backend and the transaction keeps on in
aborted state.
Back patched through 4.3 which the commit was brought in.
Also add a test case for ROLLBACK TO to test 078.
Discussion:
https://www.pgpool.net/pipermail/pgpool-general-jp/2022-November/001715.html

2 years agoFix not to print warnings of use of backslashes in parser.
Tatsuo Ishii [Thu, 24 Nov 2022 06:31:48 +0000 (15:31 +0900)]
Fix not to print warnings of use of backslashes in parser.

When standard_conforming_strings = off and escape_string_warning = on,
PostgreSQL prints warnings if backslashes are used in string
literal. This is fine. But previously Pgpool-II's parser printed the
same message too. This is redundant.

2 years agoDoc: enhance restrictions section.
Tatsuo Ishii [Tue, 22 Nov 2022 11:39:21 +0000 (20:39 +0900)]
Doc: enhance restrictions section.

Mention that failover_on_backend_shutdown can be used to avoid
unwanted failover caused by pg_terminate_backend.

2 years agoDoc: update release note.
Bo Peng [Tue, 22 Nov 2022 07:37:05 +0000 (16:37 +0900)]
Doc: update release note.

2 years agoFix typo in sample configuration file.
Bo Peng [Mon, 21 Nov 2022 14:55:08 +0000 (23:55 +0900)]
Fix typo in sample configuration file.

2 years agoFix "show pool_status" command doesn't show the new parameters process_management_mod...
Bo Peng [Mon, 21 Nov 2022 10:59:01 +0000 (19:59 +0900)]
Fix "show pool_status" command doesn't show the new parameters process_management_mode and process_management_strategy.

2 years agoTest: update sample scripts directory.
Bo Peng [Sun, 13 Nov 2022 13:50:01 +0000 (22:50 +0900)]
Test: update sample scripts directory.

2 years agoDoc: update documentation.
Bo Peng [Sat, 12 Nov 2022 14:47:50 +0000 (23:47 +0900)]
Doc: update documentation.

2 years agoUpdate src/pgpool.spec to delete %tmpfiles_create.
Bo Peng [Sat, 12 Nov 2022 01:24:05 +0000 (10:24 +0900)]
Update src/pgpool.spec to delete %tmpfiles_create.

2 years agoEnable AM_MAINTAINER_MODE on master branch.
Bo Peng [Fri, 11 Nov 2022 14:27:42 +0000 (23:27 +0900)]
Enable AM_MAINTAINER_MODE on master branch.

2 years agoDisable AM_MAINTAINER_MODE.
Bo Peng [Fri, 11 Nov 2022 14:23:26 +0000 (23:23 +0900)]
Disable AM_MAINTAINER_MODE.

2 years agoDoc: update 4.4 release note.
Bo Peng [Fri, 11 Nov 2022 14:18:19 +0000 (23:18 +0900)]
Doc: update 4.4 release note.

2 years agoDoc: add Japanese documentation of process management.
Bo Peng [Fri, 11 Nov 2022 14:15:00 +0000 (23:15 +0900)]
Doc: add Japanese documentation of process management.

2 years ago[New-Feature] Dynamic spare process management
Muhammad Usama [Wed, 9 Nov 2022 07:43:25 +0000 (12:43 +0500)]
[New-Feature] Dynamic spare process management

This feature allows selecting between static and dynamic process management modes.
Static process management is the same as the existing behavior of Pgpool-II, where it
spawns all child processes at startup. The new Dynamic mode keeps track of idle
processes and forks or kills processes to keep this number within
the specified boundaries.

Four new settings, process_management_mode,  process_management_strategy,
min_spare_children, and max_spare_children are added to configure the process
management behavior, while  process_management_strategy allows selecting
between three possible scaling-down strategies.

The first version of the patch was shared by "zhoujianshen at highgo.com" and reworked by me
Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2022-September/004189.html
Reviewed by: Bo Peng and Tatsuo Ishii

2 years agoUpdate Makefile and configure files to remove doc.zh-cn which is deleted in previous...
Bo Peng [Mon, 7 Nov 2022 06:15:31 +0000 (15:15 +0900)]
Update Makefile and configure files to remove doc.zh-cn which is deleted in previous commit fc2beb28d29667064d0c6156b9db320e1ec415fc

2 years agoRemove out-of-date doc.zh-cn directory.
Bo Peng [Mon, 7 Nov 2022 05:27:01 +0000 (14:27 +0900)]
Remove out-of-date doc.zh-cn directory.
doc.zh-cn is not actually translated, it's just a copy of doc.

2 years agoImprove follow_primary.sh.sample script:
Bo Peng [Mon, 7 Nov 2022 04:49:06 +0000 (13:49 +0900)]
Improve follow_primary.sh.sample script:
- run checkpoint command on primary to update control file before running pg_rewind
- check if a directory exists before removing it

2 years agoTest: update src/test/pgpool_setup.in
Bo Peng [Sun, 6 Nov 2022 10:43:01 +0000 (19:43 +0900)]
Test: update src/test/pgpool_setup.in

2 years agoUpdate src/redhat/pgpool_socket_dir.patch
Bo Peng [Sun, 6 Nov 2022 07:40:27 +0000 (16:40 +0900)]
Update src/redhat/pgpool_socket_dir.patch

2 years agoUpdate comments in pgpool.conf.
Tatsuo Ishii [Sun, 6 Nov 2022 01:20:28 +0000 (10:20 +0900)]
Update comments in pgpool.conf.

Update comments for listen_addresses and pcp_listen_addresses.
This shoud have been done in commits:
https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commit;h=fd0efceae011c8d2c2f7c2b26dc0a738f055972e
https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commit;h=9f727c1e267f1363012a3af599b7d7515e4ec355

2 years agoUpdate src/pgpool.spec:
Bo Peng [Sat, 5 Nov 2022 03:42:11 +0000 (12:42 +0900)]
Update src/pgpool.spec:
- Change /lib/tmpfiles.d/ file from /var/run to /run
- Install /etc/sudoers.d/pgpool
- Add new scripts aws_eip_if_cmd.sh.sample and aws_rtb_if_cmd.sh.sample

2 years agoAdd trusted_server_command parameter
Takuma Hoshiai [Fri, 4 Nov 2022 02:07:09 +0000 (11:07 +0900)]
Add trusted_server_command parameter

This patch be able to specify a command that is used by trusted_servers
for checking up stream connection. Previously, ping command was only used,
and it was hard coded.

Default is 'ping -q -c3 %h' which means same as before.

2 years agoDoc: update Pgpool-II 4.4 release note.
Bo Peng [Thu, 27 Oct 2022 03:20:06 +0000 (12:20 +0900)]
Doc: update Pgpool-II 4.4 release note.

2 years agoDoc: Update documentation of AWS configuration example and add sample scripts used...
Bo Peng [Thu, 27 Oct 2022 03:03:01 +0000 (12:03 +0900)]
Doc: Update documentation of AWS configuration example and add sample scripts used for AWS.

2 years agoDeal with idle_session_timeout.
Tatsuo Ishii [Wed, 26 Oct 2022 23:45:17 +0000 (08:45 +0900)]
Deal with idle_session_timeout.

If idle_session_timeout (added in PostgreSQL 14) is enabled and the
timeout fires, followings happen:

- If failover_on_backend_error is on (the default), Pgpool-II will
  trigger failover.

- If only one of PostgreSQL servers enables idle_session_timeout,
  Pgpool-II could hang.

To deal with idle_session_timeout detect_idle_session_timeout_error()
is added to detect the error code for idle_session_timeout. If the
error is detected, Pgpool-II returns the error code to frondend as a
fatal error and disconnects the session.  This is a similar fix
implemented for idle_in_transaction_session_timeout.

https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commit;h=3f5986eee360f12e6a0bb77aa46f95abf5f6bc10

Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2022-October/004209.html
Back-path-through: 4.0

2 years agoDoc: enhance description about memqcache_method.
Tatsuo Ishii [Fri, 7 Oct 2022 02:26:28 +0000 (11:26 +0900)]
Doc: enhance description about memqcache_method.

Add explanation which method should be used.

Backpatch-through: 3.7.