Yugo Nagata [Wed, 15 Jun 2016 06:24:21 +0000 (15:24 +0900)]
Fix a posible hang during health checking
Helath checking was hang when any data wasn't sent
from backend after connect(2) succeeded. To fix this,
pool_check_fd() returns 1 when select(2) exits with
EINTR due to SIGALRM while health checkking is performed.
Reported and patch provided by harukat and some modification
by Yugo. Per bug #204.
backported from 3.4 or later;
https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commitdiff;h=
ed9f2900f1b611f5cfd52e8f758c3616861e60c0
pengbo [Mon, 26 Dec 2016 02:56:45 +0000 (11:56 +0900)]
Prepare 3.1.21
Tatsuo Ishii [Thu, 27 Oct 2016 08:29:53 +0000 (17:29 +0900)]
Do not cancel a query when the query resulted in an error other than in native replication mode.
It was intended to keep the consistency, but there's no point in other
than native replication mode.
Tatsuo Ishii [Fri, 9 Sep 2016 02:53:27 +0000 (11:53 +0900)]
Do not use random() while generating MD5 salt.
random() should not be used in security related applications. To
replace random(), import PostmasterRandom() from PostgreSQL. Also
store current time at the start up of Pgpool-II main process for later
use.
Per Coverity CID
1362583.
pengbo [Tue, 30 Aug 2016 10:40:20 +0000 (19:40 +0900)]
Prepare 3.1.20
Tatsuo Ishii [Sat, 27 Aug 2016 08:40:04 +0000 (17:40 +0900)]
Add comment to the document about connection_cache.
Mention that connections to template0, template1, postgres and
regression databases are not cached even if connection_cache is on.
Muhammad Usama [Fri, 12 Aug 2016 12:09:34 +0000 (17:09 +0500)]
Fixing a typo in the log message
Tatsuo Ishii [Thu, 11 Aug 2016 09:35:19 +0000 (18:35 +0900)]
Unbreak version 2 protocol case.
Commit:
https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commit;h=
3cbce4eaf870e89fdd8f8a2ad8fab8d3d8aadf65
broke version 2 protocol case. In the session initiation phase,
"MAJOR" macro is used *before* session context is created. In this
MAJOR macro returns PROTO_MAJOR_V3, which of course breaks v2 protocol
negotiation. Fix is, not to use MAJOR macro here.
Bo Peng [Wed, 3 Aug 2016 02:33:29 +0000 (11:33 +0900)]
fix japanese doc typo
Tatsuo Ishii [Wed, 27 Jul 2016 05:28:28 +0000 (14:28 +0900)]
Replace "MAJOR" macro to prevent occasional failure.
It is reported that the macro could cause segfault
[http://www.pgpool.net/mantisbt/view.php?id=225]. The macro calls
pool_virtual_master_db_node_id() and then access
backend->slots[id]->con using the node id returned. In rare cases, it
could point to 0 (in case when the DB node is not connected), which
gives access to con->major, then it causes a segfault.
Since the intention of the macro is obtaining the protocol major
number, it is a little bit pointless to keep the info on the data for
each DB node because the number should be identical among DB
nodes. To fix this, now we have the protocol major and minor version
numbers in the session context and they are set when pgpool-II
connects to backend. The setter and getter functions are added .The
macro now just returns the stored data by using the getter function
(this will save a few cpu cycle).
Muhammad Usama [Thu, 14 Jul 2016 13:50:51 +0000 (18:50 +0500)]
Fix for [pgpool-hackers: 1501] kind does not match error
pgpool throws ".. kind does not match.." error message when all the attached
backend nodes do not return the same response to the query. Although this error
message can be a symptom of the backend node sync issue in most cases, but in
case when the message kind of backend nodes differs because one of the backend
returned the notice response while the other returned some other kind then that
case should not be considered as an error case.
Consider the scenario where a pgpool is connected to multiple backend nodes and
is expecting to receive "[C] command complete" message from all nodes.
But while processing the query one of the backend also produced an extra warning message.
... WARNING: database "testdb" must be vacuum within
11000000 transaction
Although that the query was eventually successful on all backends, but as soon
as pgpool reads this WARNING message from one backend it will throw an error
ERROR: read_kind_from_backend: 1 th kind N does not match with master or majority connection kind C
But if pgpool would have kept reading from the backend, It would have also got
the expected command complete message after that warning notice
The solution for this is to keep forwarding the notice/log messages to the
frontend while reading the backend response in read_kind_from_backend() function
until the ERROR or expected message is received.
Though there is also one slight drawback of this approach, If the backends are
configured to forward all log messages to the client application, then the client
applications will get multiple log messages for the queries that are sent to
more than one node by pgpool.
test=# begin;
LOG: statement: begin;
LOG: statement: begin;
BEGIN
But since it is a very rare scenario, and just a minor inconvenience so it's not
holding us back to commit this solution until a better one arrives.
Tatsuo Ishii [Thu, 7 Jul 2016 05:19:35 +0000 (14:19 +0900)]
Fix usage of wait(2) in pgpool main process
Per [pgpool-hackers: 1444]. Here is the copy of the message:
Hi Usama,
I have noticed that the usage of wait(2) in pgpool main could cause
infinite wait in the system call.
/* wait for all children to exit */
do
{
wpid = wait(NULL);
}while (wpid > 0 || (wpid == -1 && errno == EINTR));
When child process dies, SIGCHLD signal is raised and wait(2) knows
the event. However, multiple child death does not necessarily creates
exact same number of SIGCHLD signal as the number of dead children and
wait(2) could wait for an event which never happens in this case. I
actually encountered this situation while testing pgpool-II. Solution
is, to use waitpid(2) instead of wait(2).
Tatsuo Ishii [Fri, 24 Jun 2016 08:31:47 +0000 (17:31 +0900)]
Fix buffer over run problem in "show pool_nodes".
While processing "show pool_nodes", the buffer for hostname was too
short. It should be same size as the buffer used for pgpool.conf.
Problem reported by a twitter user who is using pgpool on AWS (which
could have very long hostname).
Tatsuo Ishii [Fri, 24 Jun 2016 08:10:53 +0000 (17:10 +0900)]
Revert "Fix a posible hang during health checking"
This reverts commit
706c78a9c67e66da716ea7170b345f6aa641fb5e.
pengbo [Mon, 20 Jun 2016 10:41:26 +0000 (19:41 +0900)]
change docs
pengbo [Mon, 20 Jun 2016 10:09:37 +0000 (19:09 +0900)]
change docs
pengbo [Fri, 17 Jun 2016 08:56:41 +0000 (17:56 +0900)]
Prepare 3.1.19
Tatsuo Ishii [Wed, 15 Jun 2016 08:10:01 +0000 (17:10 +0900)]
Fix bug with load balance node id info on shmem
There are few places where the load balance node was mistakenly put on
wrong place. It should be placed on: ConnectionInfo *con_info[child
id, connection pool_id, backend id].load_balancing_node]. In fact it
was placed on: *con_info[child id, connection pool_id,
0].load_balancing_node].
As long as the backend id in question is 0, it is ok. However while
testing pgpool-II 3.6's enhancement regarding failover, if primary
node is 1 (which is the load balance node) and standby is 0, a client
connecting to node 1 is disconnected when failover happens on node
0. This is unexpected and the bug was revealed.
It seems the bug was there since long time ago but it had not found
until today by the reason above.
Yugo Nagata [Wed, 15 Jun 2016 06:24:21 +0000 (15:24 +0900)]
Fix a posible hang during health checking
Helath checking was hang when any data wasn't sent
from backend after connect(2) succeeded. To fix this,
pool_check_fd() returns 1 when select(2) exits with
EINTR due to SIGALRM while health checkking is performed.
Reported and patch provided by harukat and some modification
by Yugo. Per bug #204.
backported from 3.4 or later;
https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commitdiff;h=
ed9f2900f1b611f5cfd52e8f758c3616861e60c0
pengbo [Thu, 9 Jun 2016 04:38:16 +0000 (13:38 +0900)]
change the Makefile under the directory src/sql/, that is proposed
by [pgpool-hackers: 1611]
-PG_CONFIG = pg_config
+PG_CONFIG ?= pg_config
Tatsuo Ishii [Wed, 25 May 2016 01:57:42 +0000 (10:57 +0900)]
Deal with the case when the primary is not node 0 in streaming replication mode.
http://www.pgpool.net/mantisbt/view.php?id=194#c837 reported that if
primary is not node 0, then statement timeout could occur even after
bug194-3.3.diff was applied. After some investigation, it appeared
that MASTER macro could return other than primary or load balance
node, which was not supposed to happen, thus do_query() sends queries
to wrong node (this is not clear from the report but I confirmed it in
my investigation).
pool_virtual_master_db_node_id(), which is called in MASTER macro
returns query_context->virtual_master_node_id if query context
exists. This could return wrong node if the variable has not been set
yet. To fix this, the function is modified: if the variable is not
either load balance node or primary node, the primary node id is
returned.
Tatsuo Ishii [Tue, 24 May 2016 14:41:23 +0000 (23:41 +0900)]
If statement timeout is enabled on backend and do_query() sends a
query to primary node, and all of following user queries are sent to
standby, it is possible that the next command, for example END, could
cause a statement timeout error on the primary, and a kind mismatch
error on pgpool-II is raised.
This fix tries to mitigate the problem by sending sync message instead
of flush message in do_query(), expecting that the sync message reset
the statement timeout timer if we are in an explicit transaction. We
cannot use this technique for implicit transaction case, because the
sync message removes the unnamed portal if there's any.
Plus, pg_stat_statement will no longer show the query issued by
do_query() as "running".
Per bug194.
Muhammad Usama [Mon, 23 May 2016 15:24:08 +0000 (20:24 +0500)]
Permit pgpool to support multiple SSL cipher protocols
Currently TLSv1_method() is used to initialize the SSL context, that puts an
unnecessary limitation to allow only TLSv1 protocol for SSL communication.
While postgreSQL supports other ciphers protocols as well. The commit changes
the above and initializes the SSLSession using the SSLv23_method()
(same is also used by PostgreSQL). Because it can negotiate the use of the
highest mutually supported protocol version and remove the limitation of one
specific protocol version.
Tatsuo Ishii [Fri, 20 May 2016 17:48:18 +0000 (02:48 +0900)]
Fix confusing comments in pgpool.conf
pengbo [Thu, 12 May 2016 02:25:34 +0000 (11:25 +0900)]
Fix Chinese documetation bug about raw mode
Connection pool is avalilable in raw mode.
Yugo Nagata [Wed, 11 May 2016 09:35:08 +0000 (18:35 +0900)]
Fix documetation bug about raw mode
Connection pool is avalilable in raw mode.
pengbo [Mon, 9 May 2016 05:58:49 +0000 (14:58 +0900)]
Fix is_set_transaction_serializable() when
SET default_transaction_isolation TO 'serializable'.
SET default_transaction_isolation TO 'serializable' is sent to
not only primary but also to standby server in streaming replication mode,
and this causes an error. Fix is, in streaming replication mode,
SET default_transaction_isolation TO 'serializable' is sent only to the
primary server.
See bug 191 for related info.
pengbo [Tue, 26 Apr 2016 03:23:45 +0000 (12:23 +0900)]
Prepare 3.1.18
pengbo [Tue, 26 Apr 2016 01:53:33 +0000 (10:53 +0900)]
Prepare 3.1.18
pengbo [Wed, 20 Apr 2016 03:40:41 +0000 (12:40 +0900)]
Change the PID length of pcp_proc_count command result to 6 characters long
If the pgpool process ID are over 5 characters, the 6th character of each process ID
will be removed.This commit changes the process ID length of pcp_proc_count command
result to 6 characters long.
See bug 188 for related info.
Tatsuo Ishii [Fri, 15 Apr 2016 04:17:23 +0000 (13:17 +0900)]
Redirect all user queries to primary server
Up to now some user queries are sent to other than the primary server
even if load_balance_mode = off. This commit changes the behavior: if
load_balance_mode = off in streaming replication mode, now all the
user queries are sent to the primary server only.
See bug 189 for related info.
Muhammad Usama [Thu, 7 Apr 2016 18:37:22 +0000 (23:37 +0500)]
removing the limit on the maximum number of items in the black_function_list
and white_function_list lists.
extract_string_tokens in pool_config uses the fixed size malloc on the array to
hold the black_function_list/white_function_list items. This imposes a limit of
maximum items in these lists. The fix is to use realloc to increase the array
size when it gets full.
Yugo Nagata [Mon, 4 Apr 2016 10:53:34 +0000 (19:53 +0900)]
Prepare 3.1.17
Yugo Nagata [Mon, 4 Apr 2016 10:26:23 +0000 (19:26 +0900)]
Prepare 3.0.17
Muhammad Usama [Tue, 29 Mar 2016 20:30:33 +0000 (01:30 +0500)]
Validating the PCP packet length
Without the validation check, a malformed PCP packet can crash the PCP child
and/or can run the server out of memory by sending the packet with a
very large data size.
Tatsuo Ishii [Mon, 28 Mar 2016 05:14:07 +0000 (14:14 +0900)]
Fix typo
Tatsuo Ishii [Sat, 19 Mar 2016 02:21:33 +0000 (11:21 +0900)]
Fix installation procedure.
With PostgreSQL 9.4 or later, installing pgpool_regclass is not
needed.
Tatsuo Ishii [Wed, 16 Mar 2016 00:34:06 +0000 (09:34 +0900)]
Change description of backend_flag.
It is pointed out that restarting pgpool-II is not
necessary. [pgpool-general-jp: 1394].
Muhammad Usama [Mon, 22 Feb 2016 12:23:46 +0000 (17:23 +0500)]
Yet another reset query stuck problem fix. [pgpool-general: 4265]
The solution is to return POOL_END_WITH_FRONTEND_ERROR instead of
POOL_END when pool_flush on front-end socket fails
Yugo Nagata [Fri, 5 Feb 2016 06:34:57 +0000 (15:34 +0900)]
Prepare 3.1.16
Tatsuo Ishii [Sun, 17 Jan 2016 13:04:13 +0000 (22:04 +0900)]
Fix bug#156: problem with reloading.
While reloading pgpool.conf, the number of DB nodes is tentatively set
to 0, then counted up until reaching to the actual number of backends
by the pgpool main process. Unfortunately the variable is on the
shared memory and it confuses pgpool child process if they are using
the variable. To solve the problem, a local variable is used to count
up the number of backend. After finishing the counting, the value of
the local variable is assigned to the variable on the shared memory.
I will explain why we don't need interlocking:
1) If the number of backend has not changed before/after the loop,
it's obviously fine.
2) If the number of backend has increased after the loop, the new
backend is recognized as "CON_UNUSED" because all the status for
each backend is set to "CON_UNUSED" beforehand.
3) If the number of backend has decreased after the loop, failover
should have happened and child process should have restarted.
However, we should be careful so that the assignment of the variable
should happen in an atomic manner. For this purpose I change the data
type of the variable from int to sig_atomic_t.
Tatsuo Ishii [Wed, 2 Dec 2015 12:48:59 +0000 (21:48 +0900)]
Fix bug with "SET TRANSACTION READ ONLY".
Pgpool-II remembers that non read only queries (including SET) were
executed in an explicit transaction and adds a "writing transaction"
mark to the transaction. The mark affects the query routing behavior
of pgpool-II while running in streaming replication mode. Pgpool-II
starts sending queries to the primary after the mark is set. Because
the effect of writing queries may appear on standbys after some delay
in streaming replication mode, it is safer to route read queries to
the primary after the mark is set.
However there's oversight here. "SET TRANSACTION READ ONLY" does no
data modification and should be treated as an exception.
Per bug #157.
Tatsuo Ishii [Fri, 30 Oct 2015 06:08:42 +0000 (15:08 +0900)]
Ignore close statement/portal request if they do not exist.
In this case just returns a close complete message to client.
This is a back port of commit:
1a37e1c35bd8b6f10f524693bbcb7b51f73b4bf0
which should have been back ported earlier.
Tatsuo Ishii [Fri, 16 Oct 2015 05:34:43 +0000 (14:34 +0900)]
Update copyright year.
Yugo Nagata [Fri, 4 Sep 2015 05:15:09 +0000 (14:15 +0900)]
Fix wrong description about log_standby_delay in the document
Yugo Nagata [Fri, 21 Aug 2015 05:46:39 +0000 (14:46 +0900)]
Fix conflicts of documents
These were caused by some old commits but not resolved.
Tatsuo Ishii [Thu, 6 Aug 2015 06:15:24 +0000 (15:15 +0900)]
Issue fsync() when writing pgpool_status.
This ensures that pgpool_status is saved to permanent storage and
allow to survive after system crash.
Tatsuo Ishii [Wed, 5 Aug 2015 06:27:26 +0000 (15:27 +0900)]
Fix misinformation regarding load balancing in docs.
In streaming replication mode, DECLARE, FETCH, CLOSE and SHOW are sent
to primary node only. Pointed out in [pgpool-general-jp: 1378].
Yugo Nagata [Fri, 24 Jul 2015 05:41:35 +0000 (14:41 +0900)]
Prepare 3.1.15
Tatsuo Ishii [Sun, 21 Jun 2015 09:51:34 +0000 (18:51 +0900)]
Do not send a query for checking insert lock in non replication mode with extended query
This unnecessary code was there since day 0.
Muhammad Usama [Thu, 9 Apr 2015 17:38:59 +0000 (22:38 +0500)]
Fixing "cannot find xlog functions" error in pgpool-recovery
The argument data type of PG's pg_xlogfile_name() function has been changed from
text to pg_lsn since PostgreSQL 9.4. And pgpool-recovery was still trying to
locate the function by old signature.
Yugo Nagata [Wed, 8 Apr 2015 07:07:42 +0000 (16:07 +0900)]
Prepare 3.1.14
Muhammad Usama [Tue, 7 Apr 2015 12:48:44 +0000 (17:48 +0500)]
Fixing a problem with pcp_detach_node, When graceful node detach is requested
gracefully detaching a node by pcp_detach_node should check if it is allowed to
process detach_node command on the particular node before blocking the incoming
connections and closing the existing connections.
Conflicts:
main.c
Muhammad Usama [Wed, 18 Mar 2015 10:21:31 +0000 (15:21 +0500)]
Support SSL certificate chains in the certificate file for incoming frontend connections.
Tatsuo Ishii [Thu, 19 Feb 2015 01:33:57 +0000 (10:33 +0900)]
Enlarge POOLCONFIG_MAXDESCLEN to 80.
This is used in show pool_status command and limits the length of
parameter description. Unfortunately recovery_timeout description is
64 chars, which is 1 byte longer than former definition of the macro
because we need on more byte for null termination.
Yugo Nagata [Thu, 5 Feb 2015 10:23:22 +0000 (19:23 +0900)]
Prepare 3.1.13
Tatsuo Ishii [Wed, 19 Nov 2014 01:34:14 +0000 (10:34 +0900)]
Fix node id range check bug in trigger_failover_command().
The node id should be lower than NUM_BACKENDS. Probably harmless since
callers never pass node ids greater or equal to NUM_BACKENDS. But a
bug is a bug.
Yugo Nagata [Wed, 22 Oct 2014 12:48:48 +0000 (21:48 +0900)]
Fix to disable debug mode with a config reload
Per bug #114
Tatsuo Ishii [Tue, 21 Oct 2014 01:22:05 +0000 (10:22 +0900)]
Fix missing release note entries in the previous release.
Tatsuo Ishii [Fri, 17 Oct 2014 11:08:12 +0000 (20:08 +0900)]
Fix uninitialized variable.
Per Coverity
1234603.
Tatsuo Ishii [Thu, 25 Sep 2014 00:51:05 +0000 (09:51 +0900)]
Fix typo in docs.
Per Yaron Naveh.
Tatsuo Ishii [Sat, 13 Sep 2014 05:51:09 +0000 (14:51 +0900)]
Explicitly stats that the number of slaves is not necessarily 1.
Yugo Nagata [Fri, 12 Sep 2014 07:23:36 +0000 (16:23 +0900)]
Fix typos
Yugo Nagata [Fri, 5 Sep 2014 13:48:34 +0000 (22:48 +0900)]
Prepare 3.1.12
Muhammad Usama [Wed, 3 Sep 2014 13:54:23 +0000 (18:54 +0500)]
fixing small coverity issues: 751966 Argument cannot be negative,
1111399 Explicit null dereferenced and
1111488 Uninitialized scalar variable
Muhammad Usama [Tue, 12 Aug 2014 14:41:32 +0000 (19:41 +0500)]
Fix coverity issue
1111480 Copy into fixed size buffer
replacing strcpy() with much safer and recomended call strlcpy()
Muhammad Usama [Tue, 5 Aug 2014 14:47:31 +0000 (19:47 +0500)]
Back porting coverity issues fix patch from master branch.
Fix coverity issue:
1111377 Unchecked return value
Fix coverity issue:
1111381 Logically dead code
Fix coverity issue:
1222992 Unchecked return value
Fix coverity issue:
1222993 Unchecked return value
Muhammad Usama [Mon, 28 Jul 2014 12:50:21 +0000 (17:50 +0500)]
Back porting coverity issues fix patch from master branch.
Fix coverity issue:
1111394 Dereference after null check
Fix coverity issue:
1111398 Dereference after null check
Fix coverity issue:
1111399 Explicit null dereferenced
Fix coverity issue:
1111400 Dereference after null check
Fix coverity issue:
1111401 Explicit null dereferenced
Tatsuo Ishii [Fri, 25 Jul 2014 04:59:20 +0000 (13:59 +0900)]
Add a description that pcp_detach_node disconnects existing sessions.
Tatsuo Ishii [Thu, 24 Jul 2014 06:40:51 +0000 (15:40 +0900)]
Fix yet another reset query stuck problem.
If client_idle_limit is set and the idle limit reaches,
pool_process_query() returns and tries to execute reset query which
may not be acceptable by backend because it may not be in "ready for
query" state. The fix is, close connections to backend instead.
Per bug#107.
Tatsuo Ishii [Fri, 18 Jul 2014 07:37:56 +0000 (16:37 +0900)]
Fix reset query stuck problem.
It is reported that reset query (DISCARD ALL etc.) occasionally does
not finish and pgpool child remain waiting for reply from backend thus
client cannot connect to pgpool (for example
http://www.pgpool.net/mantisbt/view.php?id=107). The cause of problem
is not identified yet but if client suddenly closes connection to
pgpool in the middle of query processing, backend may not accept the
reset queries because they are not ready for query.
The fix is, if frontend closes connection in unexpected way, query
process loop immediately returns with new state:
POOL_END_WITH_FRONTEND_ERROR and pgpool closes connection to
PostgreSQL then goes back to new connection request waiting loop.
Muhammad Usama [Thu, 17 Jul 2014 13:50:50 +0000 (18:50 +0500)]
Back porting coverity issues fix patch from master branch.
Fix coverity issue:
1111380 Logically dead code
Fix coverity issue:
1111382 Logically dead code
Fix coverity issue:
1111402 Explicit null dereferenced
Fix coverity issue:
1111405 Explicit null dereferenced
Fix coverity issue:
1111407 Dereference after null check
Fix coverity issue:
1111408 Explicit null dereferenced
Fix coverity issue:
1111409 Dereference after null check
Fix coverity issue:
1111383 Logically dead code
Fix coverity issue:
1111492 Structurally dead code
Fix coverity issue:
1111417 Nesting level does not match indentation
Fix coverity issue:
1111379 Logically dead code
Fix coverity issue:
1111406 Explicit null dereferenced
Fix coverity issue:
1111396 Explicit null dereferenced
Fix coverity issue:
1111397 Explicit null dereferenced
Tatsuo Ishii [Wed, 16 Jul 2014 09:22:21 +0000 (18:22 +0900)]
Fix wrong error message.
Muhammad Usama [Tue, 15 Jul 2014 12:42:53 +0000 (17:42 +0500)]
Back porting coverity issues fix patch from master branch.
Fix coverity issue:
1111387 Explicit null dereferenced
Fix coverity issue:
1111388 Explicit null dereferenced
Fix coverity issue:
1111411 Missing break in switch
Fix coverity issue:
1111412 Missing break in switch
Fix coverity issue:
1111450 Resource leak
Fix coverity issue:
1111451 Resource leak
Fix coverity issue:
1111472 Dereference before null check
Fix coverity issue:
1111473 Dereference before null check
Fix coverity issue:
1111474 Dereference before null check
Fix coverity issue:
1111475 Wrong sizeof argument
Fix coverity issue:
1111495 Use after free
Fix coverity issue:
1111496 Use after free
Fix coverity issue:
1222989 Bad bit shift operation
Fix coverity issue:
1222990 Bad bit shift operation
Fix coverity issue:
1222994 Explicit null dereferenced
Muhammad Usama [Fri, 11 Jul 2014 11:14:00 +0000 (16:14 +0500)]
Fix coverity issue:
1222999 Resource leak.
Fix coverity issue:
1222998 Resource leak.
Muhammad Usama [Fri, 11 Jul 2014 09:58:29 +0000 (14:58 +0500)]
Fix coverity issue:
1223003 Uninitialized scalar variable.
Fix coverity issue:
1223002 Uninitialized scalar variable.
Fix coverity issue:
1223001 Resource leak.
Fix coverity issue:
1223000 Resource leak.
Muhammad Usama [Tue, 8 Jul 2014 12:15:22 +0000 (17:15 +0500)]
fix coverity issue:
1223007 Use after free.
get_insert_command_table_name() function was using the
freed pointer in pool_debug() function call.
Tatsuo Ishii [Sat, 21 Jun 2014 10:23:02 +0000 (19:23 +0900)]
Disbale statement_timeout while executing online recovery.
Online may take very long time and user may enable statement
timeout. To prevent online recovery canceled by statement timeout,
disable statement timeout in the connection used by online recovery.
See [pgpool-general: 2919] for whole story.
Tatsuo Ishii [Mon, 9 Jun 2014 12:39:21 +0000 (21:39 +0900)]
Remove unnecessary call to pool_shmem_exit() which removes semaphore when it shouldn't.
exit_handler checks if the process is parent or not. This is
good. However, even if it is a child process, it calls
pool_shmem_exit() which removes semaphore and shmem when it should
not (it should be called only from parent process).
Per bug #102.
Yugo Nagata [Wed, 28 May 2014 04:37:42 +0000 (13:37 +0900)]
Fix pgpool.init's long-standing bug of stop/restart failure
In previous, pgpool.init uses killproc for stopping pgpool, but there are
several problems; (1) some child processes can be left since the parent
process restarts killed processes; (2) when pgpool has connection from
clients, pgpool can't stop until connection closed; (3) restart() fails
for these reasons.
In the new version, "pgpool -m fast stop" is used in stop(). The problems
above are resolved and restart() also works well, even when watchdog enabled.
In addition, exit code according with LSB is considered, try-restart
option is implemented, and the old switch option is removed.
Original patch contributed by Ryan DeShone and modified by Yugo Nagata.
See [pgpool-hackers: 239][pgpool-hackers: 512].
Yugo Nagata [Wed, 28 May 2014 04:37:42 +0000 (13:37 +0900)]
Fix pgpool.init's long-standing bug of stop/restart failure
In previous, pgpool.init uses killproc for stopping pgpool, but there are
several problems; (1) some child processes can be left since the parent
process restarts killed processes; (2) when pgpool has connection from
clients, pgpool can't stop until connection closed; (3) restart() fails
for these reasons.
In the new version, "pgpool -m fast stop" is used in stop(). The problems
above are resolved and restart() also works well, even when watchdog enabled.
In addition, exit code according with LSB is considered, try-restart
option is implemented, and the old switch option is removed.
Original patch contributed by Ryan DeShone and modified by Yugo Nagata.
See [pgpool-hackers: 239][pgpool-hackers: 512].
Tatsuo Ishii [Fri, 23 May 2014 20:55:25 +0000 (05:55 +0900)]
Fix memory leak.
Per Coverity
1111442.
Tatsuo Ishii [Fri, 23 May 2014 17:29:09 +0000 (02:29 +0900)]
Fix file descriptor leak when daemonize.
Per Coverity
1111471.
Yugo Nagata [Sun, 18 May 2014 22:16:13 +0000 (07:16 +0900)]
Update copyright year
Yugo Nagata [Fri, 16 May 2014 09:53:16 +0000 (18:53 +0900)]
Fix return type of text_to_lsn() function
Tatsuo Ishii [Fri, 16 May 2014 07:39:38 +0000 (16:39 +0900)]
Remove old restriction description which is no longer true.
Following descriptions are removed ([pgpool-general: 2815].
>> pgpool-II does not support pg_hba.conf-like access controls. If TCP/IP
> connections are enabled, pgpool-II accepts all the connections from any
> host.
>> "hostssl" connection type is not supported
Yugo Nagata [Fri, 18 Apr 2014 07:01:04 +0000 (16:01 +0900)]
Fix names in release notes
Yugo Nagata [Fri, 18 Apr 2014 06:35:11 +0000 (15:35 +0900)]
Fix release notes' style and add missing notes
Tatsuo Ishii [Sat, 5 Apr 2014 09:27:41 +0000 (18:27 +0900)]
Add cautions that recovery commands are killed by statement_timeout of PostgreSQL.
recovery_1st_stage_command can be killed if its execution time is
longer than statement_timeout and online recovery fails. The problem
was found and reported by Sean Hogan at [pgpool-general:
2680]. Samething can be said to recovery_2nd_stage_command.
Tatsuo Ishii [Sat, 29 Mar 2014 08:36:50 +0000 (17:36 +0900)]
Close listen socket when smart shutdown request is made.
When smart shutdown process starts, pgpool children still listen on
the port and clients can send further connection requests which fail
in the end. Which is not only waste of time, but also prevents a load
balancer which sits in front of pgpool from realizing the pgpool is
going down.
Problem analyzed and patch provided by Junegunn Choi in pgpool-hackers
474, and enhanced to take care not only inet domain socket but UNIX
domain socket by me.
Tatsuo Ishii [Thu, 27 Mar 2014 07:55:11 +0000 (16:55 +0900)]
Fix worker child process keeps failing when there's no primary backend.
Problem identified and fix contributed by Junegunn Choi.
From pgpool-hackers: 471
==================================================================
Hi,
I've identified that worker child process keeps failing when
there's no primary backend in the cluster at the moment.
We're running a streaming replication cluster with 3 nodes. Because of
a sudden H/W problem of the master server, I detached the node from
pgpool using `pcp_detach_node` command, in order to temporarily make
the cluster read-only. pgpool then worked as expected, it rejected
write requests and still served read requests using the remaining two
standby nodes. The problem is, the worker child process which checks
for replication lag, keeps failing and being recreated without a
pause. So naturally it generates massive amount of log messages, and
keeps creating backend connections, which in turn leaves a large
number of TIME_WAIT sockets on the system.
2014-03-27 15:33:57 LOG: pid: 21996 fork a new worker child pid 28453
2014-03-27 15:33:57 ERROR: pid: 28453 do_query: error message from backend:
recovery is in progress. Exit this session.
2014-03-27 15:33:57 LOG: pid: 21996 worker child 28453 exits with status
256
2014-03-27 15:33:57 LOG: pid: 21996 fork a new worker child pid 28455
2014-03-27 15:33:57 ERROR: pid: 28455 do_query: error message from backend:
recovery is in progress. Exit this session.
2014-03-27 15:33:57 LOG: pid: 21996 worker child 28455 exits with status
256
2014-03-27 15:33:57 LOG: pid: 21996 fork a new worker child pid 28459
2014-03-27 15:33:57 ERROR: pid: 28459 do_query: error message from backend:
recovery is in progress. Exit this session.
2014-03-27 15:33:57 LOG: pid: 21996 worker child 28459 exits with status
256
...
Looking at the code, I found that the cause is that it invokes
`pg_current_xlog_location()` on the first remaining standby node, when
it shouldn't. In fact, there's no reason to check for replication lag
in such case.
I've attached a simple patch, which makes worker child to skip checking
when there's no primary node.
Please take a look.
Thanks.
Junegunn Choi.
Yugo Nagata [Wed, 26 Mar 2014 07:24:03 +0000 (16:24 +0900)]
Fix a typo of pgpool.spec
Yugo Nagata [Mon, 24 Mar 2014 13:55:31 +0000 (22:55 +0900)]
Prepare 3.1.11
Yugo Nagata [Mon, 24 Mar 2014 09:56:06 +0000 (18:56 +0900)]
Add description about parallel mode doesn't support PREPARE
Yugo Nagata [Mon, 24 Mar 2014 06:05:10 +0000 (15:05 +0900)]
Fix backend error of prepared statement including now() via JDBC in replication mode
With JDBC, when a prepared statement is executed more than PreparedThreshold times,
the statement is named, and pgpool rewrites now() to parameter in replication mode.
Hence, rewritten query has additonal parameter, so Bind message also should inclued
additional parameter format codes. However, when the number of original parameter was
one, pgpool didn't handle this. This caused a error like "incorrect binary data format
in bind parameter 2" on backend.
Yugo Nagata [Fri, 14 Mar 2014 06:20:59 +0000 (15:20 +0900)]
Fix JDBC exception of prepared statement including now() in replication mode
With JDBC, when a prepared statement is executed more than PreparedThreshold times,
the statement is named and Describe message is sent after Parse. With named statement,
pgpool rewrite now() to parameter at Parse in replication mode. Hence, rewritten query
has additonal parameter than original. However, ParameterDescription message sent to
frontend, which is response of Describe, should include OIDs of the same number os
original query's parameters. Otherwize, JDBC raises ArrayIndexoutOfBoundsException.
Yugo Nagata [Fri, 28 Feb 2014 10:51:02 +0000 (19:51 +0900)]
Forgotten in previous commit
Yugo Nagata [Fri, 28 Feb 2014 10:40:17 +0000 (19:40 +0900)]
Fix to output debug messages in processing pgpool.conf with -d option
In previous, debug messages in pool_get_config() ware not output
even when -d option was used.
Yugo Nagata [Fri, 28 Feb 2014 07:19:20 +0000 (16:19 +0900)]
Fix a segmentation fault in parallel mode with system_db_hostname is empty
When system_db_hostname is empty, unix domain socket should be used.
However, the directory containing the socket file was't specified in this
case, and the initialization of system DB connection failed. This caused
segmentation fault, when processing a query to system db.
Tatsuo Ishii [Wed, 26 Feb 2014 08:11:23 +0000 (17:11 +0900)]
Fix memory leak.
Per Coverity
1111446.