Taiki Koshino [Wed, 10 Dec 2025 07:09:58 +0000 (16:09 +0900)]
Prepare 4.6.5
Taiki Koshino [Wed, 10 Dec 2025 06:50:31 +0000 (15:50 +0900)]
Prepare Release Note
Bo Peng [Mon, 8 Dec 2025 05:23:56 +0000 (14:23 +0900)]
Use "grep -E" instead of deprecated "egrep" in pgpool_setup.
Replace "egrep" with "grep -E" to avoid obsolescence warnings on newer GNU grep versions.
Bo Peng [Mon, 8 Dec 2025 02:08:51 +0000 (11:08 +0900)]
Fix buffer overflow error in show pool_status.
"show pool_status", "pgpool show" and pcp_pool_status could cause a
buffer overflow error. If backend_flag is set to "ALWAYS_PRIMARY",
pool_flag_to_str(), which is responsible to produce printable format
of backend_flag, wrote data past to the end of static buffer.
Author: Tatsuo Ishii <ishii@postgresql.org>
Reported-by: zam bak <zam6ak@gmail.com>
Reviewed-by: Bo Peng <pengbo@sraoss.co.jp>
Discussion: https://www.postgresql.org/message-id/
20251202.140205.
427777414210613577.ishii%40postgresql.org
Backpatch-through: v4.3
Tatsuo Ishii [Tue, 2 Dec 2025 10:26:55 +0000 (19:26 +0900)]
Fix memqcache_stats_start_time shown in "show pool_status".
get_config() uses ctime() to generate printable form of
memqcache_stats_start_time. But it did not take into account that
ctime() adds newline at the end of result. As a result, not only the
output of memqcache_stats_start_time was with unnecessary newline but
next row printed empty items.
Author: Tatsuo Ishii <ishii@postgresql.org>
Discussion: https://www.postgresql.org/message-id/
20251130.102712.
131456481338876013.ishii%40postgresql.org
Backpatch-through: v4.3
Tatsuo Ishii [Tue, 25 Nov 2025 09:45:01 +0000 (18:45 +0900)]
Test: stabilize 037.failover_session.
On some platform (in my case Rocky Linux 10 running on VitualBox)
fails to finish shutdownall after test1. This could be caused by the
failover in the test to fail to restore the signal handler which
should accept shutdown signal from shutdownall. Adding "sleep 5"
before shutdownall seems to mitigate the problem.
Author: Tatsuo Ishii <ishii@postgresql.org>
Backpatch-through: v4.5
Bo Peng [Fri, 21 Nov 2025 05:13:25 +0000 (14:13 +0900)]
Revert "Fix %patch macro usage in RPM spec."
This reverts commit
2bc611ec67ee6ffca8dab7851834d3e0e5c89c86.
The change from `%patchN` to `%patch N` breaks builds on
Rocky Linux 8 / RHEL 8 where this newer %patch syntax is not supported.
Bo Peng [Tue, 18 Nov 2025 03:06:34 +0000 (12:06 +0900)]
Prepare 4.6.4.
Bo Peng [Tue, 18 Nov 2025 00:44:44 +0000 (09:44 +0900)]
Doc: update release note.
Bo Peng [Tue, 18 Nov 2025 00:34:08 +0000 (09:34 +0900)]
Doc: update release note.
Tatsuo Ishii [Sun, 16 Nov 2025 06:51:24 +0000 (15:51 +0900)]
Fix segfault with CopyOut.
When "COPY relname TO STDOUT" is executed in the extended query
protocol mode, pgpool segfaulted.
When read_kind_from_backend() reads a message from backend, it
extracts the corresponding entry from the pending message queue when
processing extended query protocol messages. However, if the head of
the message queue is an "execute" message, some of incoming message
types are exceptional because other than CommandComplete message
(which means the execute message finishes) may come from backend. This
includes DataRow, ErrorResponse, NoticeMessage. Unfortunately we
overlooked that 'H' (CopyOutResponse) is in the group too. Thus when
CopyOutResponse comes from backend, the execute pending message is
removed. If the next message from frontend is Sync (it's often
happens), read_kind_from_backend() sets session_context->query_context
to NULL, and calls pool_unset_query_in_progress(), which accesses
session_context->query_context and segfaults.
The fix is, to add CopyOutResponse to the exception list. Just in
case, we also add 'd' (CopyData) and 'c' (CopyDone) to the list. This
may not be actually necessary since CopyData and CopyDone are
processced in CopyDataRows() though.
Add regression test case to 126.copy_hang (master and v4.7) or
076.copy_hang (v4.6 or before).
Author: Tatsuo Ishii <ishii@postgresql.org>
Reported-by: https://github.com/tetesh
Reviewed-by: Bo Peng <pengbo@sraoss.co.jp>
Discussion: https://github.com/pgpool/pgpool2/issues/133
Backpatch-through: v4.2
Taiki Koshino [Fri, 14 Nov 2025 01:27:09 +0000 (10:27 +0900)]
Prepare Release Note.
Taiki Koshino [Wed, 12 Nov 2025 08:01:23 +0000 (17:01 +0900)]
Fix %patch macro usage in RPM spec.
Replaced `-%patchN` with `%patch N` in %prep section to properly apply patches.
Tatsuo Ishii [Fri, 7 Nov 2025 09:17:54 +0000 (18:17 +0900)]
Remove unnecessary application_name treatment.
Commit
c20858797eafe377b30166b467d2a36de89768e1 added an treatment to
send "set application_name" command to backend when reusing existing
connection. The reason were:
(1) to set application_name parameter to proper value, which is the
value specified in the startup packet when the connection was created.
(2) to return application_name parameter status message to frontend.
However, (1) is not necessary, because when the previous connection is
closed, queries in reset_query_list are executed and the list usually
includes "DISCARD ALL", which reset the application_name value to the
previous one which was set when the connection was established. Also
(2) is not necessary either, because send_params() sends all necessary
parameter status messages to frontend including application_name.
For these reasons, I think the treatment added in
c20858797eafe377b30166b467d2a36de89768e1 is not necessary. This commit
just removes the treatment. Also this will enhance the performance
when some of backend nodes are in geographically distant location, by
eliminating the time to send application_name to such a node and wait
for the response.
Author: Tatsuo Ishii <ishii@postgresql.org>
Discussion: https://github.com/pgpool/pgpool2/issues/130
Backpatch-through: v4.2.
Tatsuo Ishii [Tue, 4 Nov 2025 00:51:02 +0000 (09:51 +0900)]
Fix pgpool_adm Makefile.
The Makefile set SHLIB_LINK. However nowadays PostgreSQL provides most
of the SHLIB_LINK options in Makefile.global except
-L../../libs/pcp/.libs -lpcp. Moreover '${prefix}/lib', which is
currently in the option, is harmful because while building rpm
packages, check_rpaths complains that /libs is in rpath. So remove
all the options except -L../../libs/pcp/.libs -lpcp.
Backpatch-through: v4.2
Tatsuo Ishii [Thu, 9 Oct 2025 11:33:40 +0000 (20:33 +0900)]
Make time calculations always long long.
Previously pgpool assumed that time_t to be a simple long. This causes
a lot of compile time warnings on certain systems, for example
OpenBSD because on the system time_t is __int64, which results in long
long. This commit upcasts such calculations to long long to avoid the
issue.
This way times can't get truncated and for the places where time_t is
actually used as a time and not a time diff this would allow pgpool to
keep working correctly post Y2038 on 64 bit clean time_t systems
(e.g. i386 OpenBSD).
Moreover, json_get_long_value_for_key is changed to
json_get_llong_value_for_key and changed the parameter to long long.
This makes it more in line _json_value's integer, which is defined as
int64. This should also give 32 bit platforms proper retrieval of the
max value of an integer and may or may not solve some weird integer
overflow issues.
Backpatch for 4.6 was rebased by Gyorgy Sarvari.
Author: Martijn van Duren <pgpool@list.imperialat.at>
Reviewed-by: Tatsuo Ishii <ishii@postgresql.org>
Reviewed-by: Gyorgy Sarvari <skandigraun@gmail.com>
Backpatch-through: v4.6
Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2025-May/004584.html
Discussion: https://www.postgresql.org/message-id/
20251003.211957.
2067537305399895611.ishii%40postgresql.org
Discussion: https://github.com/pgpool/pgpool2/pull/128
Bo Peng [Mon, 6 Oct 2025 01:17:39 +0000 (10:17 +0900)]
Update mailing list address to use pgpool-hackers@lists.postgresql.org instead of pgpool-hackers@pgpool.net.
Tatsuo Ishii [Fri, 3 Oct 2025 01:44:10 +0000 (10:44 +0900)]
Prevent watchdog split-brain scenario in some corner cases.
Watchdog uses two methods for communication: beacon message and
heartbeat. If the heartbeat is not working yet, it is possible that
split-brain occurs if beacon messages are not received by standby
nodes more than 30 seconds (see watchdog_state_machine_standby). In
this case other watchdog node becomes new leader node. Problem is, the
former leader node remains leader too, thus there are two leader
nodes: split-brain.
Suppose we have 3 watchdog nodes (node 0, 1, 2) and node 2 was not
started due a maintenace work. In this case life check is not started.
$ pcp_watchdog_info -p 50005
3 3 NO localhost:50000 Linux tishii-CFSV9-2 localhost
localhost:50004 Linux tishii-CFSV9-2 localhost 50004 50006 7 STANDBY 0 MEMBER
localhost:50000 Linux tishii-CFSV9-2 localhost 50000 50002 4 LEADER 0 MEMBER
Not_Set localhost 50008 50010 0 DEAD 0 MEMBER
Then to stop the beacon signal, send STOP signal to node0 watchdg
process. Node 1 is promoted and now we have two leader nodes 0 and 1.
$ pcp_watchdog_info -p 50005
3 3 NO localhost:50004 Linux tishii-CFSV9-2 localhost
localhost:50004 Linux tishii-CFSV9-2 localhost 50004 50006 4 LEADER 0 MEMBER
localhost:50000 Linux tishii-CFSV9-2 localhost 50000 50002 4 LEADER 0 MEMBER
Not_Set localhost 50008 50010 0 DEAD 0 MEMBER
This commit tries to prevent having two leaders by revoking the former
leader. If a node detects beacon message from leader node being lost
more than 2 times (3 * BEACON_MESSAGE_INTERVAL_SECONDS), leader node
is set to LOST state and new leader node election process is triggered
by calling set_state(WD_JOINING).
Backpatch-through: v4.2
Tatsuo Ishii [Fri, 3 Oct 2025 01:18:45 +0000 (10:18 +0900)]
Prevent FATAL error when non-existing prepared statement is given.
Previously Bind() raised FATAL error if non-existing prepared statement was given.
This is different from PostgreSQL's behavior.
\bind_named stmt2 'baz' \g
ERROR: prepared statement "stmt2" does not exist
This commit let Bind() check the existence of prepared statement and
if it does not exist, send an ERROR message to frontend. Note that no
log is left in the log file. This is not preferred action but currently
it's not possible to leave log.
Backpatch-through: v4.2
Tatsuo Ishii [Tue, 30 Sep 2025 09:04:06 +0000 (18:04 +0900)]
Test: adapt 023.ssl_connection to PostgreSQL 18.
PostgreSQL 18 heavily changed psql's \conninfo output format, which
made the test fail because the test relies on \conninfo. This commit
makes the test script aware the PostgreSQL version to fix the issue.
Backpatch-through: v4.2
Tatsuo Ishii [Wed, 24 Sep 2025 01:26:14 +0000 (10:26 +0900)]
Fix pg_enc not working if both -p and -P are provided.
In the original report (https://github.com/pgpool/pgpool2/issues/129:
[root@test1 bin]# ./pg_enc -p -P
db password:
encryption key:
encryption key not provided
Also I found a misleading comment:
case 'p': /* prompt for postgres password */
This is not appropriate since the password is not provided to
PostgreSQL. It is totally unrelated to the issue but I replaced it
with following in this opportunity:
case 'p': /* prompt for password to be encrypted */
Author: jinyang liu <liujy@highgo.com>
Discussion: https://www.postgresql.org/message-id/
7f18c30b.237.
1997555ca11.Coremail.liujy%40highgo.com
Backpatch-through: v4.2
Tatsuo Ishii [Mon, 22 Sep 2025 02:29:11 +0000 (11:29 +0900)]
Fix wrong positioned comment.
Backpatch-through: v4.2
Tatsuo Ishii [Wed, 17 Sep 2025 23:24:13 +0000 (08:24 +0900)]
Fix compiling issue on 32-bit environments.
It is reported that compiling src/parser/snprintf.c on 32-bit
environments fails due to undefined functions (isnan() and
ininf()). They come from math.h so include it. snprintf.c was
imported from PostgreSQL long time ago. If we look into the original
file (src/port/snprintf.c) it actually has "#include <math.h>"
already. Including math.h was provided as a pull request:
https://github.com/pgpool/pgpool2/pull/128
I also added a minor modification to the patch to reorder the
positions of include files.
Author: Gyorgy Sarvari <skandigraun@gmail.com>
Discussion: https://www.postgresql.org/message-id/
20250917.194736.
353755422175293639.ishii%40postgresql.org
Backpatch-through: v4.2
Taiki Koshino [Wed, 17 Sep 2025 07:11:57 +0000 (16:11 +0900)]
Update doc about "Setting up PostgreSQL standby" in "8.2. Pgpool-II + Watchdog Setup Example".
Add a note that when setting up a standby without online recovery, do not write primary_conninfo to postgresql.auto.conf.
Discussion: https://github.com/pgpool/pgpool2/issues/67
Backpatch-through: v4.2
Taiki Koshino [Wed, 10 Sep 2025 06:25:48 +0000 (15:25 +0900)]
Fix safer directory deletion in Bash in recovery_1st_stage.sample.
Quote variables in rm commands to avoid accidental deletion:
rm -rf "${DEST_NODE_PGDATA}"
If the variable is empty, rm could delete unexpected files or directories.
Tatsuo Ishii [Sun, 31 Aug 2025 06:49:15 +0000 (15:49 +0900)]
Allow to compile against gcc 15 (C23).
This commit includes multiple fixes to compile Pgpool-II in Fedora 42,
which uses gcc 15 (C23).
- Modify pool_type.h. "bool" is now standard in C99 and
above. PostgreSQL decided to require C99 to compile it. So we follow
the way, which is just including <stdbool.h>. Also we define
TRUE/FALSE to (bool) 1 and (bool) 0 respectively. They are used only
in Windows build in PostgreSQL but we still use them in some
places. Eventually we should replace it with true/false since we do
not support Windows.
- It is now required that function pointer arguments matches the
function prototype to be called. For example:
static pid_t worker_fork_a_child(ProcessType type, void (*func) (), void *params);
should be:
static pid_t worker_fork_a_child(ProcessType type, void (*func) (void *), void *params);
Also the prototype of pool_create_relcache() is changed,
- raw_expression_tree_walker() calls walker() in many places. Now
callers of walker() should cast the first argument of it using (Node
*). We replace the call:
return walker(((RangeVar *) node)->alias, context);
with:
return WALK(((RangeVar *) node)->alias, context);
where WALK is defined as:
#define WALK(n,c) walker((Node *) (n), c)
- Note: we have lots of warnings regarding OpenSSL while compiling
Pgpool-II in Fedora42. The version used in Fedora42:
$ openssl -version
OpenSSL 3.2.4 11 Feb 2025 (Library: OpenSSL 3.2.4 11 Feb 2025)
The fix is not included in this commit. We need
to look into it in the future.
Discussion: https://github.com/pgpool/pgpool2/issues/124
Backpatch-through: v4.6
Tatsuo Ishii [Fri, 5 Sep 2025 09:11:04 +0000 (18:11 +0900)]
Fix point less warning in query cache invalidation.
When memcached support is disabled, query cache invalidation by query
emitted point less warning. This makes 006.memcached regression test
failed.
PGPOOL SET CACHE DELETE '/*FORCE QUERY CACHE*/SELECT 1;';
WARNING: failed to delete query cache on memcached, memcached support is not enabled
Backpatch-through: v4.6
Tatsuo Ishii [Fri, 5 Sep 2025 08:12:12 +0000 (17:12 +0900)]
Fix query cache when pgpool is built without memcached.
When configure is not provided --with-memcached, compiler error
occured.
query_cache/pool_memqcache.c:542:17: 警告: 'free' called on pointer 'cih' with nonzero offset 24 -Wfree-nonheap-objec
t]
542 | free(ptr);
| ^~~~~~~~~
query_cache/pool_memqcache.c:2843:15: 備考: returned from 'pool_cache_item_header'
2843 | cih = pool_cache_item_header(cacheid);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is caused by the code block:
if (!pool_is_shmem_cache())
{
free(ptr);
}
The compiler thought that "ptr" could be the value returned by
pool_cache_item_header(), because the compiler does not understand
pool_is_shmem_cache() could return false only when memcached is
enabled. To fix this, surround the code block above with #ifdef
USE_MEMCACHED.
Reported-by: Bo Peng <pengbo@sraoss.co.jp>
Backpatch-through: v4.2
Tatsuo Ishii [Thu, 4 Sep 2025 05:59:26 +0000 (14:59 +0900)]
Fix query cache lock file handling.
Query cache module creates a lock file under logdir for concurrency
control. However, there were bugs in the handling:
1) Garbage file "QUERY_CACHE_LOCK_FILE" was created by pgpool main
process.
2) The lock file was not removed upon pgpool shutdown.
This commit fixes the bugs.
Author: Tatsuo Ishii <ishii@postgresql.org>
Reported-by: Bo Peng <pengbo@sraoss.co.jp>
Reviewed-by: Bo Peng <pengbo@sraoss.co.jp>
Backpatch-through: v4.4
Tatsuo Ishii [Sun, 31 Aug 2025 12:06:01 +0000 (21:06 +0900)]
Test: unbreak 039.log_backend_messages.
Commit
8ff2b9f6e mistakenly put synchronous commit parameters in
pgpool.conf. Unbreak the test by putting the parameters in
postgresql.conf. Also check if clustering mode is streaming
replication. Because that parameters causes suspends PostgreSQL if
clustering mode is other than streaming replication.
Backpatch-through: v4.6
Tatsuo Ishii [Sun, 31 Aug 2025 06:17:54 +0000 (15:17 +0900)]
Test: stabilize 039.log_backend_messages test.
In the test a query is sent to standby server right after rows are
inserted into primary server. Due to a replication lag, the inserted
rows could not be found on the standby in slower machines. This
commit tries to fix the issue by using synchronous replication with
remote_apply option.
Backpatch-through: v4.2
Tatsuo Ishii [Fri, 29 Aug 2025 07:15:55 +0000 (16:15 +0900)]
Test: fix ruby script in 010.rewrite_timestamp.
The ruby script used "File.exists", which is said to be obsoleted in
newer version of Ruby. Replace it with "File.exist".
Backpatch-through: v4.2
Tatsuo Ishii [Fri, 29 Aug 2025 06:48:57 +0000 (15:48 +0900)]
Test: tweak timeout in 034 and 075 tests.
034.promote_node and 075.detach_primary_left_down_node set the timeout
60 seconds for finishing follow primary script. It turns out that
these timeout values are not long enough, and sometimes caused false
errors. So make them from 60 seconds to 120 seconds.
Backpath-through: v4.2
Tatsuo Ishii [Wed, 27 Aug 2025 01:14:53 +0000 (10:14 +0900)]
Test: add ssl_ecdh_curve test to 023.ssl_connection.
023.ssl_connection did not cover the test for ssl_ecdh_curve. This
commit tests it using bad ssl_ecdh_curve parameter to see if connection
between frontend and pgpool fails.
Author: Tatsuo Ishii <ishii@postgresql.org>
Backpatch-through: v4.2
Taiki Koshino [Tue, 26 Aug 2025 04:37:16 +0000 (13:37 +0900)]
Doc: Fix releasenote link.
Tatsuo Ishii [Fri, 22 Aug 2025 00:01:06 +0000 (09:01 +0900)]
Doc: fix watchdog_setup manual.
It mistakenly stated that heartbeart is not setup in watchdog_setup.
Auther: Tatsuo Ishii <ishii@postgresql.org>
Backpatch-through: V4.2
Taiki Koshino [Tue, 19 Aug 2025 02:09:51 +0000 (11:09 +0900)]
Doc: Update doc version
Taiki Koshino [Tue, 19 Aug 2025 02:05:18 +0000 (11:05 +0900)]
Prepare 4.6.3.
Taiki Koshino [Tue, 19 Aug 2025 00:59:55 +0000 (09:59 +0900)]
Doc: add release notes.
Taiki Koshino [Fri, 15 Aug 2025 02:20:33 +0000 (11:20 +0900)]
Doc: Enhance "8.3. Replication Mode and Snapshot Isolation Mode Configuration Example" Document.
Updated the link to the example script and the explanation in the "8.3.3. Before you begin" section.
Taiki Koshino [Wed, 6 Aug 2025 02:28:48 +0000 (11:28 +0900)]
Doc: Update sample script links in "8.2. Pgpool-II + Watchdog Setup Example"
This is a follow-up to commit
34b07c2.
Updated the sample script links in section "8.2. Pgpool-II + Watchdog Setup Example" to point to the GitHub repository file URLs.
Taiki Koshino [Mon, 4 Aug 2025 01:01:59 +0000 (10:01 +0900)]
Doc: fix documentation for parameters that are not
reflected by reload.
"authentication_timeout" and "memqcache_oiddir" is not reflected by reload.
The documentation is changed to "This parameter can only be set at server start.".
Japanese doc too.
Backpatch-through: v4.2
Tatsuo Ishii [Fri, 25 Jul 2025 04:55:42 +0000 (13:55 +0900)]
Fix watchdog to print inappropriate NOTICE message.
read_ipc_socket_and_process() printed a notice message every time when
it wrote commands to IPC socket even if it was successful. Fix this to
print the notice message only when the write failed.
The reason why this bug was not recognized is, the message appears
only when log_min_messages is set to notice or higher.
Discussion: https://github.com/pgpool/pgpool2/issues/121
Backpatch-through: v4.2
Tatsuo Ishii [Thu, 24 Jul 2025 01:07:29 +0000 (10:07 +0900)]
Doc: unify watchdog leader terms (followup).
This is a followup commit to
222a88a751c75acfc809e06559621699255921f7.
This commit updates advaced.sgml.
Backpatch-trhough: v4.2
Tatsuo Ishii [Wed, 23 Jul 2025 06:51:56 +0000 (15:51 +0900)]
Doc: unify watchdog leader terms.
Previously terms "leader", "active" and "coordinator" were used to
mean the leader watchdog node. This brought enough confusion. So this
commit unifies them to "leader"."
Backpatch-trhough: v4.2
Tatsuo Ishii [Sat, 19 Jul 2025 06:48:37 +0000 (15:48 +0900)]
Fix resource leak while reading startup packet.
Per Coverity.
Backpatch-through: v4.2
Tatsuo Ishii [Sat, 19 Jul 2025 06:43:11 +0000 (15:43 +0900)]
Fix memory leak.
Fix resource leak in pool_push_pending_data pointed out by Coverity.
Backpatch-through: v4.2
Taiki Koshino [Wed, 16 Jul 2025 05:26:58 +0000 (14:26 +0900)]
Doc: Fix example script link at V4_6.
Modified the sample script in the section "8.2. Pgpool-II + Watchdog Setup Example"
Bo Peng [Mon, 30 Jun 2025 02:53:56 +0000 (11:53 +0900)]
Fix broken scram-sha-256 authentication on big-endian machies.
When scram-sha-256 authentication is performed, a hash function
pg_sha_256_final is used. It was imported from PostgreSQL and it uses
preprocessor define WORDS_BIGENDIAN to judge host machine's
endianness. Although WORDS_BIGENDIAN should be defined while
configure, this part was missed when pg_sha_256_final (and others) was
imported from PostgreSQL. As a result, scram-sha-256 worked only in
little endian machines. This commit fixes the issue by adding
AC_C_BIGENDIAN macro to configure.ac.
Author: Tatsuo Ishii
Reported-by: Christoph Berg
Reviewed-by: pranavkaruvally
Discussion: https://github.com/pgpool/pgpool2/issues/106
Backpatch-through: v4.2
Bo Peng [Mon, 23 Jun 2025 02:54:30 +0000 (11:54 +0900)]
Fix source code typos.
Tatsuo Ishii [Wed, 18 Jun 2025 08:04:13 +0000 (17:04 +0900)]
Doc: fix load balance explanation missed logical replication mode.
Backpatch-through: v4.2
Bo Peng [Wed, 18 Jun 2025 09:12:13 +0000 (18:12 +0900)]
Doc: enhance pcp_node_info document.
Clarify that each backend_application_nameX must match the value specified
in the application_name of primary_conninfo to correctly display
"replication_state" and "replication_sync_state".
Tatsuo Ishii [Wed, 18 Jun 2025 07:41:03 +0000 (16:41 +0900)]
Doc: fix load balance explanation missed Slony mode.
Since Slony mode will gone in master branch, fix is not applied to
master branch.
Backpatch-through: v4.6 to v4.2
Tatsuo Ishii [Sat, 14 Jun 2025 11:12:57 +0000 (20:12 +0900)]
Fix heartbeat device treatment.
wd_create_hb_recv_socket() and wd_create_hb_send_socket() called
setsockopt(2) with wrong argument.
struct ifreq i;
strlcpy(i.ifr_name, hb_if->if_name, sizeof(i.ifr_name));
if (setsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE, &i, sizeof(i)) == -1)
:
This is not quite correct since the 4th argument should be
just a null terminated string (device name), not struct ifreq.
Discussion: [pgpool-hackers: 4602] heartbeat and SO_BINDTODEVICE
https://www.pgpool.net/pipermail/pgpool-hackers/2025-May/004603.html
Backpatch-through: v4.6
Tatsuo Ishii [Sat, 14 Jun 2025 07:15:59 +0000 (16:15 +0900)]
Fix resource leak in hearbeat receiver process.
Pointed out by Coverity.
Backpatch-through: v4.6
Tatsuo Ishii [Fri, 13 Jun 2025 01:08:12 +0000 (10:08 +0900)]
Enhance connecting process to backend.
In certain environment (especially k8s), DNS look up is unstable and
connecting to backend process fails. This occurs in call to
getaddrinfo() in connect_inet_domain_socket_by_port(). To enhance the
situation, retry up to 5 times (at each retry, sleep 1 second) if
getaddrinfo() fails with EAI_AGAIN. Note that if
connect_inet_domain_socket_by_port() is called with "retry" argument
is false, the retry will not happen. Health check calls
connect_inet_domain_socket_by_port() with the retry flag to false so
that retrying is controlled health check's own parameters.
Since up to now there's no similar issue reported, back patch to only
4.6 to make backpatching minimal.
Discussion: https://github.com/pgpool/pgpool2/issues/104
Backpatch-through: v4.6
Tatsuo Ishii [Sun, 8 Jun 2025 11:25:48 +0000 (20:25 +0900)]
Test: stabilize 029.cert_passphrase regression test.
When ssl_passphrase_command is not valid, the error message is
typically "bad decrypt" but it seems sometimes "wrong tag".
This is a backport of master
e30bb2ead.
Backpatch-through: v4.6 - v4.2.
Tatsuo Ishii [Mon, 9 Jun 2025 03:49:36 +0000 (12:49 +0900)]
Fix heartbeat_device treatment.
While processing pgpool.conf, heartbeat_device was mistakenly treated
and the first device was ignored. For example:
heartbeat_device0 = 'eth0'
the configuration process disregarded 'eth0' and acted as if no device
was set. Another example:
heartbeat_device0 = 'eth0;eth1'
"eth0" was simply ignored.
Reviewed-by: Bo Peng <pengbo@sraoss.co.jp>
Backpatch-through: v4.2
Tatsuo Ishii [Sun, 8 Jun 2025 06:32:00 +0000 (15:32 +0900)]
Doc: add section of kernel resources.
Pgpool-II uses System V shared memory and semaphores. It's better to
describe the requirements in the docs.
Backpatch-through: v4.2
Tatsuo Ishii [Sat, 7 Jun 2025 07:18:33 +0000 (16:18 +0900)]
Doc: add description for --with-ldap option of configure.
It was missed when LDAP support was introduced in v4.2
Backpatch-through: v4.2
Tatsuo Ishii [Thu, 5 Jun 2025 10:42:40 +0000 (19:42 +0900)]
Fix heartbeat receiver not working.
65dbbe7a0 added IPv6 support for heartbeat in 4.6. However it
mistakenly bound to only loopback addresses in heartbeat receive
process. Thus heartbeat messages from other watchdog heartbeat sender
were never received. To fix this add AI_PASSIVE flag to hints argument
to getaddrinfo(), which results in binding all network
interfaces. Note that before 4.6, heartbeat receive process uses
INADDR_ANY for bind(), which resulted in binding all network
interfaces too. So there's no big difference between 4.6 and pre-4.6.
Reviewed-by: Bo Peng <pengbo@sraoss.co.jp>
Backpatch-through: v4.6
Bo Peng [Thu, 5 Jun 2025 03:32:08 +0000 (12:32 +0900)]
Doc: fix command in "8.2. Pgpool-II + Watchdog Setup Example" to escape $PGDATA.
Tatsuo Ishii [Wed, 4 Jun 2025 11:10:34 +0000 (20:10 +0900)]
Doc: clarify supported platforms for Pgpool-II.
Backpatch-through: v4.2
Tatsuo Ishii [Tue, 3 Jun 2025 10:33:09 +0000 (19:33 +0900)]
Doc: enhance child_life_time document.
Backpatch-through: v4.2
Tatsuo Ishii [Mon, 2 Jun 2025 10:37:39 +0000 (19:37 +0900)]
Fix typo in pgpool.conf.
Backpatch-through: v4.3
Bo Peng [Thu, 29 May 2025 00:30:12 +0000 (09:30 +0900)]
Prepare 4.6.2
Bo Peng [Thu, 29 May 2025 00:28:04 +0000 (09:28 +0900)]
Doc: add release note.
Tatsuo Ishii [Tue, 27 May 2025 10:15:54 +0000 (19:15 +0900)]
Fix watchdog receive socket creation without IPv6.
When IPv6 network is not available, it was possible that watchdog
process won't start. Previously wd_create_recv_socket() issued
elog(ERROR) if creation or handling IPv6 socket failed. Unfortunately
at the time when wd_create_recv_socket() is called, the exception
stack is not established, and elog happily converts ERROR to FATAL,
which causes exiting watchdog process, thus exiting pgpool process.
To fix this, the elog(ERROR) calls are changed to elog(LOG).
Reported-by: Bo Peng (pengbo@sraoss.co.jp)
Discussion: https://github.com/pgpool/pgpool2/issues/99
Backpatch-through: v4.6
Tatsuo Ishii [Sat, 17 May 2025 06:24:23 +0000 (15:24 +0900)]
Suppress unnecessary information upon authentication failure.
Previously a message "password size does not match" was displayed when
client authentication failed. This could help an attacker to guess
password. Replace it just "password does not match".
Backpatch-through: v4.2
Tatsuo Ishii [Thu, 15 May 2025 09:03:50 +0000 (18:03 +0900)]
Allow pcp clients to connect to IPv6 addresses.
We have already allowed pcp server to connect to IPv6 addresses, but
pcp clients were not allowed to connect to them until today. This
commit allows pcp clients to connect to IPv6 addresses.
Discussion: [pgpool-general: 9481] Does pgpool 4.6.0 support pure ipv6 configuration?
https://www.pgpool.net/pipermail/pgpool-general/2025-May/009484.html
Backpatch-through: v4.6
Bo Peng [Thu, 15 May 2025 07:07:26 +0000 (16:07 +0900)]
Doc: Update release notes to include details of the vulnerability fix.
Bo Peng [Tue, 13 May 2025 09:29:54 +0000 (18:29 +0900)]
Doc: update release note.
Bo Peng [Tue, 13 May 2025 09:08:32 +0000 (18:08 +0900)]
Prepare 4.6.1
Bo Peng [Tue, 13 May 2025 09:06:36 +0000 (18:06 +0900)]
Doc: update release note.
Bo Peng [Tue, 13 May 2025 08:37:06 +0000 (17:37 +0900)]
Fix incorrect client authentication in some cases.
If enable_pool_hba = on, it's auth method is "password", no password
is registered in pool_passwd, and auth method in pg_hba.conf is
"scram-sha-256" or "md5", for the first time when a client connects to
pgpool, authentication is performed as expected. But if a client
connects to the cached connection, any password from the client is
accepted.
authenticate_frontend() asks password to the client and stores it in
frontend->password. When pgpool authenticate backend,
authenticate_frontend_SCRAM() or authenticate_frontend_md5() is called
depending on pg_hba.conf setting. authenticate_frontend_*() calls
get_auth_password() to get backend cached password but it mistakenly
returned frontend->password if pool_passwd does not have an entry for
the user. Then authenticate_frontend_*() tries to challenge based on
frontend->password. As a result, they compared frontend->password
itself, which always succeed. To fix this, when get_auth_password() is
called with reauth parameter being non 0, return backend->password.
Also if enable_pool_hba = off, in some cases a client is not asked
password for the first time, or when a client connects to cached
connection, even if it should be.
If pool_hba.conf is disabled, get_backend_connection() does not call
Client_authentication(), thus frontend->password is not set. Then
pool_do_reauth() calls do_clear_text_password(). It should have called
authenticate_frontend_clear_text() to get a password from the client,
but a mistake in a if statement prevented it. The mistake was fixed in
this commit.
Pgpool-II versions affected: v4.0 or later.
Also this commit does followings:
- Remove single PostgreSQL code path to simplify the authentication
code. As a result, following cases are no more Ok.
- Remove crypt authentication support for frontend and backend. The
feature had not been documented and never tested. Moreover crypt
authentication was removed long time ago in PostgreSQL (8.4, 2009).
- Add new regression test "040.client_auth". The test performs
exhaustive client authentication tests using a test specification
file formatted in CSV.
The csv files have 7 fields:
username: the username used for the test case
pool_hba.conf: takes "scram", "md5", "password", "pam", "ldap" or
"off". If "scram", "md5" , "password", "pam" or "ldap", the user
will have an entry in pool_hba.conf accordingly. If "off",
enable_pool_hba.conf will be off.
allow_clear_text_frontend_auth: takes "on" or "off".
pool_passwd: takes "AES", "md5" or "off". If "AES" or "md5" the
user's password will be stored in pool_passwd using ASE256 or md5
encryption method accordingly. If "off" is specified, no entry will
be created.
pg_hba.conf: almost same as pool_hba.conf except this is for
pg_hba.conf.
expected: takes "ok" or "fail". If ok, the authentication is
expected to be succeeded. If failed, the test is regarded as
failed. "fail" is opposite. The authentication is expected to be
failed. If succeeds, the test regarded as failed.
comment: arbitrary comment
By changing these fields, we can easily modify or add test
cases. The merit of this method is possible higher test
coverage. For human, it is easier to find uncovered test cases in a
table than in a program code.
Backpatch-through: v4.2
The patch was created by Tatsuo Ishii.
Taiki Koshino [Tue, 13 May 2025 06:00:43 +0000 (15:00 +0900)]
Doc: add release notes.
Tatsuo Ishii [Fri, 9 May 2025 01:55:38 +0000 (10:55 +0900)]
Doc: enhance query cache doc.
Pgpool refuses to cache a query calling functions returning TIMESTAMP
WITH TIMEZONE, TIME WITH TIMEZONE. If there are multiple functions
having same name and one of them returns TIMESTAMP WITH TIMEZONE, TIME
WITH TIMEZONE, pgpool refuses to cache even if one of them does not
return the data types. So add a note on this along with workaround.
Tatsuo Ishii [Thu, 8 May 2025 10:49:10 +0000 (19:49 +0900)]
Fix long standing bind bug with query cache.
When a named statement is prepared, it is possible to bind then
execute without a parse message. Problem is, table oids which are
necessary to invalidate query cache at execute or COMMIT was collected
only in parse messages process (Parse()). Thus if bind is executed
without parse after previous execute, no table oids were collected,
and pgpool failed to invalidate query cache.
Fix is collecting table oids at bind time too.
Add regression test to 006.memqcache.
Problem reported by and test program provided by Achilleas Mantzios
<a.mantzios@cloud.gatewaynet.com>.
Discussion: [pgpool-general: 9427] Clarification on query results cache visibility
https://www.pgpool.net/pipermail/pgpool-general/2025-April/009430.html
Backpatch-through: v4.2
Tatsuo Ishii [Thu, 1 May 2025 23:35:33 +0000 (08:35 +0900)]
Fix query cache invalidation bug.
When an execute message is received, pgpool checks its max number of
rows paramter. If it's not zero, pgpool sets "partial_fetch" flag to
instruct pool_handle_query_cache() to not create query cache. Problem
is, commit
2a99aa5d1 missed that even INSERT/UPDATE/DELETE sets the
execute message parameter to non 0 (mostly 1) and pgpool set the flag
for even none SELECTs. This resulted in failing to invalidate query
cache because if the flag is true, subsequent code in
pool_handle_query_cache() skips cache invalidation. It was an
oversight in this commit (my fault):
https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commit;h=
2a99aa5d1910f1fd4855c8eb6751a26cbaa5e48d
To fix this change Execute() to check if the query is read only SELECT
before setting the flag.
Also add test to 006.memqcache.
Problem reported by and a test program provided by Achilleas Mantzios <a.mantzios@cloud.gatewaynet.com>.
Discussion: [pgpool-general: 9427] Clarification on query results cache visibility
https://www.pgpool.net/pipermail/pgpool-general/2025-April/009430.html
Backpatch-through: v4.2
Tatsuo Ishii [Mon, 5 May 2025 03:40:56 +0000 (12:40 +0900)]
Fix portability to OpenBSD.
- va_list is defined stdarg.h[0]
- pthread_t is defined in pthread.h / sys/types.h[1]
On OpenBSD sys/types.h doesn't suffice, so include pthread.h.
- LibreSSL has removed HMAC_CTX_init(), and has support for HMAC_CTX_new
since 2018. I've talked to Theo Buehler of LibreSSL and he said that he'd
prefer to simply remove the LIBRESSL_VERSION_NUMBER, but if desired by
upstream the LIBRESSL_VERSION_NUMBER should be 0x2070100fL.
- WIFEXITED is defined in sys/wait.h[2]
Author: Martijn van Duren (pgpool@list.imperialat.at)
Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2025-May/004583.html
Backpatch-through: v4.2
Bo Peng [Fri, 2 May 2025 06:54:38 +0000 (15:54 +0900)]
Add major version information to the configuration file.
Bo Peng [Thu, 1 May 2025 02:36:55 +0000 (11:36 +0900)]
Fix json_writer did not properly encode special characters.
Pgpool would crash when the watchdog was enabled if wd_authkey contained special characters (e.g., a backslash).
The patch was originally created by Martijn van Duren and revised by Bo Peng.
Bo Peng [Wed, 30 Apr 2025 11:06:28 +0000 (20:06 +0900)]
Update pgpool.spec to prevent RPM build errors.
Tatsuo Ishii [Sun, 27 Apr 2025 13:11:20 +0000 (22:11 +0900)]
Fix IPv6 in heatbeat process.
From Pgpool-II 4.6.0, heartbeat process can handle IPv6 receiver
sockets. However, the process does not work normally if IPv6 is
disabled in the system. Like Pgpool-II main process and PostgreSQL, I
think it should work normally if IPv4 is available.
Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2025-April/004579.html
Backpatch-through: 4.6
Tatsuo Ishii [Thu, 24 Apr 2025 10:11:43 +0000 (19:11 +0900)]
Doc: enhance the description on connection_life_time
connection_life_time is a config value to determine the life time of
cached connections to PostgreSQL backend. Current document lacks a
description that the expiration calculation is actually done at the
time when the client disconnects to the process which holds the cached
connections.
Discussion: [pgpool-hackers: 4577] Doc: enhance the description on connection_life_time
https://www.pgpool.net/pipermail/pgpool-hackers/2025-April/004578.html
Backpatch-through: v4.2
Tatsuo Ishii [Tue, 1 Apr 2025 06:45:40 +0000 (15:45 +0900)]
Test: skip inaccessible Unix socket directories.
Commit
182b65bfc allows to use multiple Unix socket directories: /tmp
and /var/run/postgresql. However if the system does not have
accessible /var/run/postgresql, pgpool_setup fails unless
$PGSOCKET_DIR is explicitly set. Instead of failing, this commit
allows pgpool_setup to skip inaccessible directories.
Backpatch-through: v4.5
Taiki Koshino [Thu, 27 Mar 2025 05:43:53 +0000 (14:43 +0900)]
Allow regression tests to use multiple socket directories.
Author: Bo Peng
Tested by Taiki Koshino
Backpatch-through: V4.5
Tatsuo Ishii [Wed, 5 Mar 2025 10:55:11 +0000 (19:55 +0900)]
Doc: enhance the explanation on sr_check_user.
It must be a superuser or in the pg_monitor group.
Backpatch-through: v4.2.
Tatsuo Ishii [Tue, 4 Mar 2025 12:27:34 +0000 (21:27 +0900)]
Fix sr check and health check to reopen pool_passwd upon reload.
The streaming replication check and health check process forgot to
reopen pool_passwd upon reload. If sr_check_passwd or
health_check_passwd is empty string, the password is obtained from
pool_passwd. Thus those process read outdated content of pool_passwd
upon reload.
Backpatch-through: v4.2
Bo Peng [Thu, 27 Feb 2025 07:09:05 +0000 (16:09 +0900)]
Update sample script comment.
Bo Peng [Thu, 27 Feb 2025 06:08:38 +0000 (15:08 +0900)]
Prepare 4.6.0
Bo Peng [Thu, 27 Feb 2025 06:04:25 +0000 (15:04 +0900)]
Doc: update release date
Bo Peng [Thu, 27 Feb 2025 04:27:44 +0000 (13:27 +0900)]
Doc: add release notes.
Bo Peng [Wed, 26 Feb 2025 12:59:18 +0000 (21:59 +0900)]
Remove pg_basebackup from the sample follow primary script.
If pg_rewind fails, the safest way for users is to recover manually.
Bo Peng [Wed, 19 Feb 2025 09:58:43 +0000 (18:58 +0900)]
Doc: update copyright
Bo Peng [Wed, 19 Feb 2025 09:01:08 +0000 (18:01 +0900)]
Prepare RC1
Bo Peng [Wed, 19 Feb 2025 08:57:05 +0000 (17:57 +0900)]
Doc: update installation document to 4.6
Bo Peng [Tue, 11 Feb 2025 13:52:04 +0000 (22:52 +0900)]
Prepare 4.6beta1
Bo Peng [Tue, 11 Feb 2025 04:35:39 +0000 (13:35 +0900)]
Disable AM_MAINTAINER_MODE.
Tatsuo Ishii [Mon, 10 Feb 2025 09:28:51 +0000 (18:28 +0900)]
Fix too many log lines produced by streaming replication check.
The process started to call
get_pg_backend_status_from_leader_wd_node() which unconditionally emits
log message:
LOG: received the get data request from local pgpool-II on IPC interface
LOG: get data request from local pgpool-II node received on IPC interface is forwarded to leader watchdog node
every sr_check_period seconds, which is annoying. To fix this, an elog
line in process_IPC_data_request_from_leader() is downgraded from LOG
to DEBUG1.
Reported-by: Bo Peng.