summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
44 hoursFix resource leak while reading startup packet.HEADmasterTatsuo Ishii
Per Coverity. Backpatch-through: v4.2
44 hoursFix double pfree in 1b63aeb31.Tatsuo Ishii
By an oversight, the commit could bring a double pfree situation.
3 daysAdd a48d72c16 to .git-blame-ignore-revs.Tatsuo Ishii
3 daysFix indentation.Tatsuo Ishii
Fix indentation by running pgindent.
3 daysFix coding issue regarding shift operation.Tatsuo Ishii
Per Coverity.
3 daysFix memory leak.Tatsuo Ishii
Fix resource leak in pool_push_pending_data pointed out by Coverity. Backpatch-through: v4.2
4 daysAdd .git-blame-ignore-revs.Tatsuo Ishii
.git-blame-ignore-revs lists commits to be ignored by git blame command. Any indentation fix commit using pgindent should be added to the file. How to add an entry to the file is explained in the beginning of the file. Also add 468573ad3 to the file as the first entry.
4 daysRun pgindent.Tatsuo Ishii
4 daysFix method to run pgindent.Tatsuo Ishii
Commit fd190f7ea imported pgindent but the method explained in README.pgpool was wrong. typedefs.list can be generated by using PostgreSQL's find_typedef. So import find_typedef and remove unnecessary files. Proper way to run pgindent is explained in README.pgpool.
4 daysFeature: Make online recovery database configurableBo Peng
Prior to version 4.6, the online recovery database was hardcoded to "template1". This commit introduces a new configuration parameter, "recovery_database", which allows users to specify the database used for online recovery. The default value is "postgres".
5 daysDoc: Fix example script link at master.Taiki Koshino
Modified the sample script in the section "8.2. Pgpool-II + Watchdog Setup Example"
6 daysFeature: implement protocol version 3.2 BackendKeyData and query cancel message.Tatsuo Ishii
Starting from PostgreSQL 18, frontend/backend protocol has been changed to 3.2. In the changes the BackendKeyData and query cancel message are modified to allow variable length cancel key. This commit implements the changes and now we can connect to PostgreSQL frontend and backend using 3.2 protocol. Example session is: PGMAXPROTOCOLVERSION="3.2" psql -p 11000 test Author: Tatsuo Ishii <ishii@postgresql.org> Discussion: https://www.postgresql.org/message-id/20250714.155710.1706961744888449986.ishii%40postgresql.org
6 daysFix bug with pcp_proc_info.Tatsuo Ishii
When pcp_proc_info was invoked without "-v" option, pcp_proc_info did not print the "statement" field. This was due to oversight in the frontend side of the command: forgot to add one more format siring "%s". This bug was in only master branch: when some new fields were added to pcp_proc_info. Reported-by: Bo Peng <pengbo@sraoss.co.jp> Author: Tatsuo Ishii <ishii@postgresql.org>
6 daysDoc: fix documentation for enum parameters reported as stringsTaiki Koshino
Fix documentations for 6 parameters. Japanese docs too. "log_standby_delay" "log_backend_messages" "wd_lifecheck_method" "memqcache_method" "disable_load_balance_on_write" "backend_clustering_mode"
6 daysDoc: fix documentation for parameters that are not reflected by reload.Taiki Koshino
"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.
10 daysImport pgindent.Tatsuo Ishii
Import PostgreSQL's pgindent. This commit not only imports PostgreSQL's pgindent, but generates the important file: typedefs.list. For this purpose followings are added: - README.pgpool: How to generate typedefs.list. - doxygen.list: Pgpool-II's typedefs extracted by doxygen. Plus manually added typedefs that were not detected by doxygen. - enums.list: Pgpool-II's enums manually extracted from source code. - exclude_files: files that should not be touched pgindent. - run_pgindent: handy script to run pgindent. Should be run at src directory. - typedefs.list.PostgreSQL: PostgreSQL's typedefs. To prepare for that doxygen misses some typedefs. - make_typedefs.list: handy script to generate typedefs.list.
12 daysFeature: implement NegotiateProtocolVersion message.Tatsuo Ishii
Implementing the message is necessary when frontend requests the protocol version 3.2 (i.e. PostgreSQL 18+ or compatible clients), while backend still only supports 3.0 (i.e. backend is PostgreSQL 17 or before). This commit handles the message so that the message is forwarded from backend to frontend when there's no connection cache exists. If connection cache exists, pgpool sends the message, which has been saved at the time when the connection cache was created, to frontend. Note that the frontend/backend protocol 3.2 changes the BackendKeyData message format, but it's not implemented in this commit yet. This means that still pgpool cannot handle 3.2 protocol. Discussion: https://www.postgresql.org/message-id/20250708.112133.1324153277751075866.ishii%40postgresql.org
2025-06-30Fix broken scram-sha-256 authentication on big-endian machies.Bo Peng
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
2025-06-27Test: more fix to 038.pcp_commands regression test.Tatsuo Ishii
Commit 04e09df17 was not enough fix. The test calls pcp_proc_info() pgpool_adm function along with user name and password (in the test password is the same string as user name). Problem is, the user name is obtained from a user name that runs the test, and we use psql -a to submit the SQL, which prints the user name. Of course the user name can vary depending on the environment, and it makes the test fail. To fix the issue, run psql without -a option.
2025-06-25Test: fix 038.pcp_commands regression test.Tatsuo Ishii
The result of the test showed local host IP. Although the IP can be either IPv4 or IPv6, the test script hadn't considered it. To fix this, now test.sh converts IPv4 and IPv6 IP to "localhost".
2025-06-24Feature: add pgpool_adm_pcp_proc_info.Tatsuo Ishii
This commit adds new pgpool_adm extension function: pcp_proc_info. Also add new fields: client_host, client_port and SQL statement to pcp_proc_info and "show pool_pools". With these additions now it is possible to track the relationship among clients of pgpool, pgpool itself and PostgreSQL. Moreover the commit allows to know what commands (statements) are last executed by using pcp_proc_info. Previously it was not possible unless looking into the pgpool log. lipcp.so version is bumped from 2.0 to 2.1.
2025-06-23Fix source code typos.Bo Peng
2025-06-18Doc: fix load balance explanation missed logical replication mode.Tatsuo Ishii
Backpatch-through: v4.2
2025-06-18Doc: enhance pcp_node_info document.Bo Peng
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".
2025-06-14Enhance lifecheck log.Tatsuo Ishii
Previously when wd_lifecheck_method = 'query', life checking prints SQL without application name if "%a" is specified in log_line_prefix. This commit add application_name "lifecheck_ping" to make the log looks better. Since this changes user visible behavior, I do not apply this to stable branches. Discussion: [pgpool-hackers: 4603] life check log is not nice https://www.pgpool.net/pipermail/pgpool-hackers/2025-June/004604.html
2025-06-14Fix heartbeat device treatment.Tatsuo Ishii
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
2025-06-14Fix resource leak in hearbeat receiver process.Tatsuo Ishii
Pointed out by Coverity. Backpatch-through: v4.6
2025-06-14Remove or downgrade inappropriate log messages at pgpool startup.Tatsuo Ishii
- Log regarding total shared memory allocation size was redundant. - Other logs were too verbose and downgraded to DEBUG1.
2025-06-13Enhance connecting process to backend.Tatsuo Ishii
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
2025-06-09Fix heartbeat_device treatment.Tatsuo Ishii
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
2025-06-08Test: stabilize 029.cert_passphrase regression test.Tatsuo Ishii
When ssl_passphrase_command is not valid, the error message is typically "bad decrypt" but it seems sometimes "wrong tag".
2025-06-08Doc: add section of kernel resources.Tatsuo Ishii
Pgpool-II uses System V shared memory and semaphores. It's better to describe the requirements in the docs. Backpatch-through: v4.2
2025-06-07Doc: add description for --with-ldap option of configure.Tatsuo Ishii
It was missed when LDAP support was introduced in v4.2 Backpatch-through: v4.2
2025-06-06Replace random() with pg_prng random function.Tatsuo Ishii
Previously we used random() for choosing load balancing node. However PostgreSQL has better random number generator: pg_prng.c. This commit imports the file and use pg_prng_double() to generate random number in range [0.0, 1.0). The seed is generated using pg_strong_random(). Other notes regarding the port: - Some of functions in the file were not ported because they require additional library: pg_bitutils.c. In the future we may revisit and import pg_bitutils.c. - All conditional compiling regarding "sun" or "_sun" are removed. It seems the platform is not used for running pgpool anymore. - Since srandom() is not necessary any more, related code are removed from pgpool_main.c, child.c and pcp_worker.c. Author: Martijn van Duren <pgpool@list.imperialat.at>, Tatsuo Ishii <ishii@postgresql.org> Discussion: [pgpool-hackers: 4588] Shuffle random functions and use better random numbers https://www.pgpool.net/pipermail/pgpool-hackers/2025-May/004589.html
2025-06-05Fix heartbeat receiver not working.Tatsuo Ishii
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
2025-06-05Doc: fix command in "8.2. Pgpool-II + Watchdog Setup Example" to escape $PGDATA.Bo Peng
2025-06-04Doc: clarify supported platforms for Pgpool-II.Tatsuo Ishii
Backpatch-through: v4.2
2025-06-04Enhance log message in creating watchdog receive socket.Tatsuo Ishii
This is a follow up commit to: cea80281d Retry bind on watchdog receive socket. Use getnameinfo() so that log messages contain hostname, rather just "TCP".
2025-06-03Doc: enhance child_life_time document.Tatsuo Ishii
Backpatch-through: v4.2
2025-06-03Retry bind on watchdog receive socket.Tatsuo Ishii
Occasionally 028.watchdog_enable_consensus_with_half_votes times out due to failure on binding watchdog receive socket. This commit tries to mitigate the issue by retrying bind. Currently the retry is performed up to 5 times and each retry is with 1 second sleep.
2025-06-02Fix typo in pgpool.conf.Tatsuo Ishii
Backpatch-through: v4.3
2025-05-29Doc: add release note.Bo Peng
2025-05-28Import likely/unlikely from PostgreSQL.Tatsuo Ishii
These macros are not only useful to enhance performance (if correctly used) but make porting codes from PostgreSQL to pgpool easier since the macros occasionally used in the code. Discussion: [pgpool-hackers: 4599] Porting likely/unlikely https://www.pgpool.net/pipermail/pgpool-hackers/2025-May/004600.html
2025-05-27Revert "Replace random() with pg_prng random function."Tatsuo Ishii
This reverts commit 66fcd561d74c8f00326bad94300053bd7ea13566. It was accidentally committed.
2025-05-27Fix watchdog receive socket creation without IPv6.Tatsuo Ishii
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
2025-05-21Replace random() with pg_prng random function.Tatsuo Ishii
Previously we used random() for choosing load balancing node. However PostgreSQL has better random number generator: pg_prng.c. This commit imports the file and use pg_prng_double() to generate random number in range [0.0, 1.0). Other notes regarding the port: - pg_prng needs to be initialized using pg_prng_strong_seed() per process. Currently the only caller is child.c (per session process). If other process needs to use pg_prng, it needs the same initialization as child.c. - Some of functions in the file were not ported because they require additional library: pg_bitutils.c. In the future we may revisit and import pg_bitutils.c. - likely/unlikely are ignored. In the future we may revisit import them. - All conditional compiling regarding "sun" or "_sun" are removed. It seems the platform is not used for running pgpool anymore. - Since srandom() is not necessary any more, related code are removed from pgpool_main.c, child.c and pcp_worker.c. Discussion: [pgpool-hackers: 4588] Shuffle random functions and use better random numbers https://www.pgpool.net/pipermail/pgpool-hackers/2025-May/004589.html
2025-05-20Fix oversight in pg_strong_random commit.Tatsuo Ishii
In the commit I forgot to test without SSL case, which requires to include <errno.h>. Author: Bo Peng <pengbo@sraoss.co.jp>
2025-05-20Replace PostmasterRandom() with pg_strong_random().Tatsuo Ishii
Our PostmasterRandmon() was imported from PostgreSQL long time ago (in 2016). In the same year PostgreSQL replaced PostmasterRandmon() with pg_strong_random()(src/port/pg_strong_random.c). This commit follows it. pg_strong_random() looks better than PostmasterRandmon(), since it's more secure and portable. Moreover no initialization is necessary. Reviewed-by: Martijn van Duren <pgpool@list.imperialat.at> Discussion: [pgpool-hackers: 4588] Shuffle random functions and use better random numbers https://www.pgpool.net/pipermail/pgpool-hackers/2025-May/004589.html
2025-05-17Suppress unnecessary information upon authentication failure.Tatsuo Ishii
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
2025-05-15Allow pcp clients to connect to IPv6 addresses.Tatsuo Ishii
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