pgpool2.git
6 years agodoc: Add release-note.
Bo Peng [Tue, 30 Oct 2018 01:32:37 +0000 (10:32 +0900)]
doc: Add release-note.

6 years agoFix typo in child_max_connections description.
Tatsuo Ishii [Thu, 25 Oct 2018 10:58:34 +0000 (19:58 +0900)]
Fix typo in child_max_connections description.

Patch provided by Phil Ramirez.

6 years agoFix segmentation fault, when client send sync message in native replication mode.
Takuma Hoshiai [Mon, 22 Oct 2018 08:24:18 +0000 (17:24 +0900)]
Fix segmentation fault, when client send sync message in native replication mode.

When the query to be executed does not exist, if client sent 'Sync' messages to Pgpool-II which in native replication mode, occurred segmentation fault.

See:
https://www.pgpool.net/mantisbt/view.php?id=434
for more details.

6 years agoFix syntax error in native replication, when queries including now() etc. and "IN...
Bo Peng [Thu, 18 Oct 2018 09:12:24 +0000 (18:12 +0900)]
Fix syntax error in native replication, when queries including now() etc. and "IN (SELECT ...)" in WHERE clause.

In native replication, queries including now() etc. are rewritten to a timestamp constant value.
However, Pgpool-II didn't support queries including now() etc. and "IN (SELECT ...)" in WHERE clause.

Per bug433.

6 years ago Change pgpool.spec file to install extension to server which supports LLVM JIT.
Bo Peng [Thu, 18 Oct 2018 08:51:13 +0000 (17:51 +0900)]
 Change pgpool.spec file to install extension to server which supports LLVM JIT.

6 years agoFix occasional less data returned to frontend.
Tatsuo Ishii [Fri, 12 Oct 2018 04:52:57 +0000 (13:52 +0900)]
Fix occasional less data returned to frontend.

While piggy-packing queries to system catalog data,
pool_push_pending_data() is responsible for pushing response from
backend. To judge whether pending data remains or not, it checks
socket fd of backend and dummy close message response (close
complete). Problem is, if the socket is not ready and accidentally
actual (non dummy) close message response is returned,
pool_push_pending_data() believes that there's no pending data any
more. As a result, some of pending data is not recovered after
returning to normal process.

The idea for fix is, use pending message data list. It records
messages from frontend, and it is expected that we will receive same
number of messages (or more -- e.g. execute message). So we can use
the data to make above judgment more robust for the case described
above.

Initial patch is created by Yugo Nagata. Fix to the patch for certain
cases by me.

See:
https://www.pgpool.net/mantisbt/view.php?id=432
for more details.

6 years agoFix memory leak when query cache enabled in streaming replication mode + extended...
Tatsuo Ishii [Thu, 11 Oct 2018 08:52:57 +0000 (17:52 +0900)]
Fix memory leak when query cache enabled in streaming replication mode + extended query case.

If BEGIN is executed in extended protocol, allocated temp buffer for
the command never discarded.  This is because in streaming replication
mode + extended query case, when handle_query_cache gets called at the
command complete timing, the reference counter to query context is not
0, which in turn prevents from calling
pool_discard_temp_query_cache().

In reality, we don't need to care about the query context here, so
let's proceed in streaming replication mode + extended query case.

Note that the memory leak case can be easily reproduced by "pgbench -M
extended" command (standard TPC-B).

6 years agodoc: add note to online recovery doc.
Tatsuo Ishii [Wed, 10 Oct 2018 04:05:39 +0000 (13:05 +0900)]
doc: add note to online recovery doc.

This warns that client_idle_limit_in_recovery must be smaller than
recovery_timeout.

6 years agoFix memory leak pointed out by Coverity.
Tatsuo Ishii [Tue, 9 Oct 2018 08:37:25 +0000 (17:37 +0900)]
Fix memory leak pointed out by Coverity.

6 years agoFix memory leak in trigger_failover_command.
Tatsuo Ishii [Tue, 9 Oct 2018 04:49:49 +0000 (13:49 +0900)]
Fix memory leak in trigger_failover_command.

Pointed out by Coverity.

6 years agoFix memory leak when memory_cache_enabled = on and write SQLs are sent.
Bo Peng [Tue, 9 Oct 2018 00:22:31 +0000 (09:22 +0900)]
Fix memory leak when memory_cache_enabled = on and write SQLs are sent.

In a explicit transaction, we the SELECT results are cached in temporary buffer.
If a write SQL is sent which modifies the table, the temporary buffe should be reset.

6 years agoFix occasional failure in regression 065.bug152.
Tatsuo Ishii [Mon, 8 Oct 2018 22:50:03 +0000 (07:50 +0900)]
Fix occasional failure in regression 065.bug152.

In the test first create a table with some data, then query
it. However sometimes it seems replication delay causes the table
still not ready in standby. Since there's no reason we need to a
standby or slave for this particular test, let the test have only
primary/master.

7 years agoFix to add execution permission.
Tatsuo Ishii [Mon, 24 Sep 2018 07:25:06 +0000 (16:25 +0900)]
Fix to add execution permission.

The regression 071 script lacked execution permission.

7 years agoAdd EXECUTE/DEALLOCATE regression test.
Bo Peng [Fri, 21 Sep 2018 08:32:30 +0000 (17:32 +0900)]
Add EXECUTE/DEALLOCATE regression test.

Patch created by Takuma Hoshiai.

7 years agoAdd missing pgpool_recovery--1.0--1.1.sql file to update pgpool_recovery() function...
Bo Peng [Wed, 19 Sep 2018 00:25:31 +0000 (09:25 +0900)]
Add missing pgpool_recovery--1.0--1.1.sql file to update pgpool_recovery() function version to 1.1.

7 years agoFix kind mismatch error when DEALLOCATE statement is issued.
Bo Peng [Thu, 13 Sep 2018 08:30:58 +0000 (17:30 +0900)]
Fix kind mismatch error when DEALLOCATE statement is issued.

PREPARE should be add to pool_add_sent_message, so that EXECUTE and DEALLOCATE
can be sent to the same node as PREPARE.

See [pgpool-general: 6226] for more details.

7 years agoAdd regression test for SSL connection.
Tatsuo Ishii [Wed, 29 Aug 2018 02:58:36 +0000 (11:58 +0900)]
Add regression test for SSL connection.

This tests SSL connection between frontend <--> Pgpool-II and
Pgpool-II <--> backend.

7 years agoDo not update pgpool_passwd if the password length is incorrect.
Tatsuo Ishii [Mon, 27 Aug 2018 06:16:17 +0000 (15:16 +0900)]
Do not update pgpool_passwd if the password length is incorrect.

For Pgpool-II 3.7 or before, the password stored in pool_passwd is MD5
password only.  So check the correctness of pool_passwd by scanning
entire file.

Patch created by Takuma Hoshiai. Minor error message tweak by me.
See bug425 for more details.

7 years agoUpdate copyright year.
Tatsuo Ishii [Wed, 22 Aug 2018 07:09:19 +0000 (16:09 +0900)]
Update copyright year.

7 years agoAdd notes regarding failover script.
Tatsuo Ishii [Wed, 22 Aug 2018 07:01:21 +0000 (16:01 +0900)]
Add notes regarding failover script.

It's not recommended to access against Pgpool-II itself from
failover/failback scripts.

7 years agoAdd .gitignore to doc and doc.ja.
Bo Peng [Mon, 20 Aug 2018 04:49:44 +0000 (13:49 +0900)]
Add .gitignore to doc and doc.ja.

7 years agoChange follow_master_command description new master -> new primary.
Bo Peng [Mon, 20 Aug 2018 05:13:29 +0000 (14:13 +0900)]
Change follow_master_command description new master -> new primary.

7 years agoMerge branch 'V3_7_STABLE' of ssh://git.postgresql.org/pgpool2 into V3_7_STABLE
Tatsuo Ishii [Fri, 17 Aug 2018 03:12:36 +0000 (12:12 +0900)]
Merge branch 'V3_7_STABLE' of ssh://git.postgresql.org/pgpool2 into V3_7_STABLE

7 years agoFix test directory name typos.
Bo Peng [Fri, 17 Aug 2018 03:06:38 +0000 (12:06 +0900)]
Fix test directory name typos.

7 years agoFix too small buffer size in some configuration file process.
Tatsuo Ishii [Thu, 16 Aug 2018 06:38:33 +0000 (15:38 +0900)]
Fix too small buffer size in some configuration file process.

This was found by newer version of gcc warnings.

pool_config_variables.c: In function ‘BackendFlagsShowFunc’:
pool_config_variables.c:3809:57: warning: ‘__builtin_snprintf’ output truncated before the last format character [-Wformat-truncation=]
   snprintf(buffer, sizeof(buffer), "DISALLOW_TO_FAILOVER");
                                                         ^
In file included from /usr/include/stdio.h:862:0,
                 from pool_config_variables.c:1:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:64:10: note: ‘__builtin_snprintf’ output 21 bytes into a destination of size 20
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

7 years agoImprove pg_md5 docs and error message.
Bo Peng [Tue, 14 Aug 2018 13:43:49 +0000 (22:43 +0900)]
Improve pg_md5 docs and error message.

Patch provided by Jesper Pedersen and modified by me.

7 years agoRemove some .gitignore files which doesn't belong this branch.
Bo Peng [Sat, 11 Aug 2018 00:06:59 +0000 (09:06 +0900)]
Remove some .gitignore files which doesn't belong this branch.

7 years agoAdd definition of PGLIB in regress.sh.
Bo Peng [Fri, 10 Aug 2018 04:16:02 +0000 (13:16 +0900)]
Add definition of PGLIB in regress.sh.
Patch provided by Jesper Pedersen.

7 years agoUpdate clean.sh which clean up regression test results.
Bo Peng [Fri, 10 Aug 2018 03:40:10 +0000 (12:40 +0900)]
Update clean.sh which clean up regression test results.

Patch provided by Jesper Pedersen.

7 years agoAdd .gitignore files.
Bo Peng [Fri, 10 Aug 2018 03:34:32 +0000 (12:34 +0900)]
Add .gitignore files.

Patch provided by Jesper Pedersen.

7 years agoFix segfault when node 0 is in down status.
Tatsuo Ishii [Sun, 5 Aug 2018 01:54:18 +0000 (10:54 +0900)]
Fix segfault when node 0 is in down status.

MASTER_CONNECTION refers to the connection to "master"
node. "Master" means the first live backend appearing in
pgpool.conf. The master node is determined at the time of fail over.
Unfortunately with both health check and fail_over_on_backend_error
are disabled, there's no chance of failover, which means the master
node id is remained the default value 0. So the MASTER_CONNECTION
refers to the node 0, and the connection is NULL.

Fix is as follows.

If attempt to connection to backend fails, check the master node id in
the shared memory.  If the master node id is the failed node, then
look for new master node using get_next_master_node (this was a static
function, but now it's made to public) and set the node id to the
master node id in the shared memory area.

Problem reported by Muhammad Usama in [pgpool-hackers: 2905].

7 years agoFix typos in documents and scripts.
Tatsuo Ishii [Fri, 3 Aug 2018 02:09:30 +0000 (11:09 +0900)]
Fix typos in documents and scripts.

Patch contributed by Jesper Pedersen.

7 years agoFix document mistakes of "recovery_1st_stage_command" and "recovery_2nd_stage_command".
Bo Peng [Wed, 1 Aug 2018 00:39:36 +0000 (09:39 +0900)]
Fix document mistakes of "recovery_1st_stage_command" and "recovery_2nd_stage_command".

7 years agoPrepare 3.7.5. V3_7_5 V3_7_5_RPM
Bo Peng [Tue, 31 Jul 2018 00:09:51 +0000 (09:09 +0900)]
Prepare 3.7.5.

7 years agoUpdate document version.
Bo Peng [Tue, 31 Jul 2018 00:05:10 +0000 (09:05 +0900)]
Update document version.

7 years agoAdd release-notes 3.3.22-3.7.5.
Bo Peng [Tue, 31 Jul 2018 00:02:15 +0000 (09:02 +0900)]
Add release-notes 3.3.22-3.7.5.

7 years agoFix document typos.
Bo Peng [Tue, 24 Jul 2018 04:45:11 +0000 (13:45 +0900)]
Fix document typos.
Patch provided by Takuma Hoshiai.

7 years agoTry to reduce the chance of regression 006.memcache failure.
Tatsuo Ishii [Wed, 11 Jul 2018 01:16:07 +0000 (10:16 +0900)]
Try to reduce the chance of regression 006.memcache failure.

It seems the occasional failure of the test is caused by replication
lag.  The script tries to read tables from standby but it returns a
table not existing error.  So insert pg_sleep() after creation of
tables.

7 years agoFix accessing already freed data in extended query.
Tatsuo Ishii [Fri, 13 Jul 2018 08:36:00 +0000 (17:36 +0900)]
Fix accessing already freed data in extended query.

When previous_message was set and accessed later on, it looked into
already freed data. This is because read_kind_from_backend() set the
pointer to the previous message in session context, and then released
the memory at the end of the function. No report from fields so far. I
just found this while testing Pgpool-II.

To fix this, store the previous message in the session context, rather
than storing the pointer. Also have a flag in the session context to
indicate whether a previous message is actually stored or not.

All the API for previous message has not been changed.

7 years agoAllow not to use pool_passwd in raw mode.
Tatsuo Ishii [Tue, 10 Jul 2018 02:25:00 +0000 (11:25 +0900)]
Allow not to use pool_passwd in raw mode.

Since in raw there's only 1 backend is actually involved, there's no
need to use pool_passwd with md5 authentication.
Per bug 411.

7 years agoFix broken markup of client-auth.sgml.
Tatsuo Ishii [Tue, 10 Jul 2018 02:12:04 +0000 (11:12 +0900)]
Fix broken markup of client-auth.sgml.

Also run auto-indentation using Emacs.

7 years agoFix "write on backend 0 failed with error :"Success"" error.
Tatsuo Ishii [Wed, 4 Jul 2018 06:15:23 +0000 (15:15 +0900)]
Fix "write on backend 0 failed with error :"Success"" error.

While writing to a socket, sometimes write() returns 0. Before we
treated this as an error, but it seems this could happen in the field
and is better to be treated as normal. So if write() returns 0, then
retry write() instead of raise an error.

Per bug #403.

7 years agoFix for 0000409: worker process is not restarted after failover on standby..
Muhammad Usama [Tue, 3 Jul 2018 12:21:36 +0000 (17:21 +0500)]
Fix for 0000409: worker process is not restarted after failover on standby..

restart Worker process after syncing the backend status from master Pgpool-II
Patch contributed by nagata

7 years agoFix for 0000406: failover called with old-primary = -1
Muhammad Usama [Thu, 28 Jun 2018 11:59:38 +0000 (16:59 +0500)]
Fix for 0000406: failover called with old-primary = -1

The problem is when the primary node is quarantined the current primary node id
is set to -1 (Invalid), and once after consensus is made the failover never see
the original values for and old-primary.
The fix is to restore the primary node and master node status to the older
states (before the primary node was quarantined) while processing the failover
and failback on quarantined nodes.

7 years agoFix memory leak.
Tatsuo Ishii [Sun, 24 Jun 2018 00:59:06 +0000 (09:59 +0900)]
Fix memory leak.

Per Coverity.

7 years agoStart health check process at failback.
Tatsuo Ishii [Fri, 22 Jun 2018 08:27:16 +0000 (17:27 +0900)]
Start health check process at failback.

Health check process will not start if a backend node is in down
status when Pgpool-II starts.  However when the node fails back,
health check should start so that it can detects the failure of the
node.

Per bug 407.

7 years agoAdd nap time after failover.
Tatsuo Ishii [Fri, 22 Jun 2018 05:37:25 +0000 (14:37 +0900)]
Add nap time after failover.

This should make the test failure less frequent.

7 years agoFix comments and coding style.
Tatsuo Ishii [Wed, 20 Jun 2018 04:57:40 +0000 (13:57 +0900)]
Fix comments and coding style.

7 years agoFix 006.memqcache test.
Tatsuo Ishii [Wed, 20 Jun 2018 02:49:45 +0000 (11:49 +0900)]
Fix 006.memqcache test.

It forgot to execute shutdownall if some of tests failed. This lead to
hang up of subsequent tests.

7 years agoFix memory leaks related to pool_extract_error_message().
Tatsuo Ishii [Wed, 20 Jun 2018 01:25:23 +0000 (10:25 +0900)]
Fix memory leaks related to pool_extract_error_message().

After 3.4, the function starts to return palloc'ed memory, and the
caller should had been modified so that they pfree the memory returned
by it but actually they had not.

7 years agoFix oversight in pool_extract_error_message().
Tatsuo Ishii [Tue, 19 Jun 2018 02:31:29 +0000 (11:31 +0900)]
Fix oversight in pool_extract_error_message().

A variable used for storing the return value was mistakenly declared
as bool, rather than int.  This led to a segfault issue mentioned in
75b27e7 on certain platform.

7 years agoFix segfault in per_node_error_log() on armhf architecture.
Tatsuo Ishii [Tue, 19 Jun 2018 01:10:33 +0000 (10:10 +0900)]
Fix segfault in per_node_error_log() on armhf architecture.

pool_extract_error_message() incorrectly returns 255 (in decimal) on
the architecture when previous message was not an error or a notice
message. In this case per_node_error_log() happily calls ereport since
the return value from pool_extract_error_message() is greater than
0. Unfortunately the message string returned by
pool_extract_error_message() points to garbage memory in this case, a
segfault occurs.

The fix gives per_node_error_log() a guard against the bug of
pool_extract_error_message(). Moreover, the change is more consistent
with other places where pool_extract_error_message() is called.

Fix for pool_extract_error_message() will come later on.

See:
https://github.com/pgpool/pgpool2/issues/14
for more detailed discussion.

Problem reported and patch by Christian Ehrhardt.

7 years agoFix memory leaks and null dereference pointed out by Coverity.
Tatsuo Ishii [Sat, 16 Jun 2018 11:44:47 +0000 (20:44 +0900)]
Fix memory leaks and null dereference pointed out by Coverity.

7 years agoFix for wrong backend roles on standby after the failover
Muhammad Usama [Thu, 14 Jun 2018 08:59:53 +0000 (13:59 +0500)]
Fix for wrong backend roles on standby after the failover

Pgpool standby nodes were getting the "require_backend_sync" signal before the
active/master Pgpool had finish the failover. As a results the standby was
getting the wrong backend node statuses. The cause was a simple coding mistake
where failover indication function was passed with the wrong argument.

Problem reported by Bo Peng <pengbo@sraoss.co.jp>

7 years agoRevert "Fix 055.backend_all_down test failure."
Tatsuo Ishii [Tue, 12 Jun 2018 06:52:18 +0000 (15:52 +0900)]
Revert "Fix 055.backend_all_down test failure."

This reverts commit 7fc1605de7f759e300af615b09b0329d3e0963e9.

7 years agoFix 055.backend_all_down test failure.
Tatsuo Ishii [Tue, 12 Jun 2018 06:21:52 +0000 (15:21 +0900)]
Fix 055.backend_all_down test failure.

The test fails because pgpool zombie child process remains. Actually
the failover process is properly performed but when the shutdown
script is executed in background, output to stdout/stderr was blocked,
and this could cause the zombie process syndrome. Soltution is,
redirecting stdout/stderr to /dev/null when sponing the shutdown
script in background.

7 years agoPrepare 3.7.4. V3_7_4 V3_7_4_RPM
Bo Peng [Mon, 11 Jun 2018 14:05:42 +0000 (23:05 +0900)]
Prepare 3.7.4.

7 years agoUpdate doc version to 3.7.4.
Bo Peng [Mon, 11 Jun 2018 13:59:46 +0000 (22:59 +0900)]
Update doc version to 3.7.4.

7 years agoAdd release-notes 3.7.4 - 3.4.18.
Bo Peng [Mon, 11 Jun 2018 13:55:25 +0000 (22:55 +0900)]
Add release-notes 3.7.4 - 3.4.18.

7 years agoMerge branch 'V3_7_STABLE' of ssh://git.postgresql.org/pgpool2 into V3_7_STABLE
Tatsuo Ishii [Thu, 31 May 2018 03:13:13 +0000 (12:13 +0900)]
Merge branch 'V3_7_STABLE' of ssh://git.postgresql.org/pgpool2 into V3_7_STABLE

7 years agoFix pgpool hung when query cache enabled in extended query mode.
Tatsuo Ishii [Thu, 31 May 2018 02:39:09 +0000 (11:39 +0900)]
Fix pgpool hung when query cache enabled in extended query mode.

If replication delay is too much, load balancing is
disabled. Unfortunately query cache module tried to access the backend
even if the target node was already changed to primary even if load
balancing was disabled. To fix this, the target backend is identified
by using pending message data which reflects the fact that load
balancing is disabled.

Bug reported in [pgpool-general-jp: 1534].

To reproduce the bug, following steps are required.

1) create a 2 node streaming replication setting (just running
   pgpool_setup will do this),

2) set backend weight 0 to 0 to force the load balance node to node 1.

3) break recovery.conf on node 1 (for example modify conninfo)

4) start the whole cluster.

5) run massive DDL. pgbench -i is convenient for this.

6) make sure that replication delay is too much by using "show
   pool_nodes".

7) run following data using pgproto. (you need to adjust lines
including "#" so that # starts beginning of the line)

 # Test for disable_load_balance_on_write feature.
 #

 # Force load balance node to 1.
 ##backend_weight0 = 0
 ##backend_weight1 = 1

 # Start a transaction
'P' "" "BEGIN" 0
'B' "" "" 0 0 0
'E' "" 0

 # Issue SELECT.
'P' "" "SELECT 1"
'B' "" "" 0 0 0
'E' "" 0

 # Issue COMMIT
'P' "" "COMMIT" 0
'B' "" "" 0 0 0
'E' "" 0
'S'
'Y'

 # Issue same SELECT.
'P' "" "SELECT 1"
'B' "" "" 0 0 0
'E' "" 0
'S'
'Y'

'X'

8) next "SELECT 1" will be hung.

7 years agoFix document typo of PCP commands option "-U".
Bo Peng [Wed, 30 May 2018 05:33:03 +0000 (14:33 +0900)]
Fix document typo of PCP commands option "-U".

7 years agoFix comment typo.
Tatsuo Ishii [Mon, 28 May 2018 05:19:04 +0000 (14:19 +0900)]
Fix comment typo.

7 years agoDelete some debug code.
Bo Peng [Thu, 24 May 2018 08:37:43 +0000 (17:37 +0900)]
Delete some debug code.

7 years agoDo not set writing tx flag with SET TRANSACTION READ ONLY.
Tatsuo Ishii [Thu, 24 May 2018 02:07:35 +0000 (11:07 +0900)]
Do not set writing tx flag with SET TRANSACTION READ ONLY.

In extended query mode, execute() sets the flag upon completion of
writing queries.  However the flag was set even when SET TRANSACTION
READ ONLY is issued.  Fix this by using
pool_is_transaction_read_only(). This has been already done in simple
query case.

7 years agoFix wrong parameter passed to failover script.
Tatsuo Ishii [Wed, 23 May 2018 08:18:42 +0000 (17:18 +0900)]
Fix wrong parameter passed to failover script.

From 3.7.2, one of the failover script parameters, namely old primary
node was not passed correctly. PRIMARY_NODE_ID macro was used for the
parameter value. Unfortunately it checks the node status since 3.7.2
and gives value 0 if the node is in down status.  The node status
could be down if former primary node was going down. To fix this, use
REAL_PRIMARY_NODE_ID macro which returns the current primary node id
regardless the node status.

Problem reported by Pierre Timmermans in [pgpool-general: 6092].

7 years agoClarify that failover_require_consensus requires that health check is enabled.
Tatsuo Ishii [Thu, 17 May 2018 06:37:58 +0000 (15:37 +0900)]
Clarify that failover_require_consensus requires that health check is enabled.

7 years agoUpdate outdated pcp_proc_info manual.
Tatsuo Ishii [Wed, 9 May 2018 02:22:32 +0000 (11:22 +0900)]
Update outdated pcp_proc_info manual.

Especially fix for time stamp (which was UNIX epoch, that was changed
long time ago).

7 years agoFix test.sh in extended_query_test.
Tatsuo Ishii [Tue, 8 May 2018 06:51:04 +0000 (15:51 +0900)]
Fix test.sh in extended_query_test.

It did not respect $PGPOOL_SETUP variable, which points to
pgpool_setup in this source tree.

Also fix error message normalize more complete so that unbale_bind
test does not fail.

7 years agoAdd missing health_check_timeout in pgpool_setup.
Tatsuo Ishii [Fri, 4 May 2018 08:35:31 +0000 (17:35 +0900)]
Add missing health_check_timeout in pgpool_setup.

Per node health_check_timeout was missing and this should had been
there since the per node health check parameter support was added.

7 years agoEnhance online recovery document.
Tatsuo Ishii [Fri, 4 May 2018 02:35:26 +0000 (11:35 +0900)]
Enhance online recovery document.

Clarify that 2nd stage command is only required in native replication
mode.

7 years agoFix compile error.
Bo Peng [Wed, 25 Apr 2018 14:31:12 +0000 (23:31 +0900)]
Fix compile error.

7 years agoPrevent pcp_recovery_node from recovering "unused" status node.
Tatsuo Ishii [Wed, 18 Apr 2018 01:03:37 +0000 (10:03 +0900)]
Prevent pcp_recovery_node from recovering "unused" status node.

This allowed to try to recover a node without configuration data,
which leads to variety of problems. See discussion:
https://www.pgpool.net/pipermail/pgpool-general/2018-March/006021.html
for more details.

Also I fixed pgpool_recovery function so that it quotes an empty
string argument with double quotes. Without this, the argument is
treated as if it does not exist, which was the source of the complain
from the user.

7 years agoPrepare 3.7.3. V3_7_3 V3_7_3_RPM
Bo Peng [Tue, 17 Apr 2018 08:44:02 +0000 (17:44 +0900)]
Prepare 3.7.3.

7 years agoAdd release notes 3.7.3 - 3.3.21.
Bo Peng [Tue, 17 Apr 2018 08:33:52 +0000 (17:33 +0900)]
Add release notes 3.7.3 - 3.3.21.

7 years agoDisable health check per node parameters by default.
Bo Peng [Tue, 17 Apr 2018 05:32:26 +0000 (14:32 +0900)]
Disable health check per node parameters by default.

7 years agoFix pcp_detach_node hung when -g option is specified.
Tatsuo Ishii [Thu, 12 Apr 2018 23:00:24 +0000 (08:00 +0900)]
Fix pcp_detach_node hung when -g option is specified.

"pcp_detach_node -g" had been broken since 3.7. The cause was a misuse
of degenerate_backend_set_ex(). Because of this, actual failover
request was not sent to the pgpool main process. As a result,
pcp_worker process waited vainly for a signal arriving from the
process.

Per bug 391. Problem reported by Tomoyuki Sato, fix by me.

7 years agoAdd new regression test for node 0 is down.
Tatsuo Ishii [Mon, 9 Apr 2018 05:45:37 +0000 (14:45 +0900)]
Add new regression test for node 0 is down.

test case 1: node 0 is already down before pgpool starts.
test case 2: node 0 goes down after pgpool starts.
test case 3: node 0 goes down and DISALLOW_TO_FAILOVER flag is set after pgpool starts.

7 years agoMake calls to to_regclass fully schema qualified.
Tatsuo Ishii [Sun, 8 Apr 2018 10:18:36 +0000 (19:18 +0900)]
Make calls to to_regclass fully schema qualified.

This is always recommended way.

7 years agoFix pgpool child process segfault when ALWAYS_MASTER is on.
Tatsuo Ishii [Thu, 5 Apr 2018 08:11:36 +0000 (17:11 +0900)]
Fix pgpool child process segfault when ALWAYS_MASTER is on.

If following conditions are all met pgpool child segfaults:

1) Streaming replication mode.

2) fail_over_on_backend_error is off.

3) ALWAYS_MASTER flag is set to the master (writer) node.

4) pgpool_status file indicates that the node mentioned in #3 is in
   down status.

What happens here is,

1) find_primary_node() returns node id 0 without checking the status
   of node 0 since ALWAYS_MASTER is set. It's remembered as the
   primary node id. The node id is stored in Req_info->primary_node_id.

2) The connection to backend 0 is not created since pgpool_status says
   it's in down status.

3) upon starting of session, select_load_balancing_node () is called
   and it tries to determine the database name from client's start up
   packet.

4) Since MASTER_CONNECTION macro points to the PRIMARY_NODE,
   MASTER_CONNECTION(ses->backend) is NULL and it results in a segfault.

The fix is, to change PRIMARY_NODE_ID macro so that it returns
REAL_MASTER_NODE_ID (that is the youngest node id which is alive) if
the node id in Req_info->primary_node_id is in down status. This can
be checked using VALID_BACKEND_RAW macro.

VALID_BACKEND macro cannot be used here because it calls
pool_is_node_to_be_sent_in_current_query() inside. Problem is, when a
query is about to processed, pool_is_query_in_progress() is already
set but pool_is_node_to_be_sent() could return false because
where_to_send member in the query context may not be is set yet
(that's the cause of the enbug in Pgpool-II 3.7.2).

So we have the "true" primary node id in Req_info->primary_node_id,
and "fake" primary node id returned by PRIMARY_NODE_ID macro.

See [pgpool-hackers: 2687] and [pgpool-general: 5881] Pgpool-3.7.1
segmentation fault for more details.

Since ALWAYS_MASTER flag was introduced in 3.7, back pached to 3.7
only.
Per bug report from Philip Champon.

7 years agoImprove watchdog documents.
Tatsuo Ishii [Wed, 4 Apr 2018 02:17:02 +0000 (11:17 +0900)]
Improve watchdog documents.

7 years agoMore typo fix.
Tatsuo Ishii [Mon, 2 Apr 2018 22:38:18 +0000 (07:38 +0900)]
More typo fix.

7 years agoUpdate config README file.
Tatsuo Ishii [Sat, 31 Mar 2018 21:39:39 +0000 (06:39 +0900)]
Update config README file.

7 years agoMore description added.
Tatsuo Ishii [Fri, 30 Mar 2018 08:35:01 +0000 (17:35 +0900)]
More description added.

7 years agoAdd a document for adding new config parameter.
Tatsuo Ishii [Fri, 30 Mar 2018 08:04:22 +0000 (17:04 +0900)]
Add a document for adding new config parameter.

7 years agoImprove test script 003.failover.
Bo Peng [Tue, 20 Mar 2018 08:46:35 +0000 (17:46 +0900)]
Improve test script 003.failover.

7 years agoChange the release version.
Bo Peng [Wed, 14 Mar 2018 08:44:25 +0000 (17:44 +0900)]
Change the release version.

7 years agoDeal with "unable to bind D cannot get parse message "S1" error.
Tatsuo Ishii [Wed, 14 Mar 2018 08:19:18 +0000 (17:19 +0900)]
Deal with "unable to bind D cannot get parse message "S1" error.

Before this just raised an exception and issue "DISCARD ALL" to only
node 0 if load balance node = 0 because query context wants to do
so. Problem is, when an exception is raised, the query context is not
active any more and Pgpool-II tries to read from node 1, which causes
a hang up.

Add new test for this to the extended query test.

7 years agoMerge branch 'V3_7_STABLE' of ssh://git.postgresql.org/pgpool2 into V3_7_STABLE V3_7_2_2_RPM
Bo Peng [Wed, 14 Mar 2018 06:39:27 +0000 (15:39 +0900)]
Merge branch 'V3_7_STABLE' of ssh://git.postgresql.org/pgpool2 into V3_7_STABLE

7 years agoPrepare 3.7.2-2.
Bo Peng [Wed, 14 Mar 2018 06:31:38 +0000 (15:31 +0900)]
Prepare 3.7.2-2.

7 years agoPrepare 3.7.2-1.
Bo Peng [Wed, 14 Mar 2018 06:31:38 +0000 (15:31 +0900)]
Prepare 3.7.2-1.

7 years agoFix some test errors.
Bo Peng [Wed, 14 Mar 2018 05:01:52 +0000 (14:01 +0900)]
Fix some test errors.

Add "wait_for_pgpool_startup" to wait for Pgpool-II starting.

7 years agoMention that users can avoid failover using backend_flag even PostgreSQL admin shutdown.
Tatsuo Ishii [Fri, 2 Mar 2018 05:22:35 +0000 (14:22 +0900)]
Mention that users can avoid failover using backend_flag even PostgreSQL admin shutdown.

7 years agoFix document typos.
Bo Peng [Wed, 28 Feb 2018 08:46:54 +0000 (17:46 +0900)]
Fix document typos.

7 years agoAdd new regression test for node 0 not being primary.
Tatsuo Ishii [Tue, 27 Feb 2018 05:04:20 +0000 (14:04 +0900)]
Add new regression test for node 0 not being primary.

7 years agoFix failure in replication mode.
Tatsuo Ishii [Tue, 27 Feb 2018 04:29:38 +0000 (13:29 +0900)]
Fix failure in replication mode.

If .psqlrc exists, pgpool_seup for replication mode fails because psql
produces messages like "Pager usage is off." which in turn confuses
a command after a pipe. Fix is add -q option to psql.

7 years agoAllow to support pgpool_switch_xlog PostgreSQL 10.
Tatsuo Ishii [Tue, 27 Feb 2018 04:22:15 +0000 (13:22 +0900)]
Allow to support pgpool_switch_xlog PostgreSQL 10.

Since PostgreSQL 10, pgpool_switch_xlog used in the recovery second
stage fails due to function name changes in PostgreSQL 10.

7 years agoRevert "Fix pgpool child process segfault when ALWAYS_MASTER is on."
Tatsuo Ishii [Mon, 26 Feb 2018 08:01:50 +0000 (17:01 +0900)]
Revert "Fix pgpool child process segfault when ALWAYS_MASTER is on."

This reverts commit 9022ff842fb5dbbe06e2f2f4cf38fadf47b592da.

With the commit, write queries are always sent to node 0 even if the
primary node is not 0 because PRIMARY_NODE_ID macro returns
REAL_MASTER_NODE_ID, which is usually 0. Thus write queries are failed
with:
ERROR:  cannot execute INSERT in a read-only transaction

7 years agoAdd description about temporarily installation for the test.
Tatsuo Ishii [Mon, 19 Feb 2018 05:44:39 +0000 (14:44 +0900)]
Add description about temporarily installation for the test.

7 years agoAllow to test using temporary installation.
Tatsuo Ishii [Mon, 19 Feb 2018 05:37:11 +0000 (14:37 +0900)]
Allow to test using temporary installation.

Most necessary stuffs for this was stolen fro regress.sh.