pgpool2.git
8 years agoFix pgpool child process segfault reported in [pgpool-hackers: 2312].
Tatsuo Ishii [Thu, 4 May 2017 08:00:02 +0000 (17:00 +0900)]
Fix pgpool child process segfault reported in [pgpool-hackers: 2312].

When MASTER macro calls, pool_virtual_master_db_node_id() which calls
pool_get_preferred_master_node_id() if there's no query context
exists. The segfault happens in deciding the load balance node while
initializing the session context in the child process starting up. The
session context is first initialized with all 0, then
pool_get_preferred_master_node_id() returns 0 as the preferred node
id. This is fine as long as node 0 is healthy. However if node 0 goes
down and failover happens, this is not fine any more since the
connection slot 0 is empty and it causes the segfault.

Fix it by removing preferred_master_node_id staffs since it seems it
is not used anymore.

8 years agoFix compile error.
pengbo [Mon, 1 May 2017 00:37:31 +0000 (09:37 +0900)]
Fix compile error.

8 years agoEnable AM_MAINTAINER_MODE.
Tatsuo Ishii [Sun, 30 Apr 2017 08:04:00 +0000 (17:04 +0900)]
Enable AM_MAINTAINER_MODE.

This allows to automatically create bison/flex derived files.  Should
be reverted once 3.7 beta released.

8 years agoAdd release notes.
pengbo [Fri, 28 Apr 2017 06:25:58 +0000 (15:25 +0900)]
Add release notes.

8 years agoAdd 3.6.3 - 3.2.20 release note.
pengbo [Thu, 27 Apr 2017 09:39:51 +0000 (18:39 +0900)]
Add 3.6.3 - 3.2.20 release note.

8 years agoAdd per node health check parameters and sample configurations.
Tatsuo Ishii [Wed, 26 Apr 2017 00:27:35 +0000 (09:27 +0900)]
Add per node health check parameters and sample configurations.

This is just adding new data structure.

8 years agoImplement infrastructure for supporting per node health check parameters.
Tatsuo Ishii [Thu, 20 Apr 2017 00:36:46 +0000 (09:36 +0900)]
Implement infrastructure for supporting per node health check parameters.

Now pgpool main process forks health check process for each DB node.
Also autotools is now updated from 1.14 to 1.15.

TODO:
- Implement per node health check parameters.

8 years agoFix "show pool_cache" segfault when memcached is used.
Tatsuo Ishii [Tue, 18 Apr 2017 01:27:14 +0000 (10:27 +0900)]
Fix "show pool_cache" segfault when memcached is used.

The problem is reported in:
http://www.pgpool.net/mantisbt/view.php?id=301

pool_get_shmem_storage_stats() was mistakenly modified when 3.6 was
developed.

The bug was introduced in 3.6.0. Previous versions do not have the
problem.

8 years agoFix for some more code warnings.
Muhammad Usama [Fri, 14 Apr 2017 15:16:45 +0000 (20:16 +0500)]
Fix for some more code warnings.

uint64 definition was not uniform across the code.

8 years agoFixing some annoying compiler warnings.
Muhammad Usama [Fri, 14 Apr 2017 14:34:40 +0000 (19:34 +0500)]
Fixing some annoying compiler warnings.

8 years agoRemoving the function defined but not used warnings from pool_config_vatiable.c
Muhammad Usama [Fri, 14 Apr 2017 13:10:29 +0000 (18:10 +0500)]
Removing the function defined but not used warnings from pool_config_vatiable.c

8 years agoRemoving the references of obsolete debug_level configuration parameter.
Muhammad Usama [Fri, 14 Apr 2017 12:46:37 +0000 (17:46 +0500)]
Removing the references of obsolete debug_level configuration parameter.

configuration parameter 'debug_level' has given way to
'log_min_messages' after the adoption of exception manager.

8 years agoFixing a mistake in the watchdog code.
Muhammad Usama [Wed, 12 Apr 2017 15:33:20 +0000 (20:33 +0500)]
Fixing a mistake in the watchdog code.

wrong conditional statement in the get_wd_command_from_reply() function was
making the watchdog to not reliably identify the internal command responses,
and in one case the completed watchdog internal command were not getting
cleaned up.
commit also adds some debug messages in the watchdog code.

8 years agoFix for 0000299: Errors on the reloading of configuration
Muhammad Usama [Wed, 12 Apr 2017 14:02:03 +0000 (19:02 +0500)]
Fix for 0000299: Errors on the reloading of configuration

Pgpool-II should load the hba_file after evaluating all the
command line options at startup.
It is wrong to load hba file before evaluating all the command line arguments,
because when the Pgpool-II is invoked with reload or stop options, all it needs
to do is to signal the running Pgpool-II and exit, So loading hba file for
Pgpool reload/stop is not only unnecessary but it also emits the misleading
WARNING message of "failed while loading hba configuration" when alternative
path for hba file was used.

8 years agoRemove old html docs and related files.
Tatsuo Ishii [Wed, 12 Apr 2017 08:32:31 +0000 (17:32 +0900)]
Remove old html docs and related files.

8 years agoAdd pgpool_adm Japanese docs.
Tatsuo Ishii [Wed, 12 Apr 2017 08:18:32 +0000 (17:18 +0900)]
Add pgpool_adm Japanese docs.

Also fix some pgpool_adm English docs.

8 years agoAdd installation procedure of pgpool_adm.
Tatsuo Ishii [Tue, 11 Apr 2017 08:16:11 +0000 (17:16 +0900)]
Add installation procedure of pgpool_adm.

8 years agoAdd missing pgpool_adm manuals.
Tatsuo Ishii [Tue, 11 Apr 2017 08:01:17 +0000 (17:01 +0900)]
Add missing pgpool_adm manuals.

They were missing while migrating to SGML. Still Japanese docs need to
be updated.

8 years agoFix indentation.
Tatsuo Ishii [Tue, 11 Apr 2017 05:43:28 +0000 (14:43 +0900)]
Fix indentation.

8 years agoFix for 0000289: Inconsistent backend state
Muhammad Usama [Mon, 10 Apr 2017 19:53:59 +0000 (00:53 +0500)]
Fix for 0000289: Inconsistent backend state

Pgpool-II syncs the backend node states at the time of startup which works fine
for almost all cases except when the watchdog cluster becomes partitioned
(because of some network problem) and after recovering from it the Pgpool-II
nodes (that are already up and serving) joins back the cluster. At that time the
backend node status among different nodes can become In-sync among the Pgpool-II
nodes, if the backend node status on the newly joined Pgpool-II is different
from the status on existing watchdog cluster nodes.

Now with this commit, every time the Pgpool-II node joins the watchdog cluster
as a standby either at startup or after some problem recovery, it realigns its
backend node statuses with the cluster leader, by fetching the statuses from
the master/coordinator and updating the local statuses of each backend.

The patch also borrows the logic of smart restarting of Pgpool-II children
from the failover() function to minimise the chances of session disconnection
when the backend node statuses are updated from the master/coordinator Pgpool-II.

8 years agoFix compiler warnings.
Tatsuo Ishii [Fri, 7 Apr 2017 04:24:57 +0000 (13:24 +0900)]
Fix compiler warnings.

Also remove unused code.

8 years agoComment out unsupported Java method in new JDBC drivers to prevent regression failure.
Tatsuo Ishii [Thu, 6 Apr 2017 07:58:28 +0000 (16:58 +0900)]
Comment out unsupported Java method in new JDBC drivers to prevent regression failure.

That is this: Driver.setLogLevel(2);

8 years agoDowngrade parse before bind log message to debug1.
Tatsuo Ishii [Wed, 5 Apr 2017 08:21:23 +0000 (17:21 +0900)]
Downgrade parse before bind log message to debug1.

This was mistakenly left at debugging. Patch provided by Sergey Kim.

8 years agoFix coverity warning CID#1373258 "Uninitialized scalar variable"
Muhammad Usama [Tue, 4 Apr 2017 11:30:21 +0000 (16:30 +0500)]
Fix coverity warning CID#1373258 "Uninitialized scalar variable"

8 years agoFix coverity reported issues of buffer overrun.
Muhammad Usama [Tue, 4 Apr 2017 11:03:52 +0000 (16:03 +0500)]
Fix coverity reported issues of buffer overrun.

Per coverity CID#1332216, CID#1332218, CID#1373253, CID#1373254 and CID#1373255

8 years agoFix coverity warnings.
Tatsuo Ishii [Mon, 3 Apr 2017 05:57:25 +0000 (14:57 +0900)]
Fix coverity warnings.

8 years agoFix for [pgpool-general: 5396] pam ldap failure
Muhammad Usama [Fri, 31 Mar 2017 15:15:22 +0000 (20:15 +0500)]
Fix for [pgpool-general: 5396] pam ldap failure

Do not use Palloc and friends to allocate memory for pam_response in the
PAM conversation function, Since that memory is freed by PAM library who
knows nothing about our MemoryManager and can cause the segmentation fault.

8 years agoMention that SQL type commands cannot be used in extended query mode.
Tatsuo Ishii [Fri, 31 Mar 2017 04:28:24 +0000 (13:28 +0900)]
Mention that SQL type commands cannot be used in extended query mode.

8 years agoConsider SHOW command as kind of a read query.
Tatsuo Ishii [Fri, 31 Mar 2017 03:49:59 +0000 (12:49 +0900)]
Consider SHOW command as kind of a read query.

In streaming replication mode, if SHOW is issued then subsequent
SELECTs are sent to the primary node in an explicit transaction. This
is not a reasonable and unnecessary limitation.

Also fix hang when parse command returns error.

8 years agoFix memory leak problem caused by commit adcb636.
Tatsuo Ishii [Thu, 30 Mar 2017 00:20:32 +0000 (09:20 +0900)]
Fix memory leak problem caused by commit adcb636.

Commit adcb636 introduces "pending message queue". When a message
arrives, the info is added to the queue and a copy of object is
created at the same time, but forgoto free the object. Fix is,
creating a new function pool_pending_message_free_pending_message()
and call it after pool_pending_message_add(),
pool_pending_message_get() and pool_pending_message_pull_out().

Problem reported by Sergey Kim.

8 years agoEnhancing the handling of split-brain scenario by the watchdog.
Muhammad Usama [Wed, 29 Mar 2017 21:00:49 +0000 (02:00 +0500)]
Enhancing the handling of split-brain scenario by the watchdog.

Previously, the watchdog cluster was used to call for re-election of the
master/coordinator node whenever the split-brain situation was detected. And
consequently every node was required to rejoin the watchdog network, Which was
essentially similar to the re-booting of the whole watchdog cluster.

Although the technique of calling for re-election at split-brain is good enough
to tackle the situation, but it is very inefficient and prone to the service
disruption for the time when the cluster is rebooting. Also in some cases, like
when the split-brain happens because of temporary network partitioning the new
elections could elect master that has the outdated or invalid backend states.

Now with this enhancement when the cluster detects the split-brain, instead of
blindly calling for new master node election and rebooting every node,
The watchdog nodes try to solve the master/coordinator node contention by
choosing the best candidate.

The candidate for the master/coordinator node is selected on the following criteria.

1-- When two watchdog nodes are claiming to be the cluster master, the master
node that has performed the escalation keeps the master status and the other
node is asked to step down.

2-- If the conflict could not be resolved by the escalation status of the nodes,
The node which holds the quorum remains the master/coordinator.

3-- If the quorum status of both contenders is also same. The node with higher
number of connected alive nodes get the preference.

4-- Finally, if all above three yields no winner, the older master (The node
that has the coordinator status for longer duration) remains the master.

8 years agoMega patch to fix "kind mismatch" (or derived) errors in streaming replication mode.
Tatsuo Ishii [Wed, 29 Mar 2017 06:27:19 +0000 (15:27 +0900)]
Mega patch to fix "kind mismatch" (or derived) errors in streaming replication mode.

The errors are caused by wrong prediction in which (or both) database
node will send response to Pgpool-II. Previous implementation using
"sync map" are weak and sometimes fail in the prediction.

This patch introduces new implementation using "pending message
queue", which records all sent message to backends. The element of the
queue stores info regarding messages types
(parse/bind/execute/describe/close/sync), to which database node the
message was sent and so on. It's a simple FIFO queue. When a message
arrives from backend, by looking at the head of the "pending message
queue", it is possible to reliably predict what kind of message and
from which database node it will arrive. After receiving the message,
the element is removed from the queue.

I would like to thank to Sergey Kim, who has been helping me in
testing series of patches.

See bug 271:
http://www.pgpool.net/mantisbt/view.php?id=271

and discussion in pgpool-hackers mailing list [pgpool-hackers: 2043]
and [pgpool-hackers: 2140] for more details.

8 years agoAdd new regression test "069.memory_leak_extended".
Tatsuo Ishii [Wed, 29 Mar 2017 04:13:15 +0000 (13:13 +0900)]
Add new regression test "069.memory_leak_extended".

This is almost same as 060.memory_leak" but it uses extended query
protocol.

8 years agoFix for 0000296: PGPool v3.6.2 terminated by systemd because the service Type
Muhammad Usama [Thu, 23 Mar 2017 21:17:36 +0000 (02:17 +0500)]
Fix for 0000296: PGPool v3.6.2 terminated by systemd because the service Type
has been set to 'forking'

Removing the "-n" value assigned to OPTS variable in pgpool.sysconfig.
The problem was the systemd service with Type=forking expects the parent process
to exit after the startup is complete, but because the -n command line option
disables the daemon mode and systemd keeps on waiting for the Pgpool-II's parent
process to exit after startup, which never happens and eventually systemd
terminate the Pgpool-II after timeout.
As part of this commit I have also added a new variable STOP_OPTS which is
passed to ExecStop and can be used to pass extra command line options to
Pgpool-II stop command.

8 years agoEnhancing the watchdog internal command mechanism to handle
Muhammad Usama [Mon, 20 Mar 2017 21:49:03 +0000 (02:49 +0500)]
Enhancing the watchdog internal command mechanism to handle
multiple concurrent commands.

8 years agoAdd release-notes 3.6.2-3.2.19.
pengbo [Fri, 17 Mar 2017 09:32:57 +0000 (18:32 +0900)]
Add release-notes 3.6.2-3.2.19.

8 years agoFix pcp_promote_node bug that fails promoting node 0
Yugo Nagata [Thu, 9 Mar 2017 02:34:12 +0000 (11:34 +0900)]
Fix pcp_promote_node bug that fails promoting node 0

The master node could not be promoted by pcp_promote_node with
the following error;

 FATAL: invalid pgpool mode for process recovery request
 DETAIL: specified node is already primary node, can't promote node id 0

In streaming replication mode, there is a case that Pgpool-II
regards the status of primary node as "standby" for some reasons,
for example, when pg_ctl promote is executed manually during
Pgpool-II is running, in which case, it seems to Pgpool-II
that the primary node doesn't exist.

This status mismatch should be fixe by pcp_promote_node, but when the node
is the master node (the first alive node), it fails as mentioned above.

The reason is as following. before changing the status, pcp_promote_node
checks if the specified node is already primary or not by comparing the
node id with PRIMARY_NODE_ID. However, if the primary doesn't exist from
Pgpool-II's view, PRIMARY_NODE_ID is set to 0, which is same as MASTER_NODE_ID.
Hence, when the master node is specified to be promoted, pcp_promote_node
is confused that this node is already primary and doesn't have to be
promoted, and it exits with the error.

To fix this, pcp_promote_node should check the node id by using
REAL_PRIMARY_NODE_ID, which is set -1 when the primary doesn't exist,
rather than PRIMARY_NODE_ID.

8 years agoFix tag error (excessive ">").
Tatsuo Ishii [Tue, 28 Feb 2017 02:39:14 +0000 (11:39 +0900)]
Fix tag error (excessive ">").

8 years agoPgpool-II should not perform ping test after bringing down the VIP
Muhammad Usama [Thu, 23 Feb 2017 16:06:05 +0000 (21:06 +0500)]
Pgpool-II should not perform ping test after bringing down the VIP

At the time de-escalation from the master watchdog node, we should not perform
the ping test to verify if the VIP was successfully brought down or not.
The reason is, if the new master watchdog node acquires the VIP while the
resigning node is still performing the de-escalation steps, then the resigning
Pgpool-II node will falsely assume that it has failed to bring down the
delegate IP, Since it will get the positive ping result from the new master node
who has already acquired the same VIP.

Secondly, not having the delegate-IP in the configuration should not be
considered as an error case by wd_IP_up() and wd_IP_down() functions.
Since there are many possible valid scenarios where a user would not want to
have a delegate-IP. So now both wd_IP_* functions return WD_OK instead of WD_ND
when delegate_IP configuration is empty.

This issue was reported by the reporter of
bug:[pgpool-II 0000249]: watchdog sometimes fails de-escalation

The commit also contains some log message fixes.

8 years agoFix to release shared memory segments when Pgpool-II exits.
Tatsuo Ishii [Thu, 23 Feb 2017 07:05:11 +0000 (16:05 +0900)]
Fix to release shared memory segments when Pgpool-II exits.

Per bug272. From the bug report.
"This cause the creation of a lot of segments if you start and stop
pgpool continuously (and in a testing fase it could be normal). Lot of
segments bring to reach the shmem OS configuration limit and than
suddenly stops (pgpool) working."

8 years agoFix for [pgpool-general: 5315] pg_terminate_backend
Muhammad Usama [Mon, 13 Feb 2017 19:34:56 +0000 (00:34 +0500)]
Fix for [pgpool-general: 5315] pg_terminate_backend

Pgpool-II process the pg_terminate_backend by setting the swallow_termination
flag of the backend connection_info referred in the pg_terminate_backend
function, and latter resets that flag when the query execution completes.

The problem with this approach is that if the command complete for
the pg_terminate_backend is received before the connection termination,
This termination is regarded as the backend failure since the
swallow_termination flag was already cleared by the Pgpool-II child after
receiving the query completion message.

The solution is to reset the swallow_termination flag only when the
pg_terminate_query query fails otherwise leave it as it is when the query
is successful, Since, after the termination of the connection the flag
will not matter anyway.

8 years agoEnhance document.
Tatsuo Ishii [Thu, 9 Feb 2017 09:11:04 +0000 (18:11 +0900)]
Enhance document.

Add note about %m in failover command. Add indexes to "streaming
replication mode", "master slave mode" and "native replication mode".

8 years agoAdding the missing ExecStop and ExecReload commands to the systemd
Muhammad Usama [Mon, 6 Feb 2017 14:41:31 +0000 (19:41 +0500)]
Adding the missing ExecStop and ExecReload commands to the systemd
service configuration file.

The patch was contributed by supp_k and enhanced by me.

8 years agoFix for 281: "segmentation fault" when execute pcp_attach_node
Muhammad Usama [Mon, 30 Jan 2017 12:56:08 +0000 (17:56 +0500)]
Fix for 281: "segmentation fault" when execute pcp_attach_node

A DEBUG message was trying to de-reference a NULL value.

8 years agoFix load balancing bug in streaming replication mode.
Tatsuo Ishii [Mon, 30 Jan 2017 07:30:57 +0000 (16:30 +0900)]
Fix load balancing bug in streaming replication mode.

In an explicit transaction, any SELECT will be load balanced until
write query is sent. After writing query is sent, any SELECT should be
sent to the primary node. However if a SELECT is sent before a sync
message is sent, this does not work since the treatment of writing
query is done after ready for query message arrives. Solution is, the
treatment for writing query is done in executing the writing query as
well.

The bug has been there since V3.5.

8 years agoFix yet another kind mismatch error in streaming replication mode.
Tatsuo Ishii [Mon, 30 Jan 2017 06:29:29 +0000 (15:29 +0900)]
Fix yet another kind mismatch error in streaming replication mode.

1) Parse "BEGIN" using statement S1, and it is sent to both node 0 and 1.

2) Close S1.

3) Parse SELECT using S1, and it is sent to node 0 (or 1).

4) Bind retrieves info (sent_messages) regarding S1. Since Pgpool-II
   only removes info on S1 when CloseComplete received, Bind decides
   to send bind message to both node 0 & 1 because it was the info
   regarding BEGIN. Node 0 or 1 tries to bind to non existent
   statement S1.

   As a result, something like "failed to read kind from backend.
   kind mismatch among backends. Possible last query was: "BEGIN" kind
   details are: 0[E: prepared statement "S1" does not exist] 1[3]
   check data consistency among db nodes" occurs.

Note that in 3) if other than S1 is used, the problem does not occur.
Solution is, removing S1 when Close message is received. This problem
has been there since 3.5.0 was out.

8 years agoFix do_query() hangs after close message.
Tatsuo Ishii [Fri, 27 Jan 2017 07:12:47 +0000 (16:12 +0900)]
Fix do_query() hangs after close message.

This is an en-bug in 3.6.1.

If an extend query appears right after a close message, do_query() is
called to check system catalogs, it hangs because it expects to read
pending data. This is caused by being mistakenly set the pending flag
after Close().

Back patch to 3.6-stable and 3.5-stable.

8 years agoFixing 0000280: stack smashing detected
Muhammad Usama [Thu, 26 Jan 2017 20:53:42 +0000 (01:53 +0500)]
Fixing 0000280: stack smashing detected

It was a buffer overflow in wd_get_cmd function

8 years agoFix indentations of query cache documents.
Tatsuo Ishii [Tue, 24 Jan 2017 23:17:51 +0000 (08:17 +0900)]
Fix indentations of query cache documents.

8 years agoEnhance query cache documents.
Tatsuo Ishii [Tue, 24 Jan 2017 23:13:25 +0000 (08:13 +0900)]
Enhance query cache documents.

8 years agoFixing the issue with the watchdog process restart.
Muhammad Usama [Thu, 19 Jan 2017 15:58:24 +0000 (20:58 +0500)]
Fixing the issue with the watchdog process restart.

When the watchdog process gets abnormally terminated because of some problem
(e.g. Segmentation fault) the new spawned watchdog process fails to start and
produces an error "bind on ... failed with reason: Address already in use".

Reason is the abnormally terminating watchdog process never gets the time to
clean-up the socket it uses for IPC and the new process gets an error because
the socket address is already occupied

Fix is, the Pgpool main process sets the flag in shared memory to mark the
watchdog process was abnormally terminated and at startup when the watchdog
process see that the flag is set, it performs the clean up of the socket file and
also performs the de-escalation (If the watchdog process was crashed when it
was master/coordinator node) if required before initializing itself.

8 years agoFix query cache bug reported in pgpool-general-jp:1441.
Tatsuo Ishii [Wed, 18 Jan 2017 23:24:34 +0000 (08:24 +0900)]
Fix query cache bug reported in pgpool-general-jp:1441.

In streaming replication mode with query cache enabled, SELECT hangs
in the following scenario:

1) a SELECT hits query cache and returns rows from the query cache.
2) following SELECT needs to search meta data and it hangs.

In #1, while returning the cached result, it misses to call
pool_unset_pending_response(), which leave the pending_response flag
be set. In #2, do_query() checks the flag and tries to read pending
response from backend. Since there's no pending data in backend, it
hangs in reading data from backend.

Fix is, just call pool_unset_pending_response() in #1 to reset the
flag.

Bug report and fix provided by Nobuyuki Nagai.

New regression test item (068) added by me.

8 years agoRemove elog/ereport calls from signal handlers.
Tatsuo Ishii [Tue, 10 Jan 2017 23:24:32 +0000 (08:24 +0900)]
Remove elog/ereport calls from signal handlers.

elog/ereport calls malloc(), which is not safe to be called inside
signal handlers, per discussion in [pgpool-hackers: 1950].  I ifdef
out them, rather than simply remove them in a hope we someday find a
better solution which make calling the functions inside signal
handlers.

Not that I did not touch exit_handler() of pgpool_main.c because
removing elog/ereport from them loses informative message like
"received smart shutdown request". Pgpool-II main process do not
heavily use malloc(), so the risk is minimum, I guess.

8 years agoFix typo in Japanese release notes.
pengbo [Tue, 10 Jan 2017 08:35:29 +0000 (17:35 +0900)]
Fix typo in Japanese release notes.

8 years agoFix bug failed to create INET domain socket in FreeBSD if listen_addresses = '*'.
pengbo [Tue, 10 Jan 2017 07:59:37 +0000 (16:59 +0900)]
Fix bug failed to create INET domain socket in FreeBSD if listen_addresses = '*'.

per bug202.

8 years agoFix for 0000249: watchdog sometimes fails de-escalation.
Muhammad Usama [Wed, 4 Jan 2017 13:23:33 +0000 (18:23 +0500)]
Fix for 0000249: watchdog sometimes fails de-escalation.

The logic in pgpool-II main process exit_handler and terminate_all_childrens was
not making sure that pgpool-II main process should only exit after all its
children have exited. And the problem occurs when the main process shutdowns
itself before watchdog and de-escalation child processes.

The solution is to use the waitpid() system call without WNOHANG option.

8 years agoFix connection_life_time broken by authentication_timeout
Yugo Nagata [Wed, 4 Jan 2017 05:20:24 +0000 (14:20 +0900)]
Fix connection_life_time broken by authentication_timeout

When authentication_timeout is enabled,
connection_life_time could never be expired, because
alarm(0) is called at reading start-up packet.

When there only one connection pool is used, this
problem doesn't occur because the signal handler
for connection_life_time is always set at the end
of the session. However, if more than one connection
pools exist, the handler isn't set but only the time
to colse the connection is calculated.

To fix it, when authentication_timeout is enabled,
save the signal handler for conneciont_life_time
and the remaining time, and undo the handler when
authentication_timeout is disabled.

8 years agoFix authentication timeout that can occur right after client connecttions
Yugo Nagata [Wed, 28 Dec 2016 08:37:11 +0000 (17:37 +0900)]
Fix authentication timeout that can occur right after client connecttions

This is possible when connection_life_time is enabled.

SIGALRM signal is used for both connection_life_time and
authentication_timeout. Usually, SIGALRM is for connection_life_time,
but when the new connection is arrive, read_startup_packet() is called,
and the handler for authentication_timeout is set by pool_signal() and
alarm(authentication_timeout) is called in enable_authentication_timeout().

However, if connection_life_time is expired **between pool_signal() and
alarm()**, authenticate_timeout() will be called when connection_life_time
is expired instead of pool_backend_timer_handler().

To fix this, call alarm() before pool_signal() to prevent the signal
handler from being with wrong timing.

8 years agoSome changes in release note 3.1-3.6.
pengbo [Mon, 26 Dec 2016 02:35:42 +0000 (11:35 +0900)]
Some changes in release note 3.1-3.6.

8 years agoAdd Japanese release note 3.1-3.6.
pengbo [Sun, 25 Dec 2016 15:53:50 +0000 (00:53 +0900)]
Add Japanese release note 3.1-3.6.

8 years agoTightening up the watchdog security
Muhammad Usama [Fri, 23 Dec 2016 14:58:53 +0000 (19:58 +0500)]
Tightening up the watchdog security

Now wd_authkey uses the HMAC SHA-256 hashing.

8 years agoAdd pgpool_adm extension.
pengbo [Thu, 22 Dec 2016 02:10:36 +0000 (11:10 +0900)]
Add pgpool_adm extension.

8 years agoAdd release 3.1-3.6 release notes.
Tatsuo Ishii [Tue, 20 Dec 2016 07:50:57 +0000 (16:50 +0900)]
Add release 3.1-3.6 release notes.

The contents are not accurate at this moment except 3.6.1. They are
just copy of 3.5.5 release note.

8 years agoAdd 3.5.5 release note.
Tatsuo Ishii [Tue, 20 Dec 2016 07:23:09 +0000 (16:23 +0900)]
Add 3.5.5 release note.

8 years agoUpdate Pgpool-II version to "3.7devel".
Tatsuo Ishii [Thu, 22 Dec 2016 01:24:25 +0000 (10:24 +0900)]
Update Pgpool-II version to "3.7devel".

8 years agoFix occasional segfault when query cache is enabled.
Tatsuo Ishii [Tue, 20 Dec 2016 02:38:12 +0000 (11:38 +0900)]
Fix occasional segfault when query cache is enabled.

Per bug 263.

8 years agoFix packet kind does not match error in extended protocol per bug 231.
Tatsuo Ishii [Tue, 20 Dec 2016 01:28:20 +0000 (10:28 +0900)]
Fix packet kind does not match error in extended protocol per bug 231.

According to the bug231, the bug seem to bite you if all of following
conditions are met:

  - Streaming replication mode
  - Load balance node is not node 0
  - Extended protocol is used
  - SELECT is executed, the statement is closed, then a transaction
    command is executed

The sequence of how the problem bites is:

  1) SELECT executes on statement S1 on the load balance node 1
  2) Frontend send Close statement
  3) Pgool-II forward it to backend 1
  4) Frontend sends Parse, Bind, Execute of COMMIT
  5) Pgool-II forward it to backend 0 & 1
  6) Frontend sends sync message
  7) Pgool-II forward it to backend 0 & 1
  8) Backend 0 replies back Parse complete ("1"), while backend 1
     replies back close complete ("3") because of #3.
  9) Kind mismatch occurs

The solution is, in #3, let Pgpool-II wait for response from backend
1, but do not read the response message. Later on Pgpool-II's state
machine will read the response from it before the sync message is sent
in #6. With this, backend 1 will reply back "1" in #8, and the kind
mismatch error does not occur.

Also, fix not calling pool_set_doing_extended_query_message() when
receives Close message.  (I don't know why it was missed).

New regression test "067.bug231" was added.

8 years agoEnhance documentation.
Tatsuo Ishii [Tue, 20 Dec 2016 01:25:44 +0000 (10:25 +0900)]
Enhance documentation.

"Tips for Installation" section added.

8 years agoEnhance documentation.
Tatsuo Ishii [Tue, 20 Dec 2016 01:13:55 +0000 (10:13 +0900)]
Enhance documentation.

Add "Tips for Installation" section added.

8 years agoFix a race condition in a signal handler per bug 265.
Tatsuo Ishii [Tue, 6 Dec 2016 04:28:36 +0000 (13:28 +0900)]
Fix a race condition in a signal handler per bug 265.

In child.c there's signal handler which calls elog. Since the signal
handler is not blocked against other signals while processing, deadlock
could occur in the system calls in the pgpool shutdown sequence. To
fix the problem, now the signal handler is blocked by using
POOL_SETMASK.

Ideally we should avoid calling elog in signal handlers though.

8 years agoFix wrong minimum configuration value for client_idle_limit_in_recovery.
Tatsuo Ishii [Thu, 24 Nov 2016 01:16:51 +0000 (10:16 +0900)]
Fix wrong minimum configuration value for client_idle_limit_in_recovery.

Per bug #264.

8 years agoMerge branch 'master' of ssh://git.postgresql.org/pgpool2 V3_6_0_RPM
pengbo [Tue, 22 Nov 2016 03:43:35 +0000 (12:43 +0900)]
Merge branch 'master' of ssh://git.postgresql.org/pgpool2

8 years agoSome changes in Makefile.in of doc and doc.ja
pengbo [Tue, 22 Nov 2016 03:42:02 +0000 (12:42 +0900)]
Some changes in Makefile.in of doc and doc.ja

8 years agoAllow to execute "make xslthtml" under doc.ja.
Tatsuo Ishii [Tue, 22 Nov 2016 02:21:01 +0000 (11:21 +0900)]
Allow to execute "make xslthtml" under doc.ja.

8 years agoChange pgpool.spec to install sgml docs and man.
pengbo [Tue, 22 Nov 2016 02:16:13 +0000 (11:16 +0900)]
Change pgpool.spec to install sgml docs and man.

8 years agoAdd some necessary file to EXTRA_DIST to build sgml file. V3_6_0
pengbo [Mon, 21 Nov 2016 10:41:37 +0000 (19:41 +0900)]
Add some necessary file to EXTRA_DIST to build sgml file.

8 years agoPrepare 3.6.0
pengbo [Mon, 21 Nov 2016 09:01:48 +0000 (18:01 +0900)]
Prepare 3.6.0

8 years agoUnify the term in the Japanese document
Yugo Nagata [Mon, 21 Nov 2016 01:07:20 +0000 (10:07 +0900)]
Unify the term in the Japanese document

8 years agoAdd some missing documents about load-balancing.
Yugo Nagata [Sun, 20 Nov 2016 22:24:40 +0000 (07:24 +0900)]
Add some missing documents about load-balancing.

Some untranslated statement are also translated.

8 years agoAdding AWS watchdog example
Muhammad Usama [Fri, 18 Nov 2016 10:20:07 +0000 (15:20 +0500)]
Adding AWS watchdog example

8 years agoTranslate AWS watchdog example.
Tatsuo Ishii [Fri, 18 Nov 2016 02:46:48 +0000 (11:46 +0900)]
Translate AWS watchdog example.

8 years agoPrepare 3.6RC1 V3_6_0_RC1 V3_6_0_RC1_RPM
Bo Peng [Wed, 16 Nov 2016 06:14:48 +0000 (15:14 +0900)]
Prepare 3.6RC1

8 years agoAdd Japanese and English release note
Bo Peng [Wed, 16 Nov 2016 03:07:33 +0000 (12:07 +0900)]
Add Japanese and English release note

8 years agosome watchdog log message enhancements
Muhammad Usama [Tue, 15 Nov 2016 13:46:02 +0000 (18:46 +0500)]
some watchdog log message enhancements

8 years agoTranslate the difference of docs made in the commit f6ec43456cf91231d92d34fef4b1b4405...
Tatsuo Ishii [Mon, 14 Nov 2016 23:16:52 +0000 (08:16 +0900)]
Translate the difference of docs made in the commit f6ec43456cf91231d92d34fef4b1b44055bc1180.

8 years agoFixing a potential crash in pool_stream functions.
Muhammad Usama [Mon, 14 Nov 2016 21:32:36 +0000 (02:32 +0500)]
Fixing a potential crash in pool_stream functions.

POOL_CONNECTION->con_info should be checked for null value before de-referencing
when read or write fails on backend socket.

8 years agoFixing the design of failover command propagation on watchdog cluster
Muhammad Usama [Mon, 14 Nov 2016 19:32:01 +0000 (00:32 +0500)]
Fixing the design of failover command propagation on watchdog cluster

Overhauling the design of how failover, failback and promote node commands are
propagated to the watchdog nodes. Previously the watchdog on pgpool-II node that
needs to perform the node command (failover, failback or promote node) used to
broadcast the failover command to all attached pgpool-II nodes. And this
sometimes makes the synchronization issues, especially when the watchdog cluster
contains a large number of nodes and consequently the failover command sometimes
gets executed by more than one pgpool-II.

Now with this commit all the node commands are forwarded to the
master/coordinator watchdog, which in turn propagates to all standby nodes.
Apart from above the commit also changes the failover command interlocking
mechanism and now only the master/coordinator node can become the lock holder
so the failover commands will only get executed on the master/coordinator node.

8 years agoFix the broken log_destination = syslog functionality.
Muhammad Usama [Wed, 9 Nov 2016 20:22:12 +0000 (01:22 +0500)]
Fix the broken log_destination = syslog functionality.

Fixing the logging to the syslog destination, which got broken by the
PGPOOL SET/SHOW command commit, and also enhancing the log_destination
configuration parameter to be assigned with the comma separated list of multiple
destinations for the Pgpool-II log. Now, after this commit log_destination can
be set to any combination of 'syslog' and 'stderr' log destinations.

8 years agoFix untranslated sentence.
Tatsuo Ishii [Wed, 9 Nov 2016 08:18:06 +0000 (17:18 +0900)]
Fix untranslated sentence.

8 years agoAdjust RPM installing description to pgpool-II-pg96.
Tatsuo Ishii [Wed, 9 Nov 2016 08:12:17 +0000 (17:12 +0900)]
Adjust RPM installing description to pgpool-II-pg96.

8 years agoAdd RPM installation section.
Tatsuo Ishii [Wed, 9 Nov 2016 04:56:47 +0000 (13:56 +0900)]
Add RPM installation section.

8 years agoEnhance the release note.
Tatsuo Ishii [Wed, 9 Nov 2016 00:10:16 +0000 (09:10 +0900)]
Enhance the release note.

Add mention that now man pages are generated from SGML documents.

8 years agoMerge branch 'master' of ssh://git.postgresql.org/pgpool2 V3_6_0_BETA2 V3_6_0_BETA2_RPM
pengbo [Tue, 8 Nov 2016 10:42:20 +0000 (19:42 +0900)]
Merge branch 'master' of ssh://git.postgresql.org/pgpool2

8 years agospecファイルを変更
pengbo [Tue, 8 Nov 2016 10:40:32 +0000 (19:40 +0900)]
specファイルを変更

8 years agoPrepare 3.6beta2
pengbo [Tue, 8 Nov 2016 04:46:38 +0000 (13:46 +0900)]
Prepare 3.6beta2

8 years agoFix compile error and add man page
pengbo [Tue, 8 Nov 2016 04:25:18 +0000 (13:25 +0900)]
Fix compile error and add man page

8 years agoFix compile error
pengbo [Tue, 8 Nov 2016 02:39:17 +0000 (11:39 +0900)]
Fix compile error

8 years agofix 3.6alpha1, beta1 compile error and allow "make dist" to include generated man...
pengbo [Tue, 8 Nov 2016 02:09:56 +0000 (11:09 +0900)]
fix 3.6alpha1, beta1 compile error and  allow "make dist" to include generated man apges.

8 years agoAllow to create man pages from SGML.
Tatsuo Ishii [Mon, 7 Nov 2016 08:53:37 +0000 (17:53 +0900)]
Allow to create man pages from SGML.

For this purpose, following changes are made:

- Allow to properly create pgpool.xml. For this purpose, add checking
  for xmllint to configure.ac.

- Fix m4/docbook.m4 to not throw an error and properly set
  DOCKBOOKSTYLE variable.  (not sure if this is related to the fix
  though. Anyway, this seems suppress shell errors while configure)

- Allow osx to process UTF-8 documents in doc.ja directory.

- Fix SGML tags in start.sgml and installation.sgml to suppress XML
  validation errors generated by xmllint.

8 years agoPrepare 3.6beta1
pengbo [Fri, 4 Nov 2016 05:06:21 +0000 (14:06 +0900)]
Prepare 3.6beta1