pgpool2.git
5 years agoDoc: more language cleanup.
Tatsuo Ishii [Wed, 30 Sep 2020 01:47:36 +0000 (10:47 +0900)]
Doc: more language cleanup.

Replace "マスター" with "メイン".

5 years agoDoc: more language cleanup.
Tatsuo Ishii [Wed, 30 Sep 2020 01:37:28 +0000 (10:37 +0900)]
Doc: more language cleanup.

Replace "フォローマスター" with "フォロープライマリ".

5 years agoFix some language cleanup mistakes.
Tatsuo Ishii [Wed, 30 Sep 2020 00:45:00 +0000 (09:45 +0900)]
Fix some language cleanup mistakes.

5 years agotest case for dml object level load balance support
Muhammad Usama [Tue, 29 Sep 2020 18:31:54 +0000 (23:31 +0500)]
test case for dml object level load balance support

5 years agoFixing for an issue in dml object level load balance support
Muhammad Usama [Tue, 29 Sep 2020 18:30:10 +0000 (23:30 +0500)]
Fixing for an issue in dml object level load balance support

The comparison of objects should be done case insensitive 

5 years agoLogging sample scripts to pgpool stdout
Bo Peng [Fri, 25 Sep 2020 08:12:35 +0000 (17:12 +0900)]
Logging sample scripts to pgpool stdout

5 years agoMore language cleanup.
Tatsuo Ishii [Wed, 23 Sep 2020 09:33:04 +0000 (18:33 +0900)]
More language cleanup.

Patch contributed by Umar Hayat.

5 years agoDoc: update "Pgpool-II + Watchdog Setup Example".
Bo Peng [Tue, 22 Sep 2020 14:02:37 +0000 (23:02 +0900)]
Doc: update "Pgpool-II + Watchdog Setup Example".

5 years agoDoc: update "Pgpool-II + Watchdog Setup Example" and sample scripts.
Bo Peng [Tue, 22 Sep 2020 13:08:18 +0000 (22:08 +0900)]
Doc: update "Pgpool-II + Watchdog Setup Example" and sample scripts.

5 years agoDoc: update 4.2 release notes.
Tatsuo Ishii [Tue, 22 Sep 2020 02:30:33 +0000 (11:30 +0900)]
Doc: update 4.2 release notes.

Add language cleanup and wd_cli. Also fixes are from 4.1.4, rather
than 4.1.3 because 4.1.4 has been released.

5 years agoFix sample config files error.
Bo Peng [Mon, 21 Sep 2020 09:25:59 +0000 (18:25 +0900)]
Fix sample config files error.

5 years agoApply language cleanup mega patch.
Tatsuo Ishii [Thu, 17 Sep 2020 04:41:44 +0000 (13:41 +0900)]
Apply language cleanup mega patch.

black/white_function_list -> write_function_list, read_only_function_list
black_query_pattern -> primay_routing_query_pattern
black/white_memqcache_table_list -> cache_unsafe/cache_safe_table_list

Watchdog: replace master to 'leader' for 'master' watchdog nodes

ALWAYS_MASTER flag is changed to ALWAYS_PRIMARY.

Replace relcache_query_target option 'master' to 'primary'.

Replace Master Node with Main node ( node id with 0 or youngest live ).

Replace follow_master with follow_primary with parameters.

Replace some remaining occurrences of master with primary/main/leader

Patch contributed by: Umar Hayat
Reviewed by me:

5 years agoAdd wd_cli Japanese doc.
Tatsuo Ishii [Wed, 16 Sep 2020 23:44:06 +0000 (08:44 +0900)]
Add wd_cli Japanese doc.

Also small tweaks to English doc.

5 years agoDocumentation update for wd_cli utility
Muhammad Usama [Wed, 16 Sep 2020 13:41:16 +0000 (18:41 +0500)]
Documentation update for wd_cli utility

Few typo fixes are also part of the commit

5 years agoDoc: add more release note.
Bo Peng [Wed, 16 Sep 2020 08:20:46 +0000 (17:20 +0900)]
Doc: add more release note.

5 years agoDoc: fix the incorrect description regarding the running modes of Pgpoo-II in which...
Bo Peng [Wed, 16 Sep 2020 08:01:33 +0000 (17:01 +0900)]
Doc: fix the incorrect description regarding the running modes of Pgpoo-II in which online recovery is available.

5 years agoRefactor show pool_version and pool_processes.
Tatsuo Ishii [Wed, 16 Sep 2020 06:04:26 +0000 (15:04 +0900)]
Refactor show pool_version and pool_processes.

Refactoring by using send_row_description_and_data_rows().

5 years agoRefactor show pool_heath_check_stats.
Tatsuo Ishii [Wed, 16 Sep 2020 05:28:17 +0000 (14:28 +0900)]
Refactor show pool_heath_check_stats.

Refactoring by using send_row_description_and_data_rows().

5 years agoDoc: Add relesae note 3.5.27 - 4.1.4.
Bo Peng [Wed, 16 Sep 2020 01:46:37 +0000 (10:46 +0900)]
Doc: Add relesae note 3.5.27 - 4.1.4.

5 years agoFix coverity issues.
Bo Peng [Tue, 15 Sep 2020 12:53:44 +0000 (21:53 +0900)]
Fix coverity issues.

5 years agoFix compiler warning.
Bo Peng [Mon, 14 Sep 2020 02:46:40 +0000 (11:46 +0900)]
Fix compiler warning.

5 years agoFix Coverity issues.
Bo Peng [Mon, 14 Sep 2020 02:39:04 +0000 (11:39 +0900)]
Fix Coverity issues.

5 years agoFix double free problem in send_row_description_and_data_rows().
Tatsuo Ishii [Mon, 14 Sep 2020 08:14:44 +0000 (17:14 +0900)]
Fix double free problem in send_row_description_and_data_rows().

Pointed out by Coverity.

5 years agoRemove unnecessary checks in some code path.
Tatsuo Ishii [Sun, 13 Sep 2020 23:09:18 +0000 (08:09 +0900)]
Remove unnecessary checks in some code path.

Patch contributed by Hou, Zhijie.
Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2020-September/003805.html

5 years agoFollow the guide line of PostgreSQL 12.4 regarding extensions.
Tatsuo Ishii [Sun, 13 Sep 2020 11:14:42 +0000 (20:14 +0900)]
Follow the guide line of PostgreSQL 12.4 regarding extensions.

CREATE OR REPLACE FUNCTION should be avoided. Use CREATE FUNCTION instead.

5 years agoDoc: remove unnecessary SQL parser additions in 4.2 release notes.
Tatsuo Ishii [Sun, 13 Sep 2020 06:06:57 +0000 (15:06 +0900)]
Doc: remove unnecessary SQL parser additions in 4.2 release notes.

5 years agoDoc: fix English comment in the 4.2 Japanese release note.
Tatsuo Ishii [Sat, 12 Sep 2020 12:14:35 +0000 (21:14 +0900)]
Doc: fix English comment in the 4.2 Japanese release note.

5 years agoDoc: fix more typo in 4.2 English release note.
Tatsuo Ishii [Sat, 12 Sep 2020 12:13:01 +0000 (21:13 +0900)]
Doc: fix more typo in 4.2 English release note.

5 years agoDoc: fix typo in release notes.
Tatsuo Ishii [Sat, 12 Sep 2020 12:00:56 +0000 (21:00 +0900)]
Doc: fix typo in release notes.

5 years agoAdd Pgpool-II 4.2 English release notes.
Tatsuo Ishii [Sat, 12 Sep 2020 11:52:04 +0000 (20:52 +0900)]
Add Pgpool-II 4.2 English release notes.

5 years agoDoc: Pgpool-II 4.2 release note (Japanese) almost done.
Tatsuo Ishii [Fri, 11 Sep 2020 07:15:03 +0000 (16:15 +0900)]
Doc: Pgpool-II 4.2 release note (Japanese) almost done.

5 years agoUpdate SPEC file to 4.2.
Bo Peng [Thu, 10 Sep 2020 08:49:21 +0000 (17:49 +0900)]
Update SPEC file to 4.2.

5 years agoFix compiler error on some platforms.
Bo Peng [Thu, 10 Sep 2020 05:59:26 +0000 (14:59 +0900)]
Fix compiler error on some platforms.

5 years agoAdd AC_PROG_CC_C99 in configure.ac file and fix build error introduced by commit...
Bo Peng [Wed, 9 Sep 2020 11:43:07 +0000 (20:43 +0900)]
Add AC_PROG_CC_C99 in configure.ac file and fix build error introduced by commit a8cc1e26cc204a49bea47eea05c711a981c17484.

5 years agoFix for coverity issue CID:1430581 Resource leak
Muhammad Usama [Tue, 8 Sep 2020 08:21:03 +0000 (13:21 +0500)]
Fix for coverity issue CID:1430581 Resource leak

5 years agoDoc: add dml-adaptive Japanese doc.
Tatsuo Ishii [Tue, 8 Sep 2020 02:06:45 +0000 (11:06 +0900)]
Doc: add dml-adaptive Japanese doc.

5 years agoDoc: in progress work on 4.2 release note.
Tatsuo Ishii [Mon, 7 Sep 2020 06:25:06 +0000 (15:25 +0900)]
Doc: in progress work on 4.2 release note.

Finish to add enhancements from git log (English).

5 years agoFeature: Import PostgreSQL 13 beta3 new parser.
Bo Peng [Mon, 7 Sep 2020 00:45:29 +0000 (09:45 +0900)]
Feature: Import PostgreSQL 13 beta3 new parser.

Major changes of PostgreSQL 13 parser include:

- Remove an object's dependency on an extension

  ALTER TRIGGER ... NO DEPENDS ON EXTENSION ...
  ALTER FUNCTION ... NO DEPENDS ON EXTENSION ...

- Allow FETCH FIRST to use WITH TIES

  FETCH FIRST ... WITH TIES

- Add ALTER TABLE clause DROP EXPRESSION

  ALTER TABLE ... DROP EXPRESSION

- Allow setting statistics target for extended statistics

  ALTER STATISTICS ... SET STATISTICS

- Allow ALTER VIEW to rename view columns

  ALTER VIEW ... RENAME COLUMN ... TO ...

- Add CREATE DATABASE clause LOCALE option

  CREATE DATABASE ... LOCALE

- Add DROP DATABASE clause WITH FORCE option

  DROP DATABASE ... WITH (force)

- Add VACUUM clause PARALLEL option

  VACUUM (PARALLEL 1) ...

5 years agoFix relcache query sometimes sent to other than primary.
Tatsuo Ishii [Sun, 6 Sep 2020 10:52:56 +0000 (19:52 +0900)]
Fix relcache query sometimes sent to other than primary.

In streaming replication mode, relcache queries are supposed to be
sent to the primary node.  But actually they were not sent the primary
node if primary node was not the master node. Typically this could
happen when the primary is not node 0.

5 years agoDoc: Add "Migration to 4.2" section to 4.2 release note.
Tatsuo Ishii [Fri, 4 Sep 2020 06:10:17 +0000 (15:10 +0900)]
Doc: Add "Migration to 4.2" section to 4.2 release note.

5 years agoDoc: fix 4.1.0 release date.
Tatsuo Ishii [Fri, 4 Sep 2020 04:41:24 +0000 (13:41 +0900)]
Doc: fix 4.1.0 release date.

5 years agoDoc: start to create 4.2 release note.
Tatsuo Ishii [Fri, 4 Sep 2020 04:29:07 +0000 (13:29 +0900)]
Doc: start to create 4.2 release note.

5 years agoDoc: add Pgpool-II/PostgreSQL start/stop etc. documents.
Tatsuo Ishii [Tue, 1 Sep 2020 08:15:14 +0000 (17:15 +0900)]
Doc: add Pgpool-II/PostgreSQL start/stop etc. documents.

5 years agoRemove obsolete use of master_slave_sub_mode.
Tatsuo Ishii [Tue, 1 Sep 2020 07:12:14 +0000 (16:12 +0900)]
Remove obsolete use of master_slave_sub_mode.

Eventually we should remove it from pool_config_variable.c etc. as
well.

5 years agoFix connection_life_time not working when serialize_accept is enabled.
Tatsuo Ishii [Tue, 1 Sep 2020 03:21:50 +0000 (12:21 +0900)]
Fix connection_life_time not working when serialize_accept is enabled.

If serialize_accept is enabled, pgpool child process tries to acquire
semaphore locking so that there's only one process which can issue
accept(2). Unfortunately if connection_life_time is enabled, an alarm
is set right before the semaphore locking. So when the alarm fires,
nothing happened because the process was in acquiring semaphore lock
loop by using pool_semaphore_lock().

To fix this new pool_semaphore_lock_allow_interrupt() is introduced,
which immediately returns if interrupted by a signal. The caller:
wait_for_new_connections() checks whether connection_life_time alarm
is fired. If so, call backend_timer() to close expired backend
connection cache.

Discussion: https://www.pgpool.net/pipermail/pgpool-general/2020-August/007233.html

5 years agoAdd .gitignore files.
Bo Peng [Mon, 31 Aug 2020 01:54:11 +0000 (10:54 +0900)]
Add .gitignore files.

5 years agoDisplay more informative error message in authentication process.
Tatsuo Ishii [Sun, 30 Aug 2020 02:12:09 +0000 (11:12 +0900)]
Display more informative error message in authentication process.

When backends offers mistakenly different authentication methods,
pgpool just showed:

"unable to read message length"
"message length (%d) in slot %d does not match with slot 0(%d)", length, i, length0)));

because pool_read_message_length() called ereport(ERROR) in this
case. Actually the caller pool_do_auth() prepared more informative
message:

ereport(ERROR,
(errmsg("invalid authentication packet from backend"),
 errdetail("failed to get the authentication packet length"),
 errhint("This is likely caused by the inconsistency of auth method among DB nodes. \
Please check the previous error messages (hint: length field) \
from pool_read_message_length and recheck the pg_hba.conf settings.")));

Change ereport(ERROR) to ereport(LOG) in pool_read_message_length() so
that the informative message actually shows up.

5 years agoAdd changes to src/config/pool_config.l and regenerate src/config/pool_config.c.
Bo Peng [Sat, 29 Aug 2020 23:29:38 +0000 (08:29 +0900)]
Add changes to src/config/pool_config.l and regenerate src/config/pool_config.c.
That is missed in previous commit a840ecb2c0aa15448f7fc63a7b0bb46949a9c24f.

5 years agoAdd log_disconnections parameter
Takuma Hoshiai [Mon, 24 Aug 2020 02:09:32 +0000 (11:09 +0900)]
Add log_disconnections parameter

Add log_disconnections parameter like as postgresql. If it enable,
pgpool can log client disconnection and session time.

5 years agoFix occasional 073.pg_terminate_backend test failure.
Tatsuo Ishii [Fri, 21 Aug 2020 23:25:52 +0000 (08:25 +0900)]
Fix occasional 073.pg_terminate_backend test failure.

The test occasionally fails with native replication mode. Let the sleep
before checking connection count a little bit longer to ensure that
the count is properly collected. Also emit timestamp of the counting
so that it actually should collect proper data.

5 years agoFix sefault in pgpool child process in certain case.
Tatsuo Ishii [Fri, 21 Aug 2020 10:51:04 +0000 (19:51 +0900)]
Fix sefault in pgpool child process in certain case.

When all backend go down, pgpool refuses to accept connection from
clients and try to send a message in
validate_backend_connectivity(). For this purpose it connects to the
client and try to read the startup packet. This is done in a PG_TRY
block. The startup packet is read in memory pointed to by "sp", which
is declared as "StartupPacket *volatile". This is fine. But it was
forgotten to initialize the value with NULL. As a result, if reading
startup packet fails, sp would be garbage a pointer and segfaults later
in pool_free_startup_packet(sp).

Fix is, initialize "sp" with NULL.

I have found this accidentally in following way:

1) shutdown all backends.

2) connect to pgpool with invalid client. I have used pcp_attach_node
with pgpool's port number, not pcp's.

5 years agoFix pgpool.spec.
Bo Peng [Wed, 19 Aug 2020 15:26:29 +0000 (00:26 +0900)]
Fix pgpool.spec.

5 years agoAdd missing files by provious commit.
Bo Peng [Wed, 19 Aug 2020 12:38:40 +0000 (21:38 +0900)]
Add missing files by provious commit.

5 years agoReplace "PGBIN" and "LPATH" in pgpool_setup and watchdog_setup using PostgreSQL's...
Bo Peng [Wed, 19 Aug 2020 12:05:11 +0000 (21:05 +0900)]
Replace "PGBIN" and "LPATH" in pgpool_setup and watchdog_setup using PostgreSQL's bin path and lib path.

5 years agoDoc: add release note.
Bo Peng [Tue, 18 Aug 2020 02:07:46 +0000 (11:07 +0900)]
Doc: add release note.

5 years agoDoc: update pgpool_setup's example session.
Tatsuo Ishii [Tue, 18 Aug 2020 04:56:09 +0000 (13:56 +0900)]
Doc: update pgpool_setup's example session.

5 years agoDoc: mention that pgpool_setup needs to configure ssh log into localhost without...
Tatsuo Ishii [Tue, 18 Aug 2020 03:05:58 +0000 (12:05 +0900)]
Doc: mention that pgpool_setup needs to configure ssh log into localhost without password.

5 years agoDoc: fix typo in show_pool_backend_stats.sgml.
Tatsuo Ishii [Tue, 18 Aug 2020 02:57:05 +0000 (11:57 +0900)]
Doc: fix typo in show_pool_backend_stats.sgml.

5 years agoFix 073.pg_terminate_backend test failure.
Tatsuo Ishii [Mon, 17 Aug 2020 08:09:42 +0000 (17:09 +0900)]
Fix 073.pg_terminate_backend test failure.

The test failed because before pg_sleep(10) finished, pgpool shut down.
As a result, connection counting did not have a chance to count down.
Adding proper sleep in the script should fix the problem.

Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2020-August/003766.html

5 years agoDoc: Change sample scripts and yum repository urls.
Bo Peng [Mon, 17 Aug 2020 05:49:12 +0000 (14:49 +0900)]
Doc: Change sample scripts and yum repository urls.

5 years agoUse pg_config to get PostgreSQL lib path and add this path to LD_LIBRARY_PATH environ...
Bo Peng [Mon, 17 Aug 2020 04:46:36 +0000 (13:46 +0900)]
Use pg_config to get PostgreSQL lib path and add this path to LD_LIBRARY_PATH environment paramater in regress.sh.

5 years agoDoc: add description to "show pool_backend_stats".
Tatsuo Ishii [Mon, 17 Aug 2020 00:09:13 +0000 (09:09 +0900)]
Doc: add description to "show pool_backend_stats".

Mention that failed commands are also counted.

5 years agoFix error count stats.
Tatsuo Ishii [Sun, 16 Aug 2020 22:47:11 +0000 (07:47 +0900)]
Fix error count stats.

Unnecessary error count stats collecting route was left in commit:
f04ef82be528c5e5e706f9e2e7231db369427eee.

5 years agoFix pgpool_setup so that native replication mode and SI mode works with PostgreSQL 12.
Tatsuo Ishii [Sat, 15 Aug 2020 09:01:38 +0000 (18:01 +0900)]
Fix pgpool_setup so that native replication mode and SI mode works with PostgreSQL 12.

In these mode, it created recovery.conf which is not allowed in
PostgreSQL 12.

5 years agoFix oversight in connection_life_time fix.
Tatsuo Ishii [Sat, 15 Aug 2020 03:37:39 +0000 (12:37 +0900)]
Fix oversight in connection_life_time fix.

Commit 39eb90fe199d03253b99bec38d85c40f66aa55ab did not consider the case
when node is down connection struct is NULL. As a result, segfault occurred.

5 years agoDoc: add Japanese manual for "show pool_backend_stats".
Tatsuo Ishii [Fri, 14 Aug 2020 12:07:05 +0000 (21:07 +0900)]
Doc: add Japanese manual for "show pool_backend_stats".

5 years agoFix error stats.
Tatsuo Ishii [Fri, 14 Aug 2020 09:00:55 +0000 (18:00 +0900)]
Fix error stats.

Error stats was only collected from Master node. It is possible that
error occurred in multiple backends (for example, in native
replication mode, INSERT is accepted by the parser but target table
does not exist).  Change the place where to collect error stats from
SimpleForwardToFrontend() to read_kind_from_backend().

5 years agoAdd error stats from backend to "show pool_backend_stats" command.
Tatsuo Ishii [Fri, 14 Aug 2020 06:42:58 +0000 (15:42 +0900)]
Add error stats from backend to "show pool_backend_stats" command.

5 years agoCheck panic or fatal error by using 'V' token if available.
Tatsuo Ishii [Fri, 14 Aug 2020 05:15:22 +0000 (14:15 +0900)]
Check panic or fatal error by using 'V' token if available.

To identify panic or fatal message in is_panic_or_fatal_error(), 'S'
token was used.  However 'S' could be localized and simply comparing
"PANIC" or "FATAL" with the message may not work. Instead 'V' should be
used if possible because it's not localized.

5 years agoAdd new show command "show pool_backend_stats".
Tatsuo Ishii [Fri, 14 Aug 2020 04:53:57 +0000 (13:53 +0900)]
Add new show command "show pool_backend_stats".

The new command shows the number SQL commands executed since Pgpool-II
started.

Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2020-July/003754.html

5 years agoFix 031.connection_life_time regression test failure.
Bo Peng [Fri, 14 Aug 2020 02:18:25 +0000 (11:18 +0900)]
Fix 031.connection_life_time regression test failure.

5 years agoAdd statistics for INSERT/UPDATE/DELETE etc. SQL commands.
Tatsuo Ishii [Fri, 14 Aug 2020 01:45:54 +0000 (10:45 +0900)]
Add statistics for INSERT/UPDATE/DELETE etc. SQL commands.

We already allow to collect stats for SELECT, but it would be useful
to collect stats for other types of SQL commands. APIs to fetch stats
data is also added. No UI is added yet. Currently, any SQL commands
(besides SELECT/INSERT/UPDATE/DELETE) other than:

case(T_CheckPointStmt):
case(T_DeallocateStmt):
case(T_DiscardStmt):
case(T_ExecuteStmt):
case(T_ExplainStmt):
case(T_ListenStmt):
case(T_LoadStmt):
case(T_LockStmt):
case(T_NotifyStmt):
case(T_PrepareStmt):
case(T_TransactionStmt):
case(T_UnlistenStmt):
case(T_VacuumStmt):
case(T_VariableSetStmt):
case(T_VariableShowStmt):

are counted as DDL commands.
Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2020-July/003754.html

5 years agoRefactor "show pool_nodes" command.
Tatsuo Ishii [Fri, 14 Aug 2020 01:29:21 +0000 (10:29 +0900)]
Refactor "show pool_nodes" command.

Now number of codes in nodes_reporting() is dramatically reduced by
introducing send_row_description_and_data_rows(), a workhorse to
produce reports. Eventually other reporting functions will be
refactored as well.

5 years agoBefore running regression test clean the remaining processes and sockets.
Bo Peng [Thu, 13 Aug 2020 06:35:34 +0000 (15:35 +0900)]
Before running regression test clean the remaining processes and sockets.

5 years agoDoc: mention that ssl_ciphers only affects to TLS 1.2 and lower.
Tatsuo Ishii [Wed, 12 Aug 2020 11:17:44 +0000 (20:17 +0900)]
Doc: mention that ssl_ciphers only affects to TLS 1.2 and lower.

The changes are imported from PostgreSQL manual.

5 years agoRemove some unnecessary settings from sample config files.
Bo Peng [Wed, 12 Aug 2020 07:45:27 +0000 (16:45 +0900)]
Remove some unnecessary settings from sample config files.

5 years agoAt pgpool startup, if pid file exists, truncate pid file to zero length before writing.
Bo Peng [Wed, 12 Aug 2020 07:07:04 +0000 (16:07 +0900)]
At pgpool startup, if pid file exists, truncate pid file to zero length before writing.

Patch is created by maliangzhu.

5 years agoDoc: fix failback_command documetation error.
Bo Peng [Tue, 11 Aug 2020 14:58:51 +0000 (23:58 +0900)]
Doc: fix failback_command documetation error.

5 years agoDoc: add sample script links in configuration example.
Bo Peng [Tue, 11 Aug 2020 14:18:39 +0000 (23:18 +0900)]
Doc: add sample script links in configuration example.

5 years agoMake RPMs to include pcp.conf and pool_hba.conf sample files.
Bo Peng [Tue, 11 Aug 2020 09:17:42 +0000 (18:17 +0900)]
Make RPMs to include pcp.conf and pool_hba.conf sample files.

5 years agoMake RPMs to include new sample files.
Bo Peng [Tue, 11 Aug 2020 08:34:49 +0000 (17:34 +0900)]
Make RPMs to include new sample files.

5 years agoFix connection_life_time does not work.
Tatsuo Ishii [Tue, 11 Aug 2020 01:26:43 +0000 (10:26 +0900)]
Fix connection_life_time does not work.

If master node is not 0 (this could happen in the case when primary
node is not 0 in streaming replication mode for example), pgpool
failed to find connection_life_time timer because the timer was set
only in virtual_master_node, which could be changed after session ends
since query context is not there any more.

To fix this, connection_life_time timer is set to all valid nodes.

Regression test is also added.

Discussion: https://www.pgpool.net/pipermail/pgpool-general/2020-August/007242.html

5 years agoNew feature: Simplify Watchdog related configuration parameters.
Bo Peng [Mon, 10 Aug 2020 15:57:46 +0000 (00:57 +0900)]
New feature: Simplify Watchdog related configuration parameters.

This commit simplifies watchdog related configuration parameters
by using a common config file for each pgpool node and a pgpool_node_id file.

Previously we need to configure the following parameters on each pgpool node,
because of the difference between local and remote pgpool nodes settings.
- wd_hostname
- wd_port
- wd_heartbeat_port
- heartbeat_device
- heartbeat_destination0
- heartbeat_destination_port0
- heartbeat_destination1
- heartbeat_destination_port1
- other_pgpool_hostname0
- other_pgpool_port0
- other_wd_port0
- other_pgpool_hostname1
- other_pgpool_port1
- other_wd_port1

This commit simplifies watchdog related configuration by using a common config file
for each pgpool node and a pgpool_node_id file, and users just copy the configuration file
to each pgpool node without editing.

The parameters above are changed to (for 3 pgpool nodes):
(For example)
==============================
 hostname0 = 'server1'
 wd_port0 = 9000
 pgpool_port0 = 9999

 hostname1 = 'server2'
 wd_port1 = 9000
 pgpool_port1 = 9999

 hostname2 = 'server3'
 wd_port2 = 9000
 pgpool_port2 = 9999

 heartbeat_hostname0 = 'server1'
 heartbeat_port0 = 9694
 heartbeat_device0 = ''

 heartbeat_hostname1 = 'server2'
 heartbeat_port1 = 9694
 heartbeat_device1 = ''

 heartbeat_hostname2 = 'server3'
 heartbeat_port2 = 9694
 heartbeat_device2 = ''
==============================

You can specify multiple configurations in "heartbeat_hostname" and "heartbeat_device" by separating
them using semicolon (;).

And user needs to specify local pgpool node id in a pgpool_node_id file on each pgpool node.
pgpool_node_id file should be created in the direcroty of pgpool.conf.

In addition, this commit increases "WD_MESSAGE_DATA_VERSION_MINOR" to "2".

5 years agoFix oversight in previous commit for pgpool_setup.
Tatsuo Ishii [Fri, 7 Aug 2020 00:21:34 +0000 (09:21 +0900)]
Fix oversight in previous commit for pgpool_setup.

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

left standby.signal in the recovery target node in case when pg_rewind
is used.  As a result, the standby node became primary after
restart.

5 years agoFix query cache bug.
Tatsuo Ishii [Wed, 5 Aug 2020 02:37:28 +0000 (11:37 +0900)]
Fix query cache bug.

If EXPLAIN ANALYZE takes data-modifying SQL, it must invalidate query
cache, but actually it was missed.

Author: Hou, Zhijie
Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2020-August/003767.html

5 years agoFix pgpool_setup problem with -r option and PostgreSQL 12.
Tatsuo Ishii [Wed, 5 Aug 2020 01:47:06 +0000 (10:47 +0900)]
Fix pgpool_setup problem with -r option and PostgreSQL 12.

pgpool_setup -r uses pg_rewind if it's possible. After rewinding,
pgpool_setup failed to create standby.signal file, which is required in
PostgreSQL 12 or later, on the recovered target node. As a result, the
recovered node booted up as a primary server, rather than a standby
server.

Discussion: https://www.pgpool.net/mantisbt/view.php?id=624

5 years agoImplement automatic writing function detection by checking volatile property.
Tatsuo Ishii [Sun, 2 Aug 2020 07:00:41 +0000 (16:00 +0900)]
Implement automatic writing function detection by checking volatile property.

If a function included in SELECT/WITH has volatile property by
checking system catalog, regard it a writing function. This feature is
available only when the black_function_list and the
white_function_list are both empty. The default of the
black_function_list and the white_function_list are now empty string
so that this feature is enabled by default.

If the black_function_list or the white_function_list is not empty,
keep on existing behavior (only consult the black_function_list or the
white_function_list, not access system catalog).

Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2020-July/003730.html
Reviewed-by: Hou, Zhijie
5 years agoChange PCP UNIX_DOMAIN_PATH of RPM package to "/var/run/postgresql".
Bo Peng [Fri, 31 Jul 2020 00:45:39 +0000 (09:45 +0900)]
Change PCP UNIX_DOMAIN_PATH of RPM package to "/var/run/postgresql".

5 years agoDoc: clarify what the command actual does.
Tatsuo Ishii [Tue, 28 Jul 2020 02:36:11 +0000 (11:36 +0900)]
Doc: clarify what the command actual does.

Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2020-July/003744.html
Reviewed-by: Bo Peng
5 years agoFix Coverity warning.
Tatsuo Ishii [Mon, 27 Jul 2020 10:01:56 +0000 (19:01 +0900)]
Fix Coverity warning.

CID 1430580:  Null pointer dereferences  (REVERSE_INULL).
Patch provided by Hou, Zhijie.

5 years agoRename src/redhat/pgpool_rhel7.sysconfig to src/redhat/pgpool_rhel.sysconfig to make...
Bo Peng [Mon, 27 Jul 2020 02:40:25 +0000 (11:40 +0900)]
Rename src/redhat/pgpool_rhel7.sysconfig to src/redhat/pgpool_rhel.sysconfig to make this file available on RHEL8/CentOS8.

5 years agoEnhance the way getting function names in multiple places.
Tatsuo Ishii [Sun, 26 Jul 2020 01:04:36 +0000 (10:04 +0900)]
Enhance the way getting function names in multiple places.

With query cache enabled, Pgpool-II examines function calls in
SELECTs. However if a function were called with schema qualification,
it was not recognized. This commit fix to allow schema qualifications
in the case.

Also we did not allow schema qualified function names in
black_function_list and white_function_list. The limitation is also
fixed in this commit. Note that if you want to register schema
qualified function names, you have to register function names without
schema qualification as well.

Patch contributed by Hou, Zhijie, Reviewed by me.
Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2020-July/003718.html
Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2020-July/003732.html

5 years agoFix typos.
Bo Peng [Wed, 22 Jul 2020 01:23:13 +0000 (10:23 +0900)]
Fix typos.

Patch is created by Lu, Chenyang.

5 years agoNew feature: dml dml object level load balance support
Muhammad Usama [Tue, 21 Jul 2020 09:14:00 +0000 (14:14 +0500)]
New feature: dml dml object level load balance support

Patch contributed by Sunbiao<sunbiao@highgo.com> and
some enhancements done by me

5 years agoDoc: fix explanation about how to decide load balance node.
Tatsuo Ishii [Fri, 17 Jul 2020 01:02:51 +0000 (10:02 +0900)]
Doc: fix explanation about how to decide load balance node.

It should have mentioned about statement_level_load_balance.

5 years agoDoc: fix typo in memqcache doc.
Tatsuo Ishii [Thu, 16 Jul 2020 10:46:33 +0000 (19:46 +0900)]
Doc: fix typo in memqcache doc.

Patch contributed by Hou, Zhijie.
Discussion: https://www.pgpool.net/pipermail/pgpool-general/2020-July/007204.html

5 years agoPrevent data modifying CTE to be cached.
Tatsuo Ishii [Tue, 14 Jul 2020 12:56:14 +0000 (21:56 +0900)]
Prevent data modifying CTE to be cached.

Data modifying CTE was mistakenly treated as normal read only CTE and
result query was created.  As a result subsequent CTE was not
executed.

Problem reported and patch created by Hou, Zhijie.
Subtle changes to the regression test by me.
Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2020-July/003705.html

5 years ago Doc: update "Installation from RPM" section.
Bo Peng [Fri, 10 Jul 2020 02:37:22 +0000 (11:37 +0900)]
 Doc: update "Installation from RPM" section.

5 years agoFix pgpool hang in a corner case.
Tatsuo Ishii [Thu, 9 Jul 2020 00:11:03 +0000 (09:11 +0900)]
Fix pgpool hang in a corner case.

It is possible that an "out of band" message from backend has been
read into buffer at the time when a ready for query message is
processed. If the messages are from all backends, there should be no
problem because ProcessBackendResponse() will read the messages from
all backends by using read_kind_from_backend(). However there could be
a corner case: 1) If the message is coming from only one of backend
(this could happen when recovery conflict or backend receiving SIGTERM
and so on) and 2) the message is already in the backend read
buffer. In this case pgpool will hang in pool_read() called by
read_kind_from_backend() at either: 1)
read_kind_from_one_backend(frontend, backend, (char *) &kind,
MASTER_NODE_ID) (the message is not coming from master backend) or 2)
pool_read(CONNECTION(backend, i), &kind, 1) (the message is not coming
from other than master).

Note If the message is not in the buffer, there should be no problem
since read_packets_and_process() will take care that "out of band"
messages.

The solution is, read and discard such a message in ReadyforQuery(),
emitting log to make sure that the read buffer is empty after
returning from ReadyForQuery(). (remember that unless the ready for
query message is returned to frontend, the frontend will not issue
next query and there's should be no response from backend except the
out of band messages).

If the message was FATAL, the backend will disconnect to pgpool. So
next time pgpool should notice that the connection is closed anyway.

For the master branch, probably we should treat that kind of FATAL
message in a same way as read_packets_and_process() already does. This
requires some code refactoring and I would like to leave the job
separated from this commit.

5 years agoFix per_node_error_log() so that it respects unread parameter.
Tatsuo Ishii [Wed, 8 Jul 2020 01:25:12 +0000 (10:25 +0900)]
Fix per_node_error_log() so that it respects unread parameter.

per_node_error_log() unconditionally set the "unread" parameter to
true when it should have respected the unread parameter given by user.
It seems all callers to per_node_error_log() set the unread parameter
to true anyway.  The only exception is pool_do_auth. As far as testing
test 03[0-4] regression tests, the change is ok.

In summary this change will not affect to Pgpool-II but bug is bug.