pgpool2.git
3 years agoSuppress bison warnings regarding yacc incompatibility.
Tatsuo Ishii [Fri, 3 Dec 2021 05:40:23 +0000 (14:40 +0900)]
Suppress bison warnings regarding yacc incompatibility.

Run bison without yacc compatibility may raise some risks, so just suppress warnings.

3 years agoDoc: fix typos.
Bo Peng [Thu, 25 Nov 2021 06:19:45 +0000 (15:19 +0900)]
Doc: fix typos.

3 years agoAdd 4.3RC1 release notes.
Bo Peng [Wed, 24 Nov 2021 13:43:41 +0000 (22:43 +0900)]
Add 4.3RC1 release notes.

3 years agoFix mention about insert_lock in 4.3 release note.
Tatsuo Ishii [Tue, 23 Nov 2021 23:40:20 +0000 (08:40 +0900)]
Fix mention about insert_lock in 4.3 release note.

The compile default was changed twice while preparing 4.3.  First, on
to off, then finally off to on. To avoid the confusion, remove "on to
off" part.

3 years agoFix redundant code.
Tatsuo Ishii [Mon, 22 Nov 2021 07:31:39 +0000 (16:31 +0900)]
Fix redundant code.

Patch contributed by Lu Chenyang.

3 years agoAdd release notes for Pgpool-II 4.2.6, 4.3beta2.
Masaya Kawamoto [Thu, 18 Nov 2021 09:04:20 +0000 (09:04 +0000)]
Add release notes for Pgpool-II 4.2.6, 4.3beta2.

3 years agoReject extraneous data after SSL encryption handshake.
Tatsuo Ishii [Wed, 17 Nov 2021 10:26:11 +0000 (19:26 +0900)]
Reject extraneous data after SSL encryption handshake.

In the server side implementation of SSL negotiation
(pool_ssl_negotiate_serverclient()), it was possible for a
man-in-the-middle attacker to inject arbitrary SQL commands. This is
possible if Pgpool-II is configured to use cert authentication or
hostssl + trust. This resembles PostgreSQL's CVE-2021-23214.

Similarly, in the client side implementation of SSL negotiation
(pool_ssl_negotiate_clientserver()), it was possible for a
man-in-the-middle attacker to inject arbitrary responses. This is
possible if PostgreSQL is using trust authentication with a clientcert
requirement. It is not possible with cert authentication because
Pgpool-II does not implement the cert authentication between Pgpool-II

To fix these reject extraneous data in the read buffer after SSL
encryption handshake.
and PostgreSQL. This resembles PostgreSQL's CVE-2021-23222.

3 years agoDeal with PostgreSQL 14 while processing pg_terminate_backend().
Tatsuo Ishii [Tue, 16 Nov 2021 00:45:31 +0000 (09:45 +0900)]
Deal with PostgreSQL 14 while processing pg_terminate_backend().

Do not reject two arguments form of pg_terminate_backend() as
PostgreSQL 14 or after accept two arguments.

3 years agoFix occasional 073.pg_terminate_backend regression test failure.
Tatsuo Ishii [Tue, 16 Nov 2021 00:02:47 +0000 (09:02 +0900)]
Fix occasional 073.pg_terminate_backend regression test failure.

The test used "ps -ef" command to find the process which is running
SELECT command.  However in some cases the "ps -ef" command omits part
of "SELECT" in its output and this made the test fail.
So use "ps -efw" instead of "ps -ef" to prevent it.

3 years agoDoc: update 4.3 release note.
Tatsuo Ishii [Tue, 9 Nov 2021 01:27:36 +0000 (10:27 +0900)]
Doc: update 4.3 release note.

Suggestion from Muhammad Usama.

3 years agoDoc: add Japanese translation for commit a683288045332fdd8ea7cd7038510353cb3dbfc
Tatsuo Ishii [Mon, 8 Nov 2021 08:14:01 +0000 (17:14 +0900)]
Doc: add Japanese translation for commit a683288045332fdd8ea7cd7038510353cb3dbfc

3 years agoRename regression test 074.
Bo Peng [Mon, 8 Nov 2021 08:27:38 +0000 (17:27 +0900)]
Rename regression test 074.

3 years agoUpdate patch file.
Bo Peng [Mon, 8 Nov 2021 08:18:11 +0000 (17:18 +0900)]
Update patch file.

3 years agoDoc: Mention of risks with using the dynamic cluster membership.
Muhammad Usama [Mon, 8 Nov 2021 07:53:22 +0000 (12:53 +0500)]
Doc: Mention of risks with using the dynamic cluster membership.

3 years agoDoc: update docs.
Bo Peng [Mon, 8 Nov 2021 05:53:11 +0000 (14:53 +0900)]
Doc: update docs.

3 years agoUpdate version to Pgpool-II 4.4 devel.
Bo Peng [Mon, 8 Nov 2021 05:38:09 +0000 (14:38 +0900)]
Update version to Pgpool-II 4.4 devel.

3 years agoEnable AM_MAINTAINER_MODE on master branch.
Bo Peng [Mon, 8 Nov 2021 05:11:37 +0000 (14:11 +0900)]
Enable AM_MAINTAINER_MODE on master branch.

3 years agoDisable AM_MAINTAINER_MODE.
Bo Peng [Mon, 8 Nov 2021 05:09:15 +0000 (14:09 +0900)]
Disable AM_MAINTAINER_MODE.

3 years agoDoc: fix typo.
Tatsuo Ishii [Mon, 8 Nov 2021 02:58:17 +0000 (11:58 +0900)]
Doc: fix typo.

3 years agoDoc: translate into Japanese some of 4.3 release note.
Tatsuo Ishii [Mon, 8 Nov 2021 02:45:08 +0000 (11:45 +0900)]
Doc: translate into Japanese some of 4.3 release note.

3 years agoDoc: add mention about failover_on_backend_shutdown to the migration section in Japan...
Tatsuo Ishii [Mon, 8 Nov 2021 02:17:22 +0000 (11:17 +0900)]
Doc: add mention about failover_on_backend_shutdown to the migration section in Japanese doc.

Also translate into Japanese new documents added in:
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=4760459d45e33b573458e3973e192c43077f7eb1

3 years agoDoc: add new watchdog dynamic cluster definition.
Tatsuo Ishii [Mon, 8 Nov 2021 01:11:45 +0000 (10:11 +0900)]
Doc: add new watchdog dynamic cluster definition.

3 years agoDoc: remove unnecessary character from wd_remove_shutdown_nodes.
Tatsuo Ishii [Mon, 8 Nov 2021 00:01:20 +0000 (09:01 +0900)]
Doc: remove unnecessary character from wd_remove_shutdown_nodes.

3 years agoDoc: add 4.3 Japanese release note.
Bo Peng [Sun, 7 Nov 2021 16:49:00 +0000 (01:49 +0900)]
Doc: add 4.3 Japanese release note.

3 years agodoc: Documentation update for dynamic cluster membership feature
Muhammad Usama [Sun, 7 Nov 2021 11:21:14 +0000 (16:21 +0500)]
doc: Documentation update for dynamic cluster membership feature

3 years ago[New-Feature] Enable dynamic cluster membership of watchdog nodes
Muhammad Usama [Sun, 7 Nov 2021 11:00:43 +0000 (16:00 +0500)]
[New-Feature] Enable dynamic cluster membership of watchdog nodes

Enables dynamic watchdog cluster definition by introducing the concept of
Member and Nonmember watchdog nodes. If the node's membership gets revoked
from the watchdog cluster, then the cluster re-calibrate itself dynamically
to adjust all subsequent majority rule computations.

Three new settings wd_no_show_node_removal_timeout, wd_lost_node_removal_timeout
and wd_remove_shutdown_nodes are added to configure the membership
criteria of the watchdog nodes.

3 years agoDoc: add mention about failover_on_backend_shutdown to the migration section.
Tatsuo Ishii [Thu, 4 Nov 2021 12:14:38 +0000 (21:14 +0900)]
Doc: add mention about failover_on_backend_shutdown to the migration section.

3 years agoDoc: fix description on pgpool.conf.sample-*
Masaya Kawamoto [Thu, 4 Nov 2021 05:17:34 +0000 (05:17 +0000)]
Doc: fix description on pgpool.conf.sample-*

This is a follow up on commit:
https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commit;h=4ab1566ff133e449a4ddff7f1d7133b87d10152d

3 years agoDoc: mention that the default of failover_require_consensus has been changed to on.
Tatsuo Ishii [Tue, 2 Nov 2021 01:19:49 +0000 (10:19 +0900)]
Doc: mention that the default of failover_require_consensus has been changed to on.

3 years agoChange compile time default value of failover_require_consensus to on.
Tatsuo Ishii [Tue, 2 Nov 2021 01:13:32 +0000 (10:13 +0900)]
Change compile time default value of failover_require_consensus to on.

failover_require_consensus is already on in the docs and in
pgpool.conf.sample-stream. So sync with them.

3 years agoRemove sample config files from Makefile, because the files has been removed by the...
Bo Peng [Tue, 2 Nov 2021 00:54:17 +0000 (09:54 +0900)]
Remove sample config files from Makefile, because the files has been removed by the previous commit.

3 years agoDoc: mention that snapshot isolation mode is now ready for production in the 4.3...
Tatsuo Ishii [Mon, 1 Nov 2021 01:48:53 +0000 (10:48 +0900)]
Doc: mention that snapshot isolation mode is now ready for production in the 4.3 release note.

3 years agoDoc: remove descriptions on pgpool.conf.sample-*
Tatsuo Ishii [Mon, 1 Nov 2021 01:31:30 +0000 (10:31 +0900)]
Doc: remove descriptions on pgpool.conf.sample-*

This is a follow up on commit:
https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commit;h=4ab1566ff133e449a4ddff7f1d7133b87d10152d

3 years agoDoc: initial cut of Pgpool-II 4.3 release note.
Tatsuo Ishii [Sat, 30 Oct 2021 12:30:15 +0000 (21:30 +0900)]
Doc: initial cut of Pgpool-II 4.3 release note.

Still some ongoing items are missing.

3 years agoUnify all pgpool.conf.sample files into single pgpool.conf.sample.
Tatsuo Ishii [Sat, 30 Oct 2021 04:30:35 +0000 (13:30 +0900)]
Unify all pgpool.conf.sample files into single pgpool.conf.sample.

Now that all configuration parameters in pgpool.conf are commented out,
there's no point to have separate configuration sample files. Just
specify the backend_clustering_mode parameter is enough. pgpool_setup
is modified to adopt the change.

Update to documents will be followed.

3 years agoFix application_name array lacking an entry for logger process.
Tatsuo Ishii [Mon, 25 Oct 2021 00:40:36 +0000 (09:40 +0900)]
Fix application_name array lacking an entry for logger process.

Add logger process entry to the process name array. This was missed
since the logger process was added.
Per coverity.

3 years agoEnhance SIGHLD handler of Pgpool-II main process.
Tatsuo Ishii [Sun, 24 Oct 2021 07:22:33 +0000 (16:22 +0900)]
Enhance SIGHLD handler of Pgpool-II main process.

When Pgpool-II child is killed by SIGKILL signal, the SIGHLD handler
just emitted LOG level message as other signals.  But SIGKILL is an
important event, for example killed by OOM killer. So emit a WARNING
level message instead.

Per suggestion from Michail Alexakis.
Discussion: https://www.pgpool.net/pipermail/pgpool-general/2021-October/007808.html

3 years agoFix connection counter issue when reserved_connections is 0.
Tatsuo Ishii [Sun, 24 Oct 2021 02:30:25 +0000 (11:30 +0900)]
Fix connection counter issue when reserved_connections is 0.

If reserved_connections is 0, we don't need to manage the connection
counter to check if the count is larger than
(pool_config->num_init_children - pool_config->reserved_connections).
So remove the check.  This will prevent unwanted "Sorry, too many
clients already" error" by accidental counter leak.

For reserved_connections > 0 case, we need to fix the counter leak but
it's another story.

Discussion: https://www.pgpool.net/pipermail/pgpool-general/2021-October/007808.html

3 years agoFix missing comment out in sample pgpool.conf.
Tatsuo Ishii [Sun, 24 Oct 2021 01:54:30 +0000 (10:54 +0900)]
Fix missing comment out in sample pgpool.conf.

statement_level_load_balance and allow_clear_text_frontend_auth were
not commented out.

3 years agoDoc: update Japanese "Pgpool-II + Watchdog Setup Example" and sample scripts.
Masaya Kawamoto [Thu, 21 Oct 2021 05:51:11 +0000 (05:51 +0000)]
Doc: update Japanese "Pgpool-II + Watchdog Setup Example" and sample scripts.

Updating Japanese document and script to Pgpool-II 4.3 and
Postgresql 14. English document will updated later.
Pgpool-II 4.3 yum repository url is blank and sample script
link is set master branch because there are still not existed.
We will update those when Pgpool-II 4.3 release.

3 years agoCommenting out all parameters in pgpool.conf.
Tatsuo Ishii [Sun, 17 Oct 2021 13:40:15 +0000 (22:40 +0900)]
Commenting out all parameters in pgpool.conf.

This will make pgpool.conf less confusing and make PostgreSQL users
easier to understand pgpool.conf because this follows the PostgreSQL
way.

Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2021-October/004044.html

3 years agoChange compile time default value of insert_lock to on.
Tatsuo Ishii [Sun, 17 Oct 2021 13:36:32 +0000 (22:36 +0900)]
Change compile time default value of insert_lock to on.

insert_lock is already on in the in pgpool.conf.sample-replication and
pgpool.conf.sample-snapshot. So sync with them. Documentations are
changed as well.

3 years agoChange compile time default value of failover_when_quorum_exists to on.
Tatsuo Ishii [Thu, 14 Oct 2021 08:27:50 +0000 (17:27 +0900)]
Change compile time default value of failover_when_quorum_exists to on.

failover_when_quorum_exists is already on in the docs and in
pgpool.conf.sample-stream. So sync with them.

3 years agoChange compile time default value of load_balance_mode to on.
Tatsuo Ishii [Thu, 14 Oct 2021 07:11:39 +0000 (16:11 +0900)]
Change compile time default value of load_balance_mode to on.

load_balance_mode is already on in pgpool.conf.sample. So sync with it.

3 years agoDoc: fix documentation typos.
Masaya Kawamoto [Wed, 13 Oct 2021 04:12:58 +0000 (04:12 +0000)]
Doc: fix documentation typos.

3 years agoEnable streaming replication check by default.
Tatsuo Ishii [Wed, 13 Oct 2021 02:26:43 +0000 (11:26 +0900)]
Enable streaming replication check by default.

Change the compile time default value of sr_check_period from 0 to
10. This means if operating in streaming replication mode, now
streaming replication check is enabled by default. The parameter is
already set to 10 in pgpool.conf.sample-stream. So the only difference
is, when sr_check_period is commented out.

Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2021-October/004042.html

3 years agoFix there's no new line at the end of file.
Tatsuo Ishii [Tue, 12 Oct 2021 08:28:15 +0000 (17:28 +0900)]
Fix there's no new line at the end of file.

3 years agoFix nasty bug with pgpool_recovery() in 4.3 or later.
Tatsuo Ishii [Tue, 12 Oct 2021 06:16:49 +0000 (15:16 +0900)]
Fix nasty bug with pgpool_recovery() in 4.3 or later.

Reported by Kawamoto and Peng Bo.

3 years agoFix signal handler for SIGTERM, SIGINT and SIGQUIT.
Tatsuo Ishii [Tue, 12 Oct 2021 01:40:11 +0000 (10:40 +0900)]
Fix signal handler for SIGTERM, SIGINT and SIGQUIT.

It did not properly save errno and it was possible to overwrite errno.

3 years agoChange compile time default of log_standby_delay from 'none' to 'if_over_threshold'.
Tatsuo Ishii [Fri, 8 Oct 2021 01:55:53 +0000 (10:55 +0900)]
Change compile time default of log_standby_delay from 'none' to 'if_over_threshold'.

Before the compile time default was 'none' but the default value of
sample pgpool.conf was 'if_over_threshold'. Since 'if_over_threshold'
is more useful for most users, change the compile time default to
'if_over_threshold' as well.

Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2021-October/004035.html

3 years agoFix pcp_proc_info, show pool_processes and show pool_pools command.
Masaya Kawamoto [Wed, 6 Oct 2021 05:56:15 +0000 (05:56 +0000)]
Fix pcp_proc_info, show pool_processes and show pool_pools command.

I added new fields to the result of those commands in following commit:
https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commitdiff;h=45152975fdf8d57deaff07dc6c34117fa8eeb3db

The usage of client_idle_limit was mistaken. Child processes are
restarted by child_life_time not client_idle_limit, and client_idle_limit
is related to Client idle duration and disconnects the connection.

So, I changed the display of Start time and Client idle duration.
I modify wait_for_connections function to calculate the time remaining
until the child process is restarted by child_life_time; Instead of
using child_life_time as the timeout for select(2), select(2) with 1 sec
timeout is looped through child_life_time times to get the elapsed time.

Moreover when there were multiple backends, Client idle duration was
only displayed in backend0, so I fix this too.

3 years agoDoc: fix documentation typos.
Bo Peng [Wed, 6 Oct 2021 01:30:24 +0000 (10:30 +0900)]
Doc: fix documentation typos.

4 years agoFix typos in documentation and sample scripts.
Bo Peng [Mon, 4 Oct 2021 10:56:49 +0000 (19:56 +0900)]
Fix typos in documentation and sample scripts.

Patch is created by Kazufumi Noto.

4 years agoAdd missing files to tar ball.
Bo Peng [Sun, 3 Oct 2021 12:12:00 +0000 (21:12 +0900)]
Add missing files to tar ball.

4 years agoDoc: fix yum install command typo in configuration example.
Bo Peng [Wed, 29 Sep 2021 14:47:17 +0000 (23:47 +0900)]
Doc: fix yum install command typo in configuration example.

4 years agoFix some compile time default values.
Tatsuo Ishii [Tue, 28 Sep 2021 10:48:55 +0000 (19:48 +0900)]
Fix some compile time default values.

Some of default values defined in src/config/pool_config_variable.c
were different from what the documentation expects. Namely:

insert_lock (changed from "true" to "false")
clear_memqcache_on_escalation (changed from "false" to "true")
wd_lifecheck_dbname (changed from "postgres" to "template1")
listen_backlog_multiplier (changed from "32" to "2")
authentication_timeout (changed from "0" to "60")

4 years agoFix for bug-732: Segmentation fault at failover ...
Muhammad Usama [Mon, 27 Sep 2021 17:07:48 +0000 (22:07 +0500)]
Fix for bug-732: Segmentation fault at failover ...

trigger_failover_command() had an assumption that old primary can never be NULL,
which of course is not the case.

4 years agoFeature: Import PostgreSQL 14 beta2 new parser.
Bo Peng [Mon, 27 Sep 2021 14:36:29 +0000 (23:36 +0900)]
Feature: Import PostgreSQL 14 beta2 new parser.

Major changes of PostgreSQL 14 parser include:

- Allow an alias to be used to a JOIN ... USING

  SELECT ... FROM t1 JOIN t2 USING (a, b, c) AS x

- Allow DISTINCT to be added to GROUP BY

  SELECT c1, max(c2) FROM t1 GROUP BY DISTINCT c1;

- New SEARCH and CYCLE clauses for common table expressions

4 years agoFix pg_config command path to avoid test failure.
Bo Peng [Thu, 23 Sep 2021 12:54:00 +0000 (21:54 +0900)]
Fix pg_config command path to avoid test failure.

4 years agoFix to support PostgreSQL version (e.g. alpha, beta).
Bo Peng [Thu, 23 Sep 2021 12:32:38 +0000 (21:32 +0900)]
Fix to support PostgreSQL version (e.g. alpha, beta).

4 years agoFix psql command path to avoid test failure.
Bo Peng [Thu, 23 Sep 2021 11:44:27 +0000 (20:44 +0900)]
Fix psql command path to avoid test failure.

4 years agoAdd new config parameter "failover_on_backend_shutdown".
Tatsuo Ishii [Wed, 22 Sep 2021 00:23:02 +0000 (09:23 +0900)]
Add new config parameter "failover_on_backend_shutdown".

If set to on, admin shutdown triggers failover (existing behavior).
If set to off, admin shutdown does not trigger failover (new
behavior), and is useful to completely avoid unwanted failover caused
by pg_terminate_backend() and SIGTERM signal sent to the backend
process.

Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2021-August/003999.html

4 years agoFix occasional hang in COPY FROM.
Tatsuo Ishii [Thu, 16 Sep 2021 06:44:51 +0000 (15:44 +0900)]
Fix occasional hang in COPY FROM.

If an error occurs while doing COPY FROM, it was possible the
Pgpool-II waited forever for a response from backend after COPY end
marker was sent from frontend. Pgpool expected a new message arrives
to socket, but it is possible that the message (in this case an error
message) is already in the backend read buffer. The fix is, check the
buffer is empty or not before reading from the socket.
New test case (07.copy_hang) is also added.

The bug was found by Bo Peng.

4 years agoDoc: fix incorrect file name in "Pgpool-II on Kubernetes".
Bo Peng [Mon, 13 Sep 2021 08:12:56 +0000 (17:12 +0900)]
Doc: fix incorrect file name in "Pgpool-II on Kubernetes".

4 years agoDoc: add release notes for Pgpool-II 4.2.5.
Bo Peng [Mon, 13 Sep 2021 05:57:59 +0000 (14:57 +0900)]
Doc: add release notes for Pgpool-II 4.2.5.

4 years agoFix for bug-731: Fails to execute follow_primary_command..
Muhammad Usama [Fri, 10 Sep 2021 09:38:25 +0000 (14:38 +0500)]
Fix for bug-731: Fails to execute follow_primary_command..

It was a segmentation fault happening because of a silly coding mistake in
parse_wd_exec_cluster_command_json() function.
The problem was the WDExecCommandArg** arg for returning the argument list
was not getting populated properly.
As part of the fix, to get rid of complexity and confusion, I have changed
the function signature to accept List* type argument for returning the
parsed command args instead of an array and its length.

Thanks to Bo Peng, Emond Papegaaij and Tatsuo Ishi for reviewing
and testing the fix

4 years agoAdd new fields to pcp_proc_info, show pool_processes, show pool_pools command.
Masaya Kawamoto [Wed, 8 Sep 2021 06:46:31 +0000 (06:46 +0000)]
Add new fields to pcp_proc_info, show pool_processes, show pool_pools command.

The purpose of this commit is to get more information about the process stats
and how pgpool is working with "client_idle_limit" and "child_max_connections".

Start time:
I add “remaining” that is the remaining time beforl the process is restarted by
client_idle_limit.

Client connection count:
The connection count from clients to this pgpool process. Useful to know how
many times clients can connect to this pgpool process before
child_max_connections reaches.

Backend connection time:
I just rename create_time for clarity.

Client connection time:
The time when the client last connected. If the client uses its own connection
pooling, this helps to know when the connection was actually made from pgpool's
point of view.

Client idle duration:
The elapsed time (in seconds) since the client became in idle state.

Client disconnection time:
This is the last time the client disconnects. The use case is the same as above.

Status:
This is the process status. This shows 4 status: “Wait for connections”, “Idle”,
“Idle in transaction”, “Execute command”.

4 years agoDoc: fixed "PGPOOL SHOW" documentaion that was missing in the previous commit 151e8f5...
Bo Peng [Mon, 6 Sep 2021 08:45:07 +0000 (17:45 +0900)]
Doc: fixed "PGPOOL SHOW" documentaion that was missing in the previous commit 151e8f54961b1a0394cfc86c2f4ddf715b41ceea.

4 years agoFix incorrect PGPOOL SHOW option.
Bo Peng [Fri, 3 Sep 2021 05:16:01 +0000 (14:16 +0900)]
Fix incorrect PGPOOL SHOW option.

Since 4.2 other_pgpool is removed, "PGPOOL SHOW other_pgpool" command should be changed to "PGPOOL SHOW watchdog".

4 years agoFix bug of "PGPOOL SHOW heartbeat" and "PGPOOL SHOW ALL" command.
Bo Peng [Fri, 3 Sep 2021 04:58:46 +0000 (13:58 +0900)]
Fix bug of "PGPOOL SHOW heartbeat" and "PGPOOL SHOW ALL" command.

The last member in heartbeat_* array was not displayed in the command result.

4 years agoFix to allow log_rotation_age to be set to 0.
Tatsuo Ishii [Thu, 2 Sep 2021 00:07:15 +0000 (09:07 +0900)]
Fix to allow log_rotation_age to be set to 0.

According to the docs, it is possible to set 0 to log_rotation_age so
that the log rotation feature is disabled. But the allowed minimum
value for it was mistakenly set to 10, which made it impossible to set
log_rotation_age to 0.

4 years agoSupport include directive in pgppol.conf file
Takuma Hoshiai [Tue, 31 Aug 2021 03:15:12 +0000 (12:15 +0900)]
Support include directive in pgppol.conf file

The pgpool.conf can be nested by 'include' directive.A depth of include have a
restriction for avoiding loop back of include files. 'include' is not regular
parameter, so SHOW command don't display it.

4 years agoFix pgpool_setup to do nothing when no new main node is available.
Tatsuo Ishii [Wed, 25 Aug 2021 00:52:39 +0000 (09:52 +0900)]
Fix pgpool_setup to do nothing when no new main node is available.

When no new main node is available due to there's only 1 node
remaining, pgpool_setup tried to promote a node with node id -1.  This
is impossible. Fix is just skipping whole failover process if new main
node id is -1.

4 years agoFix the incorrect display of load balancing node in raw mode.
Bo Peng [Wed, 18 Aug 2021 08:00:28 +0000 (17:00 +0900)]
Fix the incorrect display of load balancing node in raw mode.

In raw mode, Pgpool-II sends all queies to main node.
This is harmless, but it may confuse users.

4 years agoFix pgpool logger process eats 100% cpu.
Tatsuo Ishii [Thu, 12 Aug 2021 07:37:26 +0000 (16:37 +0900)]
Fix pgpool logger process eats 100% cpu.

The select(2) loop in the logger process did not initialize
timeout.tv_usec, which could cause error in select(2) because of too
big tv_usec. In this select(2) immediately returned and iterate the
for loop.

Problem reported and patch provided by Fang Jun.
Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2021-August/003993.html

4 years agoFix compiler warning.
Tatsuo Ishii [Wed, 11 Aug 2021 00:07:58 +0000 (09:07 +0900)]
Fix compiler warning.

4 years agoUpdate Makefile.in and configure.
Bo Peng [Tue, 10 Aug 2021 12:02:12 +0000 (21:02 +0900)]
Update Makefile.in and configure.

4 years agoFix "ar: `u' modifier ignored since `D' is the default (see `U')" warnings.
Tatsuo Ishii [Tue, 10 Aug 2021 10:07:59 +0000 (19:07 +0900)]
Fix "ar: `u' modifier ignored since `D' is the default (see `U')" warnings.

The warning can be eliminated by changing arguments of ar command from
"cru" to "cr".  There were two places of the warnings: src/libs/pcp
and src/watchdog.  For the former, we need to fix libtool, which is
generated by configure. So fix configure.ac.  For the latter, just fix
src/watchdog/Makefile.am.

4 years agoUpdate configure and src/config/pool_config.c due to the previous commit.
Bo Peng [Tue, 10 Aug 2021 07:52:03 +0000 (16:52 +0900)]
Update configure and src/config/pool_config.c due to the previous commit.

4 years agoFix compiler warnings generated by newer version of gcc.
Tatsuo Ishii [Tue, 10 Aug 2021 07:12:55 +0000 (16:12 +0900)]
Fix compiler warnings generated by newer version of gcc.

gcc on Ubuntu 20 (9.3.0) generates tons of compiler warnings something like:

In file included from /usr/include/string.h:495,
>                  from pg_md5.c:31:
> In function 。strncpy「,
>     inlined from 。update_pool_passwd_from_file「 at pg_md5.c:276:3,
>     inlined from 。main「 at pg_md5.c:136:3:
> /usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: 。__builtin___strncpy_chk「 output may be truncated copying between 0 and 128 bytes from a string of length 257 [-Wstringop-truncation]
>   106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
>       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>

I have found a message in PostgreSQL hackers mailing list regarding similar issue:
https://www.postgresql.org/message-id/flat/21789.1529170195%40sss.pgh.pa.us#525c384d13505fa6f1f25c50b00d7a08

To fix these warnings:

1) fix misuse of strncpy() and friends

2) add -Wno-stringop-truncation to CLFAG

This commit implelents #1 and #2.

Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2021-August/003990.html

4 years agoFix SI mode to acquire a snapshot with an internal transaction.
Tatsuo Ishii [Tue, 10 Aug 2021 04:59:32 +0000 (13:59 +0900)]
Fix SI mode to acquire a snapshot with an internal transaction.

In SI mode a data modifying statement needs to start internal
transaction.  However it forgot to acquire a snapshot. This commit
fixes that in both simple query protocol and extended query protocol.

4 years agoUpdate Makefile and SPEC file to include "pgpool_recovery--1.3--1.4.sql" and "pgpool_...
Bo Peng [Tue, 10 Aug 2021 03:02:52 +0000 (12:02 +0900)]
Update Makefile and SPEC file to include "pgpool_recovery--1.3--1.4.sql" and "pgpool_recovery--1.4.sql".

4 years agoDoc: fix typo in Japanese release note.
Masaya Kawamoto [Tue, 10 Aug 2021 01:29:22 +0000 (01:29 +0000)]
Doc: fix typo in Japanese release note.

4 years agoDoc: Mention that double quotes are required in "PGPOOL SHOW" command if the paramete...
Bo Peng [Mon, 9 Aug 2021 01:43:47 +0000 (10:43 +0900)]
Doc: Mention that double quotes are required in "PGPOOL SHOW" command if the parameter contains uppercase letters.

4 years agoFix backend_flag* parameter shown twice while executing "pgpool show all".
Tatsuo Ishii [Sun, 8 Aug 2021 04:19:33 +0000 (13:19 +0900)]
Fix backend_flag* parameter shown twice while executing "pgpool show all".

There are two entries of "backend_flag" for "ALLOW_TO_FAILOVER" and
"ALWAYS_PRIMARY" in the config variable struct. This is mostly ok but
"pgpool show all" command displayed both backend_flag entries, which
looks redundant. The reason for this is, report_all_variables() shows
grouped variables first then other variables except already shown as
grouped variables.  Unfortunately build_variable groups() is not smart
enough to build grouped variable data: it only registers the first
backend_flag entry and leaves the second entry. Since the second entry
is not a grouped variable, backend_flag is shown firstly as a grouped
variable and then is show as a non grouped variable in
report_all_variables(). To fix this, mark that the second variable is
also a grouped variable (the flag is set by
build_config_variables()). See bug 728 for the report of the problem.

Also add/fix comments.

4 years agoDoc: add new parameter to recovery_1st_stage_command and recovery_2ndt_stage_command.
Tatsuo Ishii [Thu, 5 Aug 2021 08:39:00 +0000 (17:39 +0900)]
Doc: add new parameter to recovery_1st_stage_command and recovery_2ndt_stage_command.

4 years agoAdd missing changes in the previous commit.
Tatsuo Ishii [Thu, 5 Aug 2021 08:10:32 +0000 (17:10 +0900)]
Add missing changes in the previous commit.

4 years agoAdd new parameter to recovery_1st_stage_command and recovery_2nd_stage_command.
Tatsuo Ishii [Thu, 5 Aug 2021 07:45:46 +0000 (16:45 +0900)]
Add new parameter to recovery_1st_stage_command and recovery_2nd_stage_command.

The new parameter represents the primary (main) server host name which
is defined in backend_hostname parameter. The commands used to obtain
the host name by using hostname command. This is usually fine but in
some systems the host name returned by hostname command is not same as
backend_hostname. This brings problem to detach_false_primary feature.

Note that documentations are not completed in this commit because of
my development environment (Ubuntu 20) issue (openjade crashes). I
will push document changes later using another PC.

Discussion:
https://www.pgpool.net/pipermail/pgpool-hackers/2021-July/003943.html
https://www.pgpool.net/pipermail/pgpool-hackers/2021-July/003974.html

4 years agoAdd release notes.
Masaya Kawamoto [Tue, 3 Aug 2021 02:23:12 +0000 (02:23 +0000)]
Add release notes.

4 years agoDoc: Update configuration example "Pgpool-II on Kubernetes".
Bo Peng [Mon, 2 Aug 2021 16:58:31 +0000 (01:58 +0900)]
Doc: Update configuration example "Pgpool-II on Kubernetes".

4 years agoDoc: add more explanation about backend_application_name.
Tatsuo Ishii [Tue, 20 Jul 2021 07:01:08 +0000 (16:01 +0900)]
Doc: add more explanation about backend_application_name.

4 years agoAllow to log error messages in extended query mode in certain cases.
Tatsuo Ishii [Sat, 17 Jul 2021 07:37:27 +0000 (16:37 +0900)]
Allow to log error messages in extended query mode in certain cases.

In the extended query mode, it is possible that error messages are not
logged even after a sync message is received. With this commit
whenever ERROR response is arrived from backend in the extended query
mode, the error message is logged.

4 years agoImplementing the follow_primary command-locking over the watchdog channel.
Muhammad Usama [Fri, 16 Jul 2021 07:17:27 +0000 (12:17 +0500)]
Implementing the follow_primary command-locking over the watchdog channel.

Supplementary fix for [pgpool-hackers: 3892] Problem with detach_false_primary..

commit:455f00dd5f5b7b94bd91aa0b6b40aab21dceabb9 fixed a race condition between
detach_false_primary and follow_primary commands. Part of the fix was to make
sure that the detach_false_primary should only be executed on the
leader watchdog node.

The mentioned commit ensures the execution of detach_false_primary on the
watchdog leader by getting the watchdog status from within the main process.
The design is good enough for most cases, but has the potential to fail if
the cluster goes into the election process just after the main process
has read the status.

To fix that, this commit implements the synchronization of follow_primary_command
execution using the distributed locks over the watchdog channel.

The idea is, just before executing the follow_primary during the failover process
we instruct all standby watchdog nodes to acquire a lock on their respective
nodes to block the false primary detection during the period when the
follow_primary is being executed on the leader watchdog node.

Moreover to keep the watchdog process blocked on waiting for the lock the commit
introduced the pending remote lock mechanism, so that remote locks can get
acquired in the background after the completion of the inflight replication checks.

Finally, REQ_DETAIL_CONFIRMED flag is removed from degenerate_backend_set()
request that gets issued to detach the false primary, That means all quorum
and consensus rules must be satisfied for the detach to happen.

4 years agoDoc: Fix documentation typos.
Bo Peng [Wed, 14 Jul 2021 14:40:28 +0000 (23:40 +0900)]
Doc: Fix documentation typos.

4 years agoDoc: Fix documentation typos.
Bo Peng [Wed, 14 Jul 2021 14:05:16 +0000 (23:05 +0900)]
Doc: Fix documentation typos.

4 years agoUse milliseconds logging for Pgpool-II and PostgreSQL.
Tatsuo Ishii [Tue, 13 Jul 2021 13:21:44 +0000 (22:21 +0900)]
Use milliseconds logging for Pgpool-II and PostgreSQL.

This will make analyzing timing sensitive issues easier. Before we
could not analyze sub-second timing issues.

4 years agoAdd support for log time stamp with milliseconds.
Tatsuo Ishii [Tue, 13 Jul 2021 10:34:28 +0000 (19:34 +0900)]
Add support for log time stamp with milliseconds.

4 years agoFix 033.prefer_lower_standbu_delay
Masaya Kawamoto [Mon, 12 Jul 2021 04:52:40 +0000 (04:52 +0000)]
Fix 033.prefer_lower_standbu_delay

Sometimes this test failed due to the waiting time after pcp_reload_conf
was short. I modified the script to confirm the change by PGPOOL SHOW
before running the test.

4 years agoFix client side hang when describe message is followed by NoData response.
Tatsuo Ishii [Fri, 9 Jul 2021 02:59:33 +0000 (11:59 +0900)]
Fix client side hang when describe message is followed by NoData response.

For certain describe request for a query including "LISTEN", NoData
message can be returned. Since Pgpool-II buffered NoData, clients
could hang waiting for the NoData message in vain. To fix this, do not
buffer NoData message.

Problem reported and patch provided by Daniel van de Giessen.
Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2021-July/003951.html

4 years agoFix query cache to not cache SQLValueFunctions (CURRENT_TIME, CURRENT_USER etc.).
Tatsuo Ishii [Wed, 7 Jul 2021 04:03:59 +0000 (13:03 +0900)]
Fix query cache to not cache SQLValueFunctions (CURRENT_TIME, CURRENT_USER etc.).

Checking SQLValueFunctions was missed whether to be cached or not and
they were regarded as non function objects. As a result they were
cached.

Also add more test cases.