pgpool2.git
4 years agoDoc: update copyright year.
Tatsuo Ishii [Tue, 11 May 2021 05:35:19 +0000 (14:35 +0900)]
Doc: update copyright year.

4 years agoDoc: fix description about heartbeat_device.
Tatsuo Ishii [Tue, 11 May 2021 05:14:33 +0000 (14:14 +0900)]
Doc: fix description about heartbeat_device.

It did not mention the parameter can only be used if Pgpool-II started
as root.

4 years agoDoc: enhance description on enable_consensus_with_half_votes.
Tatsuo Ishii [Mon, 10 May 2021 00:02:15 +0000 (09:02 +0900)]
Doc: enhance description on enable_consensus_with_half_votes.

Although this parameter is written in "Controlling the Failover
behavior" section, this does affect to not only the backend failover
but quorum of Pgpool-II itself. So add a note to make it clear.

4 years agoDoc: remove incorrect description about failover_when_quorum_exists.
Tatsuo Ishii [Sun, 9 May 2021 23:36:42 +0000 (08:36 +0900)]
Doc: remove incorrect description about failover_when_quorum_exists.

"Please note that if the number of watchdog nodes is even, we regard
that quorum exists when the number of live nodes is greater than or
equal to half of total watchdog nodes." This is not correct anymore
since Pgpool-II 4.1 in which enable_consensus_with_half_votes has been
introduced.

4 years agoDoc: fix typo.
Tatsuo Ishii [Sun, 9 May 2021 21:55:30 +0000 (06:55 +0900)]
Doc: fix typo.

4 years agoDoc: fix typo.
Tatsuo Ishii [Sat, 8 May 2021 22:04:12 +0000 (07:04 +0900)]
Doc: fix typo.

4 years agoFix broken database/app redirect preference in statement level load balancing mode.
Bo Peng [Wed, 5 May 2021 09:48:15 +0000 (18:48 +0900)]
Fix broken database/app redirect preference in statement level load balancing mode.

Reported in bug707.

4 years agoUpdate .gitignore file.
Bo Peng [Wed, 5 May 2021 08:13:05 +0000 (17:13 +0900)]
Update .gitignore file.

4 years agoUpdate configure file.
Bo Peng [Wed, 5 May 2021 07:58:44 +0000 (16:58 +0900)]
Update configure file.

4 years agoFix watchdog_setup to not fail when -n is not specified.
Tatsuo Ishii [Wed, 5 May 2021 00:26:58 +0000 (09:26 +0900)]
Fix watchdog_setup to not fail when -n is not specified.

watchdog_setup failed if -n (number of PostgreSQL clusters) is not
specified. Now if -n is not specified, assume "-n = 2", which is same
as in pgpool_setup.

4 years agoDoc: fix typo.
Tatsuo Ishii [Tue, 4 May 2021 21:56:13 +0000 (06:56 +0900)]
Doc: fix typo.

4 years agoDoc: fix typo.
Tatsuo Ishii [Tue, 4 May 2021 11:38:31 +0000 (20:38 +0900)]
Doc: fix typo.

4 years agoAllow to build pgpool with PostgreSQL 9.0 or before.
Tatsuo Ishii [Mon, 3 May 2021 11:04:38 +0000 (20:04 +0900)]
Allow to build pgpool with PostgreSQL 9.0 or before.

pool_process_reporting.c referrers to PQpingParams() which was
introduced in PostgreSQL 9.1. Check existence of the function in
configure and if it does not exist, set "pg_status" column of "show
pool_nodes" and "pcp_node_info" to be set "unknown".

4 years agoFix pgpool_setup to not show an error.
Tatsuo Ishii [Mon, 3 May 2021 07:40:00 +0000 (16:40 +0900)]
Fix pgpool_setup to not show an error.

In the streaming replication mode pgpool_setup showed error:
:
:
recovery node 2...pcp_recovery_node -- Command Successful
done.
creating follow primary script
psql: error: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
shutdown all
:
:

While creating followers, pgpool_setup confirmed using
wait_for_pgpool_startup that pgpool comes up online except the last
node. This is unnecessary and it should confirm that pgpool comes up
even in the last node.

4 years agoAdd new option to pgpool_setup.
Tatsuo Ishii [Sun, 2 May 2021 10:27:50 +0000 (19:27 +0900)]
Add new option to pgpool_setup.

Add new option "-e" which omits to create PostgreSQL database
clusters.  This is option is intended to be used by watchdog_setup.
watchdog_setup needs to creates set of PostgreSQL database clusters
for each Pgpool-II node.  Actually it created identical database
clusters for each Pgpool-II node then replaced them with symlink to
pgpool node 0. This is waste of time. Now watchdog_setup invokes
pgpool_setup using "-e" option and for pgpool node 1 and so on to save
time and resource.

4 years agoChange show pool_nodes/pcp_node_info to not use pg_isready.
Tatsuo Ishii [Sat, 1 May 2021 22:41:08 +0000 (07:41 +0900)]
Change show pool_nodes/pcp_node_info to not use pg_isready.

Using extra PostgreSQL binary pg_isready is not comfortable for
packagers and container users.  Use libpq's PQpingParams instead.

4 years agoFix watchdog_setup.
Tatsuo Ishii [Fri, 30 Apr 2021 05:22:56 +0000 (14:22 +0900)]
Fix watchdog_setup.

watchdog_setup creates database cluster entity under pgpool0. In other
pgpool nodes's pgpool.conf just has the port number for PostgreSQL in
pgpool0.  But backend_data_directory remains their own PostgreSQL
cluster. For example:

backend_data_directory0 = '/home/t-ishii/work/Pgpool-II/current/x/pgpool2/data0'

This is fine until online recovery runs. If it referrers to the database
cluster directory, which is not correct of course.

Fix this by replacing database cluster directories with symlinks to
pgppol/data0 and so on. This will reduce disk space.

Also fix usage message that now Snapshot Isolation mode is supported.

4 years agoFix verify_backend_node_status().
Tatsuo Ishii [Tue, 27 Apr 2021 08:24:14 +0000 (17:24 +0900)]
Fix verify_backend_node_status().

It is possible that backend_hostname is Unix domain socket but
wal_receiver connects via TCP/IP localhost.
verify_backend_node_status() should accept this as normal.  This
actually happened in the Pgpool-II cluster created by pgpool_setup.  I
found this while testing detach_false_primary.

4 years agoFix default value of log_directory.
Tatsuo Ishii [Mon, 26 Apr 2021 05:06:59 +0000 (14:06 +0900)]
Fix default value of log_directory.

The value written in the configuration file was '/tmp/pgpool_log'
which was different from the compile time built-in value and the value
explained in the docs.

Patch contributed by KAWAMOTO Masaya.

4 years agoFix copyright.
Tatsuo Ishii [Sun, 25 Apr 2021 08:38:20 +0000 (17:38 +0900)]
Fix copyright.

Pgproto was originally written by me and then contributed to PgPool
Global Development Group in 2018.

4 years agoSet application name to pgproto.
Tatsuo Ishii [Sun, 25 Apr 2021 08:24:36 +0000 (17:24 +0900)]
Set application name to pgproto.

Now that from 4.2 application name can be used in the pgpool log,
pgproto now has its own application name "pgproto".

Also fix a bug in creating connection string. While adding user name,
it did not use strncat(), instead it used strcat().

4 years agoDoc: add missing explanation about clear text password authentication.
Tatsuo Ishii [Tue, 20 Apr 2021 04:10:57 +0000 (13:10 +0900)]
Doc: add missing explanation about clear text password authentication.

4 years agoDoc: enhance client authentication document.
Tatsuo Ishii [Tue, 20 Apr 2021 00:31:52 +0000 (09:31 +0900)]
Doc: enhance client authentication document.

Mention that pg_md5 command requires --config-file option.

4 years agoDoc: enhance in memory query cache document.
Tatsuo Ishii [Sun, 18 Apr 2021 09:43:24 +0000 (18:43 +0900)]
Doc: enhance in memory query cache document.

Mention that in extended query mode, the cache registration time
varies depending on clustering mode.

4 years agoDoc: enhance show pool_cache manual.
Tatsuo Ishii [Tue, 13 Apr 2021 04:28:38 +0000 (13:28 +0900)]
Doc: enhance show pool_cache manual.

Add note that not all columns shows meaningful values when cache
storage is memcached.

4 years agoFix regression test 072 and 074.
Tatsuo Ishii [Mon, 12 Apr 2021 03:00:54 +0000 (12:00 +0900)]
Fix regression test 072 and 074.

In these tests pgproto is used. However the script forgot to specify
the path to the command.  It is interesting that test 072 is keeping
reporting ok. This is because the test script does not care even if
pgproto does not found.

4 years agoCode restructuring for memory cache.
Tatsuo Ishii [Sun, 11 Apr 2021 07:33:23 +0000 (16:33 +0900)]
Code restructuring for memory cache.

Add new function pool_discard_current_temp_query_cache(). We used to
do same thing in multiple places to discard temporary query cache of
current query context. The new function performs the work, which
should prevent mistakes like bug 700.

Since this is just a code restructuring, I only apply this to master
and 4.2 stable branches.

4 years agoAdd new regression test 074.bug700_memqcache_bug_segfault_at_close_complete which...
Tatsuo Ishii [Sun, 11 Apr 2021 05:25:31 +0000 (14:25 +0900)]
Add new regression test 074.bug700_memqcache_bug_segfault_at_close_complete which was missed in the previous commit.

The test was missed in commit: a531e783c90a88ab429d0de83fadb7e41c787a92

4 years agoFix pgpool crash when query cache enabled.
Tatsuo Ishii [Fri, 9 Apr 2021 10:32:56 +0000 (19:32 +0900)]
Fix pgpool crash when query cache enabled.

Pgpool-II crashed upon receiving CloseComplete.
This only happened in other than streaming and logical replication mode.

The minimum test case is as follows:

'P' "S1" "SELECT 1" 0
'B' "P1" "S1" 0 0 0
'E' "P1" 0
'C' 'P' "P1"
'B' "P2" "S1" 0 0 0
'E' "P2" 0
'C' 'P' "P2"
'S'
'Y'
'X'

A query statement S1 is bound to portal P1 and P1 is closed. When
CommandComplete message arrives, CloseComplete() discard temp query
cache buffer corresponding to the query context. Unfortunately it
forgot to set NULL to query_context->temp_cache. So whnen next time
other portal P2 which was also bound to S1 is closed, CloseComplete()
tries to free memory which was already freed by previous
CloseComplete. This leads to a segfault.

Fix is set NULL to query_context->temp_cache when the CloseComplete()
is called.

The reason why in streaming and logical replication this does occur
is, unlike other mode, in these mode query_context->temp_cache is
already freed and set to NULL when CommandComplete arrives.

Also new regression test
074.bug700_memqcache_bug_segfault_at_close_complete is added.

Per bug 700.

4 years agoDoc: Fix documentation typos.
Bo Peng [Mon, 5 Apr 2021 16:53:43 +0000 (01:53 +0900)]
Doc: Fix documentation typos.

4 years agoImprove sample scripts.
Bo Peng [Mon, 5 Apr 2021 14:31:18 +0000 (23:31 +0900)]
Improve sample scripts.
- Empty pg_replslot directory of the standby node after running pg_rewind, because pg_replslot directory may be copied from the primary node in old PostgreSQL versions.
- While creating/dropping replication slot, access remote database using psql instead of uing ssh.

4 years agoFix that query cache is not created in other than streaming and logical replication...
Tatsuo Ishii [Mon, 5 Apr 2021 02:03:06 +0000 (11:03 +0900)]
Fix that query cache is not created in other than streaming and logical replication mode.

We used to create query cache in ReadyForQuery() in extended query
mode in other than streaming and logical replication mode. However if
following message sequence is sent from frontend, the query cache was
never created because pool_is_cache_safe() returns false in
pool_handle_query_cache(). Why? Because pool_is_cache_safe() examines
the current query context, and the current query context is for "END"
message.

'P' "" "BEGIN" 0
'B' "" "" 0 0 0
'E' "" 0
'P' "S1" "SELECT 1" 0
'B' "S1" "S1" 0 0 0
'E' "S1" 0
'P' "" "END" 0
'B' "" "" 0 0 0
'E' "" 0
'S'
'Y'
'X'

So this commit changes CommandComplete() so that
pool_handle_query_cache() gets called in not only streaming and
logical replication mode. pool_handle_query_cache() will create a
temporary query cache and it will be processed when next time
ReadyForQuery() is called for an END message.

I found the bug while taking care of:
https://www.pgpool.net/mantisbt/view.php?id=700

Note that if the transaction is ended by a simple query message "END",
the bug does not appear because extended query SELECT messages will be
followed by a SYNC message, which will produce a Ready for query
message, and ReadyForQuery() will happily register query cache since
this time pool_is_cache_safe() returns true.

I think this is a long standing bug. The reason why this was not found
earlier is, despite the similar message sequence is created by the JDBC
driver, CommandComplete() already handles in the way described above.

4 years agoFix show pool_nodes when pg_isready is not in command search path.
Tatsuo Ishii [Fri, 2 Apr 2021 05:14:08 +0000 (14:14 +0900)]
Fix show pool_nodes when pg_isready is not in command search path.

If pg_isready is not in the command search path, show pool_node's
"pg_status" showed "down" because pg_isready cannot be invoked. To fix
this, set Makefile variable PGSQL_BIN_DIR and use the path in the show
pool_nodes.

4 years agoFix pgpool_setup so that it fail back to full restore if failed in restarting.
Tatsuo Ishii [Wed, 31 Mar 2021 07:09:13 +0000 (16:09 +0900)]
Fix pgpool_setup so that it fail back to full restore if failed in restarting.

While taking care of "[pgpool-general: 7456] Expected behaviour after pcp_detach_node ?"

https://www.pgpool.net/pipermail/pgpool-general/2021-March/007514.html

I noticed that restarting target server in follow primary script could
fail.  This could happen when former primary goes to down status using
pcp_detach_node.  The former primary will not start due to timeline
and LSN divergence.  To fix this, fail back to full restore using
pg_recovery if restarting server.

4 years agoFix comments in sample comfiguration files to avoid error occurred in pgpooladmin.
Bo Peng [Wed, 24 Mar 2021 15:25:50 +0000 (00:25 +0900)]
Fix comments in sample comfiguration files to avoid error occurred in pgpooladmin.

4 years agoFix hang with asyncpg.
Tatsuo Ishii [Thu, 18 Mar 2021 05:27:27 +0000 (14:27 +0900)]
Fix hang with asyncpg.

asyncpg (Python frontend driver with asynchronous I/O) uses extended
protocol. When it issues describe message, it is followed by Flush
message. Unfortunately Pgpool-II just buffers flush message and
frontend cannot receive the message from pgpool. To fix this, Now
SimpleForwardToFrontend() flushes the send buffer while processing
describe message.

Discussion:
https://www.pgpool.net/pipermail/pgpool-general/2021-March/007495.html

4 years agoEnhance debug message upon receiving startup packet.
Tatsuo Ishii [Tue, 16 Mar 2021 01:27:22 +0000 (10:27 +0900)]
Enhance debug message upon receiving startup packet.

While processing a startup packet, database name, user name and
application name are printed in DEBUG1, but other guc variables (if
any) were not printed. This is not helpful when studying errors like
"connection exists but startup packet length is not identical" problem
(see https://www.pgpool.net/mantisbt/view.php?id=696). With this
commit guc variables are now printed something like:

2021-03-16 10:21:32: child pid 5155: DEBUG:  reading startup packet
2021-03-16 10:21:32: child pid 5155: DETAIL:  guc name: client_encoding value: UTF8

4 years agoDoc: fix typo.
Bo Peng [Sun, 14 Mar 2021 14:28:02 +0000 (23:28 +0900)]
Doc: fix typo.

4 years agoUpdate comment lines of sample configuration files.
Bo Peng [Sun, 14 Mar 2021 14:01:25 +0000 (23:01 +0900)]
Update comment lines of sample configuration files.

4 years agoFix pcp_node_info failure when backend is down.
Tatsuo Ishii [Thu, 11 Mar 2021 07:00:33 +0000 (16:00 +0900)]
Fix pcp_node_info failure when backend is down.

From Pgpool-II 4.3, it calls db_node_role() and in turn it calls
make_persistent_db_connection_noerror(). make_persistent_db_connection_noerror()
called EmitErrorReport(), which sent an ERROR message to pcp frontend
in case of connection error to backend. Unfortunately pcp frontends
stops processing in case of receiving ERROR message from pcp
server. (see process_pcp_response() in src/libs/pcp/pcp.c).

To fix this eliminate calling EmitErrorReport() in
make_persistent_db_connection_noerror(). This also fixes the
inconsistency in the spec expressed in its comment ("does not ereports
in case of an * error") and the implementation.

4 years agoDoc: update "Installation from RPM" section.
Tatsuo Ishii [Sat, 6 Mar 2021 09:07:23 +0000 (18:07 +0900)]
Doc: update "Installation from RPM" section.

It referred to old Pgpool-II 4.1 and PostgreSQL 12. They now refer to
Pgpool-II 4.2 and PostgreSQL 13. Also use dnf command instead of yum
command.

4 years agoAdd new fields to show pool_nodes command and friends.
Tatsuo Ishii [Sat, 27 Feb 2021 07:34:49 +0000 (16:34 +0900)]
Add new fields to show pool_nodes command and friends.

pg_status: actual DB node status. Either "up" or "down". The status is
fetched by using pg_isready command while executing show
pool_nodes. Arguments for pg_isready are obtained from health check
parameters. The reason for this choice is, pgpool already checks the
availability of PostgreSQL by using health check parameters. If health
check is disabled (health_check_period = 0), the status will be
"unknown".

pg_role: actual DB node status. Only meaningful in streaming
replication mode. Either "primary" or "standby". If
pg_is_in_recovery() returns true, it will be represented as "standby",
otherwise "primary". In other clustering modes, same as "role" field.
Arguments for querying to backend are obtained from
sr_check_parameters. The reason for this choice is, pgpool already
checks the role of PostgreSQL by using sr_check parameters. If
sr_check is disabled (sr_check_period = 0), the status will be
"unknown". For other clustering mode, value of "role" field is copied
to pg_role field.

Modified commands/functions are: show poool_nodes, pcp_node_info and
pgpool_adm_pcp_node_info.

4 years agoDoc: fix typo.
Tatsuo Ishii [Wed, 24 Feb 2021 01:33:00 +0000 (10:33 +0900)]
Doc: fix typo.

4 years agoDoc: enhance pcp_detach_node manual.
Tatsuo Ishii [Sat, 20 Feb 2021 00:45:16 +0000 (09:45 +0900)]
Doc: enhance pcp_detach_node manual.

Add more detailed description when the command is executed.

4 years agoUpdate follow_primary.sh.sample due to the previous commit 7bd103a6a33a2a675bd37f996a...
Bo Peng [Wed, 17 Feb 2021 05:45:31 +0000 (14:45 +0900)]
Update follow_primary.sh.sample due to the previous commit 7bd103a6a33a2a675bd37f996ab46b7819a731d7.

4 years agoAdd release note.
Bo Peng [Wed, 17 Feb 2021 03:56:54 +0000 (12:56 +0900)]
Add release note.

4 years agoDoc: fix example in pgpool_adm pcp_node_info().
Tatsuo Ishii [Sun, 14 Feb 2021 01:09:39 +0000 (10:09 +0900)]
Doc: fix example in pgpool_adm pcp_node_info().

Per commit: https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commit;h=caf5215479ee7a5b55c1dcdeb00a2fccf0ed7133

4 years agoFix pcp_node_info() in pgpool_adm extension.
Tatsuo Ishii [Sun, 14 Feb 2021 00:28:38 +0000 (09:28 +0900)]
Fix pcp_node_info() in pgpool_adm extension.

The weight info was mistakenly handled by Float8GetDatum although the
function prototype is float4. The oversight made the weight value to 0
or certain insane value. Change it to Float4GetDatum.  It is amazing
that nobody (including me) did not notice it until today.

4 years agoFix follow_primary.sh.sample to avoid removing recovery.conf.
Bo Peng [Sat, 13 Feb 2021 17:27:56 +0000 (02:27 +0900)]
Fix follow_primary.sh.sample to avoid removing recovery.conf.

4 years agoFix follow_primary creation in pgpool_setup.
Tatsuo Ishii [Tue, 9 Feb 2021 06:12:02 +0000 (15:12 +0900)]
Fix follow_primary creation in pgpool_setup.

Since PostgreSQL 13 it is possible to reload the change of
recovery_conninfo, but it is not possible to reload
recovery_command. To fix this use pg_ctl restart regardless the
version of PostgreSQL.

Also fix an oversight: forgot to create standby.signal.

4 years agoFix watchdog leader sync process to start health check process.
Tatsuo Ishii [Mon, 8 Feb 2021 11:30:18 +0000 (20:30 +0900)]
Fix watchdog leader sync process to start health check process.

When watchdog receives status change request from other watchdog node
and calls sync_backend_from_watchdog() to sync with status of leader
node, it forgot to start health check process. For example,

1) initial pgpool_status file indicates DB node 1 is down.
2) pgpool starts up but only starts health check process for DB node 0
   because node 1 is in down status.
3) pcp_attach_node is issued to other than leader pgpool node.
4) leader node updates the node status for DB node 1 and other node
   syncs the status. Since sync_backend_from_watchdog() does not start
   health check process, only on pgpool leader node starts health
   check process but other nodes do not.

To fix this starts health check process if necessary in
sync_backend_from_watchdog().

4 years agoDoc: enhance "3.7. Temporarily Shutting Down PostgreSQL".
Tatsuo Ishii [Sat, 6 Feb 2021 11:42:35 +0000 (20:42 +0900)]
Doc: enhance "3.7. Temporarily Shutting Down PostgreSQL".

Explain that pcp_detach_node can immediate failover regardless
watchdog and health check settings. Also to enhance readability split
the chapter into two sections.

4 years agoDoc: fix watchdog_setup manual.
Tatsuo Ishii [Sat, 6 Feb 2021 08:48:09 +0000 (17:48 +0900)]
Doc: fix watchdog_setup manual.

Add snapshot isolation mode to the "mode" parameter which was
forgotten when adding the mode.

4 years agoFix follow_primary.sh creation in pgpool_setup.
Tatsuo Ishii [Fri, 5 Feb 2021 07:36:41 +0000 (16:36 +0900)]
Fix follow_primary.sh creation in pgpool_setup.

While creating the script, it did not update restore_command to point
to the primary's archive directory.

4 years agoDoc: enhance "5.3. Clustering mode".
Tatsuo Ishii [Thu, 4 Feb 2021 06:48:45 +0000 (15:48 +0900)]
Doc: enhance "5.3. Clustering mode".

- Reorder each clustering mode so that recommended clustering modes
  come first.

- Add drawbacks to each clustering mode.

4 years agoDoc: enhance "3.3.2. Clustering mode of Pgpool-II".
Tatsuo Ishii [Thu, 4 Feb 2021 04:31:26 +0000 (13:31 +0900)]
Doc: enhance "3.3.2. Clustering mode of Pgpool-II".

Add link to "backend clustering mode". Change title of this section
from "3.3.2. Running mode of Pgpool-II" to 23.3.2. Clustering mode of
Pgpool-II".

4 years agoAdd support for snapshot isolation mode.
Tatsuo Ishii [Thu, 4 Feb 2021 03:23:58 +0000 (12:23 +0900)]
Add support for snapshot isolation mode.

Also add "wal_level = archive" to all modes except streaming
replication mode to deal with online recovery enhancement.

4 years agoFix that DB cluster path was not correct in watchdog_setup installation.
Tatsuo Ishii [Thu, 4 Feb 2021 02:28:57 +0000 (11:28 +0900)]
Fix that DB cluster path was not correct in watchdog_setup installation.

In the watchdog_setup installation generated path to DB clusters did
not correctly point to pgpool0/data0 etc. Correct them by using sed
command.

4 years agoFix typos in message emitted by sync_backend_from_watchdog().
Tatsuo Ishii [Wed, 3 Feb 2021 08:01:23 +0000 (17:01 +0900)]
Fix typos in message emitted by sync_backend_from_watchdog().

4 years agoFix pgpool_setup failure on raw mode.
Bo Peng [Wed, 3 Feb 2021 06:03:31 +0000 (15:03 +0900)]
Fix pgpool_setup failure on raw mode.

4 years agoEnhance pgpool_setup.
Tatsuo Ishii [Tue, 2 Feb 2021 14:12:37 +0000 (23:12 +0900)]
Enhance pgpool_setup.

"shutdownall" script unconditionally waited for the pgpool.pid file is
gone after "pgpool stop".  But if invalid pgpool.pid file exists, it
waits forever. To avoid this check the exit status of "pgpool stop"
and only wait if the exit status is 0.

4 years agoDoc: enhance "3.3.2. Running mode of Pgpool-II".
Tatsuo Ishii [Tue, 2 Feb 2021 09:35:22 +0000 (18:35 +0900)]
Doc: enhance "3.3.2. Running mode of Pgpool-II".

Arrange the order of each clustering mode to give more focus on
snapshot isolation mode.  Remove the limitations in snapshot isolation
mode because actually they are not the limitations.

4 years agoFix missing displaying of backend_clustering_mode mode in "show pool_status" command.
Bo Peng [Tue, 2 Feb 2021 02:54:56 +0000 (11:54 +0900)]
Fix missing displaying of backend_clustering_mode mode in "show pool_status" command.

4 years agoFix messages when health check process starts.
Tatsuo Ishii [Tue, 2 Feb 2021 00:56:23 +0000 (09:56 +0900)]
Fix messages when health check process starts.

Fix when health check process was restarted by reaper(), incorrect
"child process with pid: 14639 exited with success and will not be
restarted" was emitted.

Also enhance worker_fork_a_child() to emit a message that new worker
process started.

4 years agoDoc: update failover command parameters order.
Bo Peng [Mon, 1 Feb 2021 16:13:10 +0000 (01:13 +0900)]
Doc: update failover command parameters order.

4 years agoDoc: mention that the sample scripts doesn't support tablespaces in "Pgpool-II +...
Bo Peng [Mon, 1 Feb 2021 14:29:29 +0000 (23:29 +0900)]
Doc: mention that the sample scripts doesn't support tablespaces in "Pgpool-II + Watchdog Setup Example".

4 years agoRewrite introduction to Pgpool-II.
Tatsuo Ishii [Mon, 1 Feb 2021 10:25:24 +0000 (19:25 +0900)]
Rewrite introduction to Pgpool-II.

Change the meaning of "pool" and make it clear that what are the
essential features of Pgpool-II.

4 years agoFix pgpool_setup for pre PostgreSQL case.
Tatsuo Ishii [Sun, 31 Jan 2021 06:36:52 +0000 (15:36 +0900)]
Fix pgpool_setup for pre PostgreSQL case.

Now that native replication mode and snapshot isolation mode use
streaming replication for online recovery, unconditionally add
max_walsenders parameter to postgresql.conf.

4 years agoFix oversight in commit 3a36284c53c125389c999de5c6c4710973c4cb82.
Tatsuo Ishii [Sun, 31 Jan 2021 02:27:47 +0000 (11:27 +0900)]
Fix oversight in commit 3a36284c53c125389c999de5c6c4710973c4cb82.

When si_get_snapshot() is called, load balance node has not been
decided yet and we cannot use VALID_BACKEND macro.  Use
VALID_BACKEND_RAW instead.

4 years agoEnhance online recovery script for native replication and snapshot isolation mode...
Tatsuo Ishii [Sat, 30 Jan 2021 02:23:39 +0000 (11:23 +0900)]
Enhance online recovery script for native replication and snapshot isolation mode in pgpool_setup.

Use pg_stat_replication to get the log difference between main and
replica node while executing second stage so that reduces the number
of SQL issued.

4 years agoFix segfault in snapshot isolation mode.
Tatsuo Ishii [Thu, 28 Jan 2021 09:01:28 +0000 (18:01 +0900)]
Fix segfault in snapshot isolation mode.

If one DB nodes goes down, pgpool segfaulted in the mode. This
happened in si_get_snapshot(). This was caused because it did not
check whether DB node is alive or not.

4 years agoDoc: add initial Chinese documentation directory.
Bo Peng [Thu, 28 Jan 2021 00:38:22 +0000 (09:38 +0900)]
Doc: add initial Chinese documentation directory.

4 years agoEnhance native replication mode or snapshot isolation mode online
Tatsuo Ishii [Wed, 27 Jan 2021 12:24:03 +0000 (21:24 +0900)]
Enhance native replication mode or snapshot isolation mode online
recovery case.

Use streaming replication in the first stage and replays WAL generated
during base copy as much as possible. In the second stage, now it just
promotes the standby server. If there are little or zero WAL to
replay, this will significantly reduce the duration of the second
stage. This is important because while the system in the second stage,
frontend cannot connect to Pgpool-II.

4 years agoFix pgpool_setup so that it creates separate archive directory for each DB node.
Tatsuo Ishii [Sun, 24 Jan 2021 02:55:12 +0000 (11:55 +0900)]
Fix pgpool_setup so that it creates separate archive directory for each DB node.

pgpool_setup created single archive directory for all PostgreSQL
nodes. This only works with streaming replication because only the
primary node produces archive log. However for native replication and
snapshot isolation mode this does not work as each node produces WAL.

In this fix dedicated archive directories like archivedir/data0
archivedir/data1 and so on are created.

4 years agoDoc: enhance online recovery document.
Tatsuo Ishii [Fri, 22 Jan 2021 06:05:33 +0000 (15:05 +0900)]
Doc: enhance online recovery document.

Add explanation what should be done in the recovery first stage and
second stage. Also add mention about snapshot isolation mode where
native replication mode is explained.

Remove accidentally left caution of script timeout in the Japanese
document.

4 years agoFix pgpool_recovery_pitr generation pgpool_setup.
Tatsuo Ishii [Fri, 22 Jan 2021 04:33:07 +0000 (13:33 +0900)]
Fix pgpool_recovery_pitr generation pgpool_setup.

It generated redundant psql definition line.

4 years agoDoc: fix indent.
Bo Peng [Thu, 21 Jan 2021 07:46:05 +0000 (16:46 +0900)]
Doc: fix indent.

4 years agoFix some variable names in follow_primary.sh.sample.
Bo Peng [Thu, 21 Jan 2021 07:00:40 +0000 (16:00 +0900)]
Fix some variable names in follow_primary.sh.sample.

Fix some variable names of "main" to "primary" which should be used in streaming replication mode.

4 years agoEnhance follow_primary.sh generation in pgpool_setup.
Tatsuo Ishii [Wed, 20 Jan 2021 08:17:02 +0000 (17:17 +0900)]
Enhance follow_primary.sh generation in pgpool_setup.

In the generated follow primary script pcp_recovery_node was used to
sync standby with new primary node.  However it is sufficient in
follow primary process to just restart standby with new recovery
configuration redirected to the new primary because we use the
"latest" timeline in the configuration file.

Moreover, from PostgreSQL 13, even restarting standby is not
needed. Just changing the recovery configuration and reloading is
enough. With these changes it is expected that the follow primary
process could be significantly faster than before.

4 years agoDoc: add explanation about the shared memory required by shared relation cache.
Tatsuo Ishii [Sat, 16 Jan 2021 10:15:57 +0000 (19:15 +0900)]
Doc: add explanation about the shared memory required by shared relation cache.

Add description to "Memory requirement" section so that in Pgpool-II
4.1 and after require additional shared memory for shared relation
cache.

4 years agoAdjusting the allowed range and default value for log_rotation_size
Muhammad Usama [Wed, 13 Jan 2021 10:55:28 +0000 (15:55 +0500)]
Adjusting the allowed range and default value for log_rotation_size

4 years agoFix error while allocating shared memory.
Tatsuo Ishii [Wed, 13 Jan 2021 09:49:51 +0000 (18:49 +0900)]
Fix error while allocating shared memory.

If num_init_children * max_pool is huge, pool_coninfo_size() failed to
calculate the size of required shared memory because the data type
used for the variable to store shared memory size was int and it
overflows for too large shared memory size. To fix this change
pool_coninfo_size() to size_t and use appropriate size_t for the
variable used within the function.

Also fix to use proper format qualifier in
pool_shared_memory_create().

4 years agoDoc: fix typos.
Bo Peng [Wed, 13 Jan 2021 00:18:56 +0000 (09:18 +0900)]
Doc: fix typos.

4 years agoFix follow_primary script creation in pgpool_setup.
Tatsuo Ishii [Tue, 12 Jan 2021 01:40:06 +0000 (10:40 +0900)]
Fix follow_primary script creation in pgpool_setup.

There were some confusions in variable names due to recent language
fix.  This fixes some of "main" to "primary" which should be used in
streaming replication mode.

4 years agoFix bug child_max_connections is not respected if ERROR occurs.
Tatsuo Ishii [Fri, 1 Jan 2021 02:29:04 +0000 (11:29 +0900)]
Fix bug child_max_connections is not respected if ERROR occurs.

When frontend aborts, the counter for child_max_connections is rewound
because ereport(ERROR) issues long jump. Fix is declaring the variable
with volatile qualifier. This is a long standing bug, probably since
child_max_connections was introduced.

4 years agoDoc: fix typos in docs.
Bo Peng [Sun, 27 Dec 2020 12:24:54 +0000 (21:24 +0900)]
Doc: fix typos in docs.

4 years agoDoc: fix a few typos in Japanese release notes.
Tatsuo Ishii [Sat, 26 Dec 2020 05:41:27 +0000 (14:41 +0900)]
Doc: fix a few typos in Japanese release notes.

4 years agoApply mega typo fixes.
Tatsuo Ishii [Sat, 26 Dec 2020 04:34:21 +0000 (13:34 +0900)]
Apply mega typo fixes.

Fixes for source code files including *.[chl] and regression scripts,
not only for comments but variable names and function names.

Documents (sgml and some text files) are also fixed.
See:
https://github.com/pgpool/pgpool2/pull/38
for more details.

Patch contributed by Josh Soref. Fixes for Japanese sgml files by me.

4 years agoDoc: few typo fixes.
Muhammad Usama [Fri, 25 Dec 2020 18:25:10 +0000 (23:25 +0500)]
Doc: few typo fixes.

4 years agoDoc: fix typo in the 4.2.1 release note.
Tatsuo Ishii [Wed, 23 Dec 2020 11:41:23 +0000 (20:41 +0900)]
Doc: fix typo in the 4.2.1 release note.

4 years agoDoc: add 4.2.1 release note.
Bo Peng [Wed, 23 Dec 2020 06:09:36 +0000 (15:09 +0900)]
Doc: add 4.2.1 release note.

4 years agoChange all of the pgpool.conf samples socket path to "/var/run/postgresql".
Bo Peng [Tue, 22 Dec 2020 12:10:28 +0000 (21:10 +0900)]
Change all of the pgpool.conf samples socket path to "/var/run/postgresql".

4 years agoDoc: Add missing raw mode to "5.3. Clustering mode" and fix typos.
Bo Peng [Tue, 22 Dec 2020 04:52:01 +0000 (13:52 +0900)]
Doc: Add missing raw mode to "5.3. Clustering mode" and fix typos.

4 years agoDoc: fix indent.
Bo Peng [Tue, 22 Dec 2020 02:23:49 +0000 (11:23 +0900)]
Doc: fix indent.

4 years agoFix incorrect heartbeat related results of "pcp_pool_status" and "SHOW POOL_STATUS...
Bo Peng [Sun, 20 Dec 2020 15:45:41 +0000 (00:45 +0900)]
Fix incorrect heartbeat related results of "pcp_pool_status" and "SHOW POOL_STATUS" commands.

4 years agoDoc: fix installation tips section example.
Tatsuo Ishii [Fri, 18 Dec 2020 07:01:13 +0000 (16:01 +0900)]
Doc: fix installation tips section example.

Previous commit was not sufficient.

4 years agoDoc: fix usage of firewall-cmd in the installation tips section.
Tatsuo Ishii [Fri, 18 Dec 2020 06:54:48 +0000 (15:54 +0900)]
Doc: fix usage of firewall-cmd in the installation tips section.

firewall-cmd opened unnecessary ports in the example.

4 years agoFix segfault when ALWAYS_PRIMARY is set but DISALLOW_TO_FAILOVER.
Tatsuo Ishii [Tue, 15 Dec 2020 10:38:04 +0000 (19:38 +0900)]
Fix segfault when ALWAYS_PRIMARY is set but DISALLOW_TO_FAILOVER.

If a primary node (for example node 0) has ALWAYS_PRIMARY but does
have DISALLOW_TO_FAILOVER, segfault happens in following step:

1) node 0 stops

2) failover happens. all children restart. The primary node is still 0
because ALWAYS_PRIMARY is set.

2) node 0 starts and it becomes online by using pcp_attach_node.

3) failback process is executed but child process do not restart.

4) child process accesses node 0 because Req_info->primary_node_id is
0 but connection to node 0 does not exist and this causes segfault.

To fix this, do additional check to make sure that failback node is
not former primary node. If it is, do full restart of child process.

Per bug 672.

4 years agoDoc: fix missing configuration example of clustering mode.
Bo Peng [Tue, 15 Dec 2020 07:58:06 +0000 (16:58 +0900)]
Doc: fix missing configuration example of clustering mode.

4 years agoUse single shared memory segment for all shared variables in Pgpool parent process
Muhammad Usama [Mon, 14 Dec 2020 10:41:37 +0000 (15:41 +0500)]
Use single shared memory segment for all shared variables in Pgpool parent process

Shared memory segments is a limited resource and opening too many segments
should be avoided.
Also the default limit for on some operating systems like
OS/X (kern.sysv.shmmni: 32) is very small that you have to increase
shmmni just to run Pgpool-II. 
So to avoid creating too many shared memory segments, the commit creates a
single shared memory segment big enough to hold all required shared memory
and put all shared memory variables within that segment one after the other.