pgpool2.git
5 years agoDoc: fix document typos.
Bo Peng [Sun, 5 Apr 2020 16:10:37 +0000 (01:10 +0900)]
Doc: fix document typos.

Patch is provided by sherlockcpp@foxmail.com.

5 years agoMerge branch 'V3_6_STABLE' of ssh://git.postgresql.org/pgpool2 into V3_6_STABLE
Tatsuo Ishii [Wed, 11 Mar 2020 04:13:18 +0000 (13:13 +0900)]
Merge branch 'V3_6_STABLE' of ssh://git.postgresql.org/pgpool2 into V3_6_STABLE

5 years agoFix possible data inconsistency in native replication mode.
Tatsuo Ishii [Wed, 11 Mar 2020 04:05:43 +0000 (13:05 +0900)]
Fix possible data inconsistency in native replication mode.

There is a long standing bug with native replication mode. As reported
in pgpool-general, it is possible to lost sync of database if slave
DB's postgres process is killed. This is due to an oversight in
read_packets_and_process().

In replication mode if slave server's postgres is killed, then local
backend status is set to down.

*(my_backend_status[i]) = CON_DOWN;

So next DDL/DML in the same session is only issued to master node (and
other slave if there are multiple slave nodes). Of course this leads
to serious data inconsistency problem because in native replication
mode all DB nodes must receive DDL/DML at the same time.

Fix is triggering failover in thiscase.

Discussions:
https://www.pgpool.net/pipermail/pgpool-general/2020-March/006954.html
https://www.pgpool.net/pipermail/pgpool-hackers/2020-March/003540.html

5 years agoFix watchdog ping probes fail with long hostnames due to small buffer.
pengbo@sraoss.co.jp [Thu, 5 Mar 2020 22:49:14 +0000 (07:49 +0900)]
Fix watchdog ping probes fail with long hostnames due to small buffer.

per 516.

5 years agoUpdate copyright year.
Bo Peng [Sat, 22 Feb 2020 00:59:10 +0000 (09:59 +0900)]
Update copyright year.

5 years agoUpdate pgpool.spec file. V3_6_20 V3_6_20_RPM
Bo Peng [Wed, 19 Feb 2020 07:44:35 +0000 (16:44 +0900)]
Update pgpool.spec file.

5 years agoPrepare 3.6.20.
Bo Peng [Wed, 19 Feb 2020 06:38:44 +0000 (15:38 +0900)]
Prepare 3.6.20.

5 years agoDoc: Update doc version.
Bo Peng [Wed, 19 Feb 2020 06:24:56 +0000 (15:24 +0900)]
Doc: Update doc version.

5 years agoDoc: add release-notes.
Bo Peng [Wed, 19 Feb 2020 06:19:53 +0000 (15:19 +0900)]
Doc: add release-notes.

5 years agoFix rewriting query errors in native replication mode.
Bo Peng [Tue, 18 Feb 2020 08:43:23 +0000 (17:43 +0900)]
Fix rewriting query errors in native replication mode.

per bug551.

5 years agoDoc: clarify the session disconnection conditions while failover.
Tatsuo Ishii [Tue, 18 Feb 2020 01:28:39 +0000 (10:28 +0900)]
Doc: clarify the session disconnection conditions while failover.

5 years agoFix merge error in the previous commit.
Tatsuo Ishii [Sat, 8 Feb 2020 22:40:57 +0000 (07:40 +0900)]
Fix merge error in the previous commit.

5 years agoFix oversight to adopt PostgreSQL 12.
Tatsuo Ishii [Sat, 8 Feb 2020 10:39:14 +0000 (19:39 +0900)]
Fix oversight to adopt PostgreSQL 12.

From PostgreSQL 12 WAL dir is renamed to "pg_wal". pgpool_setup should
have dealt with this.

5 years agoFix error messsage typo
Takuma Hoshiai [Tue, 4 Feb 2020 03:00:27 +0000 (12:00 +0900)]
Fix error messsage typo

5 years agoDoc: fix doc typo.
Bo Peng [Tue, 4 Feb 2020 00:04:05 +0000 (09:04 +0900)]
Doc: fix doc typo.

5 years agoFeature: Check if socket file exists at startup and remove them if PID file doesn...
Bo Peng [Tue, 28 Jan 2020 06:20:46 +0000 (15:20 +0900)]
Feature: Check if socket file exists at startup and remove them if PID file doesn't exist.

If the previuos socket files exist, pgpool startup fails due to bind() failire.
This commit is to remove socket files at startup if PID file doesn't exist.

Also, I found some messages are effectively ignorede because log system is not yet initialized at start point.
I changed them to standard fprintf(stderr...).

5 years agoFix 001.load_balance failure caused by previous commit.
Tatsuo Ishii [Sat, 11 Jan 2020 11:49:29 +0000 (20:49 +0900)]
Fix 001.load_balance failure caused by previous commit.

5 years agoAttempt to fix 001.load_balance test failure.
Tatsuo Ishii [Fri, 10 Jan 2020 05:50:38 +0000 (14:50 +0900)]
Attempt to fix 001.load_balance test failure.

It is likely that sleep time after reload was not enough. Change them
from 1 second to 10 seconds.

5 years agoMore fix for occasional regression test 003.failover failure.
Tatsuo Ishii [Sat, 4 Jan 2020 01:30:22 +0000 (10:30 +0900)]
More fix for occasional regression test 003.failover failure.

Comparison between show pool_node result and expected file failed
because of replication delay (the expected file set 0 to replication
delay column.) Fix is, disabling replication delay.

5 years agoFix occasional regression test 003.failover failure.
Tatsuo Ishii [Tue, 31 Dec 2019 03:06:50 +0000 (12:06 +0900)]
Fix occasional regression test 003.failover failure.

The test compares the result of show pool_nodes against pre-computed
expected text file. After primary node goes down and old standby
promotes to primary, it is possible that streaming replication worker
process stores the replication state (async, streaming) in shared
memory before the failover but fails to update the state after the
failover. Fix is, replace "async", "streaming" with space characters
in the result file to match the expected file.

5 years agoFix occasional regression test failure of 008.dbredirect.
Tatsuo Ishii [Fri, 27 Dec 2019 00:13:59 +0000 (09:13 +0900)]
Fix occasional regression test failure of 008.dbredirect.

In the test several databases are created and subsequent tests expect
that those databases have been already replicated. But it is possible
that the replication has not been done at that point and makes the
test fails. Fix is, add check the existence of database and if it's
not replicated, sleep for a while and retry it (up to 5 times).

5 years agoFix occasional regression test failure of 008.dbredirect.
Tatsuo Ishii [Thu, 26 Dec 2019 05:13:08 +0000 (14:13 +0900)]
Fix occasional regression test failure of 008.dbredirect.

In the test pgbench -i is performed. It is possible that this bring
streaming replication delay, which in turn disturbs app/db
redirecting test. Fix is, disabling delay_threshold.

6 years agoFix replication delay worker segfault when application_name is an empty string.
Tatsuo Ishii [Thu, 12 Dec 2019 07:33:18 +0000 (16:33 +0900)]
Fix replication delay worker segfault when application_name is an empty string.

The process calls do_query() to obtain the query result against
pg_stat_replication_view.  If user sets application_name to an empty
string, the result data row packet length will be 0. However
do_query() did not consider the length == 0 case, which resulted in
giving NULL pointer to strcmp() which is called from the worker
process. That means the bug is not specific to this case (a new
feature added in Pgpool-II 4.1) but it potentially affects many other
places where do_query() gets called, although it had not been reported
in the field. So this fix should be applied to all supported branches.

Per bug 565.

6 years agoFix missing syslog setting. V3_6_19_RPM2
Bo Peng [Mon, 18 Nov 2019 09:06:36 +0000 (18:06 +0900)]
Fix missing syslog setting.

6 years agoPrepare 3.6.19-2.
Bo Peng [Mon, 18 Nov 2019 01:07:40 +0000 (10:07 +0900)]
Prepare 3.6.19-2.

6 years agoFix the missing syslog in configure file.
Bo Peng [Fri, 15 Nov 2019 07:39:50 +0000 (16:39 +0900)]
Fix the missing syslog in configure file.

per bug557.

6 years agoDoc: fix doc incorrect description. V3_6_19 V3_6_19_RPM
Bo Peng [Thu, 31 Oct 2019 00:54:59 +0000 (09:54 +0900)]
Doc: fix doc incorrect description.

6 years agoPrepare 3.6.19.
Bo Peng [Thu, 31 Oct 2019 00:33:20 +0000 (09:33 +0900)]
Prepare 3.6.19.

6 years agoDoc: update doc version.
Bo Peng [Thu, 31 Oct 2019 00:24:34 +0000 (09:24 +0900)]
Doc: update doc version.

6 years agoFix incorrect query rewrite in replication mode.
Bo Peng [Thu, 31 Oct 2019 00:11:03 +0000 (09:11 +0900)]
Fix incorrect query rewrite in replication mode.

6 years agoDoc: Add release-note.
Bo Peng [Wed, 30 Oct 2019 23:56:15 +0000 (08:56 +0900)]
Doc: Add release-note.

6 years agoAdd RHEL 8 support.
Bo Peng [Wed, 30 Oct 2019 09:10:04 +0000 (18:10 +0900)]
Add RHEL 8 support.

6 years agoFix incorrect query rewrite in replication mode.
Bo Peng [Fri, 25 Oct 2019 08:22:22 +0000 (17:22 +0900)]
Fix incorrect query rewrite in replication mode.
For example:
- CREATE TABLE t1 AS SELECT now();
- SELECT now() INTO t1;
- WITH ins AS ( INSERT INTO t1 SELECT now()) SELECT;

6 years agoDoc: add failover_command description
Takuma Hoshiai [Tue, 15 Oct 2019 09:39:30 +0000 (18:39 +0900)]
Doc: add failover_command description

Add more exaplain about a case that failover_command execute when it
does not have a new master node. In this case, special characters in
failover_command are specified fixed values.

6 years agoFix memory leaks pointed out by coverity.
Tatsuo Ishii [Tue, 15 Oct 2019 02:59:58 +0000 (11:59 +0900)]
Fix memory leaks pointed out by coverity.

6 years agoDoc: add note to trusted_servers.
Tatsuo Ishii [Fri, 11 Oct 2019 00:52:53 +0000 (09:52 +0900)]
Doc: add note to trusted_servers.

"Please note that you should not assign PostgreSQL servers to this
parameter." This should have been noted since there is at least one
user who actually did it.

6 years agoUpdate changelog.
Bo Peng [Thu, 10 Oct 2019 06:12:19 +0000 (15:12 +0900)]
Update changelog.

6 years agoUpdate pgpool.spec to support PostgreSQL 12.
Bo Peng [Thu, 10 Oct 2019 05:52:49 +0000 (14:52 +0900)]
Update pgpool.spec to support PostgreSQL 12.

6 years agoUpdate pgpool_socket_dir.patch.
Bo Peng [Thu, 10 Oct 2019 05:00:44 +0000 (14:00 +0900)]
Update pgpool_socket_dir.patch.

6 years agoFix assorted ancient v2 protocol bugs.
Tatsuo Ishii [Thu, 10 Oct 2019 01:01:08 +0000 (10:01 +0900)]
Fix assorted ancient v2 protocol bugs.

- In v2 code path, extract_message() pfrees memory which was returned
  from pool_read_string(). This is plain wrong and could cause sefault
  since the memory returned by it is being managed by pool_stream
  modules.

- In v2 code path pool_process_notice_message_from_one_backend() added
  "NOTICE:" to the log message. This is not necessary as the part is
  already included in the message.

- In v2 code path pool_extract_error_message() did not prepare unread
  data correctly. This caused subsequent
  pool_process_notice_message_from_one_backend() produces empty
  message, read_kind_from_backend() failure.

6 years agoFix extended query communication in do_query()
Takuma Hoshiai [Tue, 8 Oct 2019 07:02:20 +0000 (16:02 +0900)]
Fix extended query communication in do_query()

do_query() didn't send Describe message to PostgreSQL.
It didn't use strcasecmp() but strcasecmp() when check if query is SELECT.

6 years agoFix problem that syslog_facility don't change by reload
Takuma Hoshiai [Tue, 8 Oct 2019 04:09:20 +0000 (13:09 +0900)]
Fix problem that syslog_facility don't change by reload

The cause is macro definition mistake. This fix unify macro definition, and delete old test code to use vsyslog().
Reported in bug 548.

6 years agoFix inappropriate ereport call in VALID_BACKEND.
Tatsuo Ishii [Fri, 4 Oct 2019 04:52:19 +0000 (13:52 +0900)]
Fix inappropriate ereport call in VALID_BACKEND.

VALID_BACKEND (more precisely pool_virtual_master_db_node_id) macro
emitted message if pgpool is performing failover/failback:

ereport(WARNING,
(errmsg("failover/failback is in progress"),
errdetail("executing failover or failback on backend"),
 errhint("In a moment you should be able to reconnect to the database")));

This could be called within signal handlers and
POOL_SETMASK(&BlockSig)/POOL_SETMASK(&UnBlockSig) was called to block
an interrupt because ereport is not reentrant. However it is possible
that callers have already called POOL_SETMASK, and this could result
unwanted signal unblock.

Fix is, removing ereport and POOL_SETAMASK all together. This results
in removing the message above but we have no choice.

I found the problem while investigating regression
055.backend_all_down failure but of course the bug could have bitten
users in other places.

6 years agoFix for Coverity warnings in watchdog and lifecheck
Muhammad Usama [Thu, 3 Oct 2019 14:53:44 +0000 (19:53 +0500)]
Fix for Coverity warnings in watchdog and lifecheck

6 years agoFix signal unblock leak in failover.
Tatsuo Ishii [Thu, 3 Oct 2019 12:33:09 +0000 (21:33 +0900)]
Fix signal unblock leak in failover.

When failover event occurs, register_node_operation_request() gets
called to en-queue failover/failback requests. If the request queue is
full, this function returns false with unlocking semaphore. But it
forgot to unblock signal mask. This leads to block all signals
including SITERM, which makes pgpool fail to shutdown.

Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2019-October/003449.html

6 years agoFix for bug-545: Quorum lost and not recovered
Muhammad Usama [Sat, 28 Sep 2019 20:15:11 +0000 (01:15 +0500)]
Fix for bug-545: Quorum lost and not recovered

Master watchdog node was not adding the lost standby node to its list of valid
standby nodes after it is rediscovered by the lifecheck.The fix is to ask the
node to rejoin the master node when it gets rediscovered by the lifecheck. 
As part of this commit, I have also added the watchdog data version and Pgpool-II
version in the watchdog info packet to make the extensions in the watchdog
messages easier in the future.

Thanks to Guille(reporter of this bug), for providing lots of help in testing the fix

6 years agoFix memory leak in replication mode.
Tatsuo Ishii [Wed, 25 Sep 2019 05:22:21 +0000 (14:22 +0900)]
Fix memory leak in replication mode.

Per coverity.

6 years agoFix memory leak while attempting to connect to backend.
Tatsuo Ishii [Tue, 24 Sep 2019 23:49:48 +0000 (08:49 +0900)]
Fix memory leak while attempting to connect to backend.

If no backend is up and running, memory for copy of startup packet
will be lost. This was brought by commit cdb49d3b7. Per coverity.

6 years agoFix compiler warnings.
Tatsuo Ishii [Tue, 17 Sep 2019 23:07:27 +0000 (08:07 +0900)]
Fix compiler warnings.

6 years agoFix compiler warning.
Tatsuo Ishii [Tue, 17 Sep 2019 22:39:15 +0000 (07:39 +0900)]
Fix compiler warning.

6 years agoRevert "Fix occasional query hang while processing DEALLOCATE."
Tatsuo Ishii [Mon, 16 Sep 2019 22:21:57 +0000 (07:21 +0900)]
Revert "Fix occasional query hang while processing DEALLOCATE."

This reverts commit 8c9de6d06a5c975b1b1d820d486a312717d344d2.

6 years agoFix occasional query hang while processing DEALLOCATE.
Tatsuo Ishii [Mon, 16 Sep 2019 00:24:08 +0000 (09:24 +0900)]
Fix occasional query hang while processing DEALLOCATE.

When DEALLOCATE tries to remove a named statement, it inherits
where_to_send map of the named statement in
where_to_send_deallocate(). However it forgot to copy the load balance
node id in the query context of the named statement. This made sending
query to backend not happen: if the target node id is different from
query_context->load_balance_node_id nor primary node id,
pool_virtual_master_db_node_id (it is called as MASTER_NODE_ID)
returns primary node id, and pool_send_and_wait(MASTER_NODE_ID)
ignores the request because VALID_BACKEND returns false in this case
(MASTER_NODE_ID = primary node id is not in the where_to_send map). As
a result, following check_error() waits for response from backend in
vain.

Fix is, let where_to_send_deallocate() copy load balance node id from
the query context of the previous named statement.

Per bug 546.

6 years agoFix segfault in certain case.
Tatsuo Ishii [Sun, 15 Sep 2019 13:39:18 +0000 (22:39 +0900)]
Fix segfault in certain case.

The scenario is something like:

1) a named statement is created.
2) DEALLOCATE removes it.
3) an erroneous query is executed.

In #2, "sent message" for the named statement is removed but
"uncompleted_message" is left. Then after #3, in ReadyForQuery()
uncompleted_message is added and removed. However, storage for the
uncompleted_message has been already freed in #2, and it causes a
segfault.

Fix is, in SimpleQuery() set NULL to uncompleted_message if it's not
PREPARE command so that ReadyForQuery() does not try to remove the
already removed message.

Per bug 546.

Here is a minimum test case.

'P' "_plan0x7f2d465db530" "SELECT 1" 0
'S'
'Y'
'Q' "DEALLOCATE _plan0x7f2d465db530"
'Y'
'Q' "CREATE INDEX users_auth_id_index ON non_existing_table ( auth_id )"
'Y'
'X'

6 years agoFix identical code used for different branches per Coverity.
Tatsuo Ishii [Thu, 12 Sep 2019 04:40:05 +0000 (13:40 +0900)]
Fix identical code used for different branches per Coverity.

6 years agoFix memory leak per Coverity.
Tatsuo Ishii [Thu, 12 Sep 2019 04:39:41 +0000 (13:39 +0900)]
Fix memory leak per Coverity.

6 years agoFix typo in fork_lifecheck_child().
Tatsuo Ishii [Tue, 10 Sep 2019 06:54:13 +0000 (15:54 +0900)]
Fix typo in fork_lifecheck_child().

6 years agoFix typo in fork_watchdog_child().
Tatsuo Ishii [Tue, 10 Sep 2019 06:42:10 +0000 (15:42 +0900)]
Fix typo in fork_watchdog_child().

6 years agoFix memory leak.
Tatsuo Ishii [Fri, 6 Sep 2019 07:31:07 +0000 (16:31 +0900)]
Fix memory leak.

Per Coverity.

6 years agoFix memory leak.
Tatsuo Ishii [Fri, 6 Sep 2019 06:54:39 +0000 (15:54 +0900)]
Fix memory leak.

Per Coverity.

6 years agoFix uninitialized variable.
Tatsuo Ishii [Fri, 6 Sep 2019 06:24:09 +0000 (15:24 +0900)]
Fix uninitialized variable.

Probably harmless but bug is bug...
Per Coverity.

6 years agoDoc: mention that VIP will not be brougt up if quorum does not exist.
Tatsuo Ishii [Tue, 3 Sep 2019 22:45:17 +0000 (07:45 +0900)]
Doc: mention that VIP will not be brougt up if quorum does not exist.

6 years agoFix pgpool_setup to reflect the -p (baseport) to ORIGBASEPORT variable.
Tatsuo Ishii [Sun, 1 Sep 2019 02:38:35 +0000 (11:38 +0900)]
Fix pgpool_setup to reflect the -p (baseport) to ORIGBASEPORT variable.

Otherwise, shutdown generated script by pgpool_setup does not use
proper port number for netstat command.

6 years agoDoc: Fix missing documents from previous commit.
Bo Peng [Mon, 26 Aug 2019 07:03:11 +0000 (16:03 +0900)]
Doc: Fix missing documents from previous commit.

6 years agoDoc: fix indentation in scripts.
Tatsuo Ishii [Sun, 25 Aug 2019 02:37:35 +0000 (11:37 +0900)]
Doc: fix indentation in scripts.

Auto indentation by commit 2cb0bd3f8f236aeacfba37cd4d604893561bad52
broke indentation of scripts in <programlisting> tag.

6 years agoDoc: fix typo in "What is Pgpool-II?" section.
Tatsuo Ishii [Sun, 25 Aug 2019 01:15:37 +0000 (10:15 +0900)]
Doc: fix typo in "What is Pgpool-II?" section.

Author: Alejandro Roman
Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2019-August/003392.html

6 years agoAdd "-I" option to "arping_cmd" command default setting.
Bo Peng [Fri, 16 Aug 2019 02:51:36 +0000 (11:51 +0900)]
Add "-I" option to "arping_cmd" command default setting.

6 years agoDoc: run auto indent using emacs.
Tatsuo Ishii [Thu, 15 Aug 2019 22:38:42 +0000 (07:38 +0900)]
Doc: run auto indent using emacs.

Here is the emacs script F.Y.I.

;; must be run by emacs
(load "/home/t-ishii/.emacs.d/init.el")
(find-file (nth 0 command-line-args-left));
(indent-region (point-min) (point-max));
(save-buffer)

6 years agoDoc: udpate doc version. V3_6_18 V3_6_18_RPM
Bo Peng [Thu, 15 Aug 2019 07:59:02 +0000 (16:59 +0900)]
Doc: udpate doc version.

6 years agoDoc: fix incorrect link name.
Bo Peng [Thu, 15 Aug 2019 04:53:54 +0000 (13:53 +0900)]
Doc: fix incorrect link name.

6 years agoPrepare 3.6.18.
Bo Peng [Thu, 15 Aug 2019 04:39:50 +0000 (13:39 +0900)]
Prepare 3.6.18.

6 years agoDoc: update release-note.
Bo Peng [Thu, 15 Aug 2019 04:30:58 +0000 (13:30 +0900)]
Doc: update release-note.

6 years agoDoc: add 3.6.18-3.4.25 release-note.
Bo Peng [Thu, 15 Aug 2019 01:29:44 +0000 (10:29 +0900)]
Doc: add 3.6.18-3.4.25 release-note.

6 years agoFix memory leak.
Tatsuo Ishii [Wed, 14 Aug 2019 00:14:36 +0000 (09:14 +0900)]
Fix memory leak.

Pointed out by Coverity.

6 years agoMake waiting for TIME_WAIT in pgpool_setup optional.
Tatsuo Ishii [Thu, 8 Aug 2019 02:38:02 +0000 (11:38 +0900)]
Make waiting for TIME_WAIT in pgpool_setup optional.

Since commit 3b32bc4e583da700cc8df7c5777e90341655ad3b the shutdownall
script generated by pgpool_setup waits for Pgpool-II socket in
TIME_WAIT state disappeared. However in most cases this takes long
time and it makes uncomfortable for developer's testing works.

This commit makes the wait to be optional: unless environment variable
"CHECK_TIME_WAIT" is set to other than "false", it never waits for the
TIME_WAIT state.

6 years agoFix "unable to bind. cannot get parse message" error.
Tatsuo Ishii [Fri, 9 Aug 2019 08:04:28 +0000 (17:04 +0900)]
Fix "unable to bind. cannot get parse message" error.

This was caused by too-eager memory free in parse_before_bind. It
called
pool_remove_sent_message/pool_create_sent_message/pool_add_sent_message
combo to replace the query context in the sent message. Unfortunately
pool_remove_sent_message free memory such as statement name, which was
being passed by caller. As a result, the new sent message created by
pool_create_sent_message pointed to freed statement name, which may
make a search by statement name fail because now the statement name in
the sent message points to freed memory area, which might be
overwritten by later memory allocation. Fix is, instead of calling
pool_remove_sent_message etc., just replace the query context in the
sent message.

Per bug 531.

6 years agoFix for 0000483: online-recovery is blocked after a child process exits ...
Muhammad Usama [Thu, 8 Aug 2019 13:59:13 +0000 (18:59 +0500)]
Fix for 0000483: online-recovery is blocked after a child process exits ...

The problem is if some child process exits abnormally during the second stage
of online recovery, then the connection counter that keeps the track of exiting
processes does not get decremented and Pgpool-II keeps waiting for the exit of
the already exited process. Eventually, the recovery fails after
client_idle_limit_in_recovery expires.

The fix for this issue is to set the connection counter to zero when
client_idle_limit_in_recovery is enabled and it has less value than
recovery_timeout, Since all clients must have been kicked out by the time
when client_idle_limit_in_recovery expires.

A similar fix is already committed as part of bug 431 by Tatsuo Ishii, So this
commit basically imports the same logic in the watchdog function that processes
the remote online recovery requests.

Apart from the above-mentioned change,  Hoshiai San identified that the watchdog
IPC command timeout for the online recovery start function executed through watchdog
is set exactly to the same as recovery_timeout which needs to be increased to
make the solution work correctly.

6 years agoImport some of memory manager debug facilities from PostgreSQL.
Tatsuo Ishii [Thu, 8 Aug 2019 02:02:50 +0000 (11:02 +0900)]
Import some of memory manager debug facilities from PostgreSQL.

Now we can use CLOBBER_FREED_MEMORY, which is useful to detect
accesses to already pfreed memory.

6 years agoFix watchdog_setup command option
Takuma Hoshiai [Mon, 29 Jul 2019 06:09:45 +0000 (15:09 +0900)]
Fix watchdog_setup command option

The mode option is incorrectly. when pgpool_setup command  is called by
watchdog_setup command, mode option forget to set.

6 years agoFix pgpool_setup to produce correct follow master command.
Tatsuo Ishii [Sun, 28 Jul 2019 02:11:07 +0000 (11:11 +0900)]
Fix pgpool_setup to produce correct follow master command.

The produced script incorrectly checked whether PostgreSQL is running
or not, which resulted in that it mistakenly thought PostgreSQL is
always running.

6 years agoFix regression test errors.
Bo Peng [Thu, 25 Jul 2019 00:19:53 +0000 (09:19 +0900)]
Fix regression test errors.

6 years agoUse pg_get_expr() instead of pg_attrdef.adsrc to support for PostgreSQL 12.
Bo Peng [Wed, 24 Jul 2019 12:19:26 +0000 (21:19 +0900)]
Use pg_get_expr() instead of pg_attrdef.adsrc to support for PostgreSQL 12.

Since PostgreSQL 12 removed pg_attrdef.adsrc, use pg_get_expr() instead of pg_attrdef.adsrc if the backend version is 7.3 or later.

Thanks to Takuma Hoshiai for creating the patch.

6 years agoFix the failover() so that it does not access out of array.
Tatsuo Ishii [Wed, 17 Jul 2019 07:51:31 +0000 (16:51 +0900)]
Fix the failover() so that it does not access out of array.

Per Coverity.

6 years agoEnhance shutdown script of pgpool_setup.
Tatsuo Ishii [Wed, 17 Jul 2019 07:48:37 +0000 (16:48 +0900)]
Enhance shutdown script of pgpool_setup.

I observe occasional regression test failure caused by bind error to
the TCP/IP port.  This fix tries to confirm usage of the TCP/IP port
while executing shutdown script using netstat command.

6 years agoBackport Pgversion().
Tatsuo Ishii [Tue, 16 Jul 2019 06:21:10 +0000 (15:21 +0900)]
Backport Pgversion().

6 years agoFix possible out of array index access.
Tatsuo Ishii [Sun, 7 Jul 2019 13:58:35 +0000 (22:58 +0900)]
Fix possible out of array index access.

It was pointed out by Coverity that node_id could be -1.

6 years agoFix query cache module so that it checks oid array's bound.
Tatsuo Ishii [Sun, 7 Jul 2019 01:09:25 +0000 (10:09 +0900)]
Fix query cache module so that it checks oid array's bound.

6 years agoFix off-by-one error in query cache module.
Tatsuo Ishii [Sat, 6 Jul 2019 23:08:25 +0000 (08:08 +0900)]
Fix off-by-one error in query cache module.

When debug print is enabled, it might had tried to access out of bound
of oid array.

6 years agoRevert "Allow health check process to reload pgpool.conf."
Tatsuo Ishii [Fri, 5 Jul 2019 21:46:36 +0000 (06:46 +0900)]
Revert "Allow health check process to reload pgpool.conf."

This reverts commit cc06f5c142b3ff0f6bfbd87ca7a06094a0ce9b5c.

Since 3.6 does not have separate health check process, the commit was
pointless and caused compiling errors.

6 years agoAllow health check process to reload pgpool.conf.
Tatsuo Ishii [Fri, 5 Jul 2019 05:32:43 +0000 (14:32 +0900)]
Allow health check process to reload pgpool.conf.

When separate health check process was introduced, we forgot to send
signal to the health check process when pgpool.conf reload is
requested.

6 years agoBug525: Fix sefault when query cache is enabled.
Tatsuo Ishii [Wed, 3 Jul 2019 03:59:11 +0000 (12:59 +0900)]
Bug525: Fix sefault when query cache is enabled.

When query cache is enabled,
session_context->query_context->skip_cache_commit flag was set or
reset while processing execute message. Problem was, it was done
before session_context->query_context was set. So fix is just
set/reset
query_context->skip_cache_commit. session_context->query_context is
set later on anyway.

Per bug 525.

6 years agoMake shutdownall to wait for completion of shutdown of Pgpool-II.
Tatsuo Ishii [Tue, 2 Jul 2019 09:40:11 +0000 (18:40 +0900)]
Make shutdownall to wait for completion of shutdown of Pgpool-II.

It was observed that regression test occasionally failed because
previous does not completely finished before next test started. To fix
the problem, make shutdownall script generated by pgpool_setup to wait
for completion of shutdown of Pgpool-II.

6 years agoDown grade LOG to DEBUG5 in sent message module.
Tatsuo Ishii [Tue, 2 Jul 2019 00:08:57 +0000 (09:08 +0900)]
Down grade LOG to DEBUG5 in sent message module.

The log was added in commit 56a6b6a72, but in some cases it is
disturbing users.

Discussion: [pgpool-general: 6620] Fwd: A lot of "checking zapping sent message" in log

6 years agoFix mistake introduced in the previous commit.
Tatsuo Ishii [Mon, 24 Jun 2019 13:13:18 +0000 (22:13 +0900)]
Fix mistake introduced in the previous commit.

6 years agoFix segfault when "samenet" is specified in pool_hba.conf.
Tatsuo Ishii [Mon, 24 Jun 2019 01:57:34 +0000 (10:57 +0900)]
Fix segfault when "samenet" is specified in pool_hba.conf.

When "samenet" is specified, SockAddr_cidr_mask(struct
sockaddr_storage *mask, char *numbits, int family) gets called with
numbits == NULL. However the function was not prepared for
it. Originally the function was imported from PostgreSQL. When the bug
was fixed in PostgreSQL, unfortunately the fix was not applied to
Pgpool-II. This commit applies the same fix as PostgreSQL.

Discussion: [pgpool-general: 6601] Pgpool-II + hba + samenet = segfault in libc-2.24.so

6 years agodoc: Fix documentation typos.
Bo Peng [Thu, 20 Jun 2019 03:53:40 +0000 (12:53 +0900)]
doc: Fix documentation typos.

6 years agodoc: Fix documentation typo.
Bo Peng [Wed, 19 Jun 2019 02:04:47 +0000 (11:04 +0900)]
doc: Fix documentation typo.

6 years agoFix to deal with backslashes according to the config of standard_conforming_strings
Bo Peng [Fri, 7 Jun 2019 08:19:37 +0000 (17:19 +0900)]
Fix to deal with backslashes according to the config of standard_conforming_strings
in native replication mode.

per bug467.

6 years agoDoc: add description to pg_md5 man page how to show pool_passwd ready string.
Tatsuo Ishii [Sun, 2 Jun 2019 02:40:40 +0000 (11:40 +0900)]
Doc: add description to pg_md5 man page how to show pool_passwd ready string.

Sometimes it is necessary to just show md5 hash string suitable for
pool_passwd, without adding an entry to pool_passwd.

6 years agoDoc: add general description about failover.
Tatsuo Ishii [Sun, 26 May 2019 04:23:33 +0000 (13:23 +0900)]
Doc: add general description about failover.

6 years agoMake failover in progress check more aggressively.
Tatsuo Ishii [Wed, 22 May 2019 22:34:03 +0000 (07:34 +0900)]
Make failover in progress check more aggressively.

In pool_virtual_master_db_node_id() the case when session context is
not available was not covered by the failover in progress checking
because I thought it'd be too aggressive. However a report from field
showed that that could happen while authenticating a client (and it
causes a segfault). So I decided to move the check to beginning of the
function to cover the case.