pgpool2.git
8 years agoFix documentation of load-balancing
Yugo Nagata [Thu, 24 Aug 2017 09:38:47 +0000 (18:38 +0900)]
Fix documentation of load-balancing

8 years agoFix ancient bug of pool_unread.
Tatsuo Ishii [Tue, 15 Aug 2017 01:35:22 +0000 (10:35 +0900)]
Fix ancient bug of pool_unread.

When realloc() is called in pool_unread(), it did not update the
buffer size.  This could cause variety of memory corruption and
unexpected data reading from backend. The reason why we did not found
that is, probably recently Pgpool-II starts extensively to use
pool_unread().

8 years agoFix Java program in 005.regression test.
Tatsuo Ishii [Thu, 3 Aug 2017 03:41:40 +0000 (12:41 +0900)]
Fix Java program in 005.regression test.

The program forgot issue commit and always ended up with ABORT.  This
does not affect the test result itself, it would be better to finish
the test with commit, rather than ABORT.

8 years agoFix bug #303.
Tatsuo Ishii [Thu, 3 Aug 2017 02:52:24 +0000 (11:52 +0900)]
Fix bug #303.

When failover is triggered by worker process, it is possible that
wrong DB node could failover. This is due to the db_node_id member in
the POLL_CONNECTION structure is not initialized in the process (in
child process the member is properly initialized). To solve the
problem, add new function pool_set_db_node_id() to set the structure
member variable and call it inside
make_persistent_db_connection(). For this purpose also the new
parameter "db_node_id" is added to make_persistent_db_connection and
friends.

8 years agoFix starting unnecessary transaction when SET command is issued.
Tatsuo Ishii [Mon, 31 Jul 2017 08:29:27 +0000 (17:29 +0900)]
Fix starting unnecessary transaction when SET command is issued.

In streaming replication mode, there's no point to start internal
transaction when SET command is issued. The existing behavior is
harmless but waste of CPU cycle.

8 years agoFix for [pgpool-general: 5621] pgpool 3.6.4 failover
Muhammad Usama [Thu, 27 Jul 2017 14:55:40 +0000 (19:55 +0500)]
Fix for [pgpool-general: 5621] pgpool 3.6.4 failover

Failover() function should be executed with health check alarm disabled

The reason is the find primary node and health check uses the same function to
make a connection to the backends, and the backend connect function has a built
in logic to bail out with the timeout error when the health check alarm occurs.
Now the problem is if the failover() is executed while the health check alarm is
still running, Their is a strong possibility that the find primary node function
may find the health check timer already expired and exit without locating the
new primary node.

The relevant part is back-ported from the 3.6 branch

8 years agoUpdate pgpool.conf.sample.patch to fix build rpm error. V3_3_16 V3_3_16_RPM
pengbo [Tue, 11 Jul 2017 04:19:52 +0000 (13:19 +0900)]
Update pgpool.conf.sample.patch to fix build rpm error.

8 years agoFix building rpm package error.
pengbo [Tue, 11 Jul 2017 03:27:59 +0000 (12:27 +0900)]
Fix building rpm package error.

8 years agoPrepare 3.3.16.
pengbo [Mon, 10 Jul 2017 07:41:56 +0000 (16:41 +0900)]
Prepare 3.3.16.

8 years agoFixing: [pgpool-hackers: 2390] Problems with the relative paths in daemon mode
Muhammad Usama [Fri, 23 Jun 2017 22:45:55 +0000 (03:45 +0500)]
Fixing: [pgpool-hackers: 2390] Problems with the relative paths in daemon mode

Pgpool-II does all the path related calculations based on CWD
(current working directory) which only works as expected and intended
until the CWD does not change.
But in daemon mode the first thing Pgpool-II do after becoming the daemon
process is, it changes it's CWD to system root ("/") and after that all the
relative paths becomes invalid.
This means in daemon mode if the pgpool.conf file is specified as an argument
using the relative path, Pgpool-II will not be able to find the pool_passwd
or other required file whose location depends on the location of pgpool.conf
file, and will eventually fail to start, or even worst may read/write
some wrong file.

The solution to this is to convert the relative path of the pgpool.conf and
all file paths provided in the argument list to the Pgpool-II to the absolute
paths at the startup and later use those absolute paths for all path related
calculations.

Apart from using the absolute paths for pgpool.conf, pcp.conf and pool_hba.conf
files, The commit also modifies the behaviour of pid_file_name configuration
parameter, when the relative path is used for this config in pgpool.conf,
that relative path is considered with relative to the pgpool.conf path,
instead of the current working directory.

8 years agoAdjust function name change in PostgreSQL 10 dev head.
Tatsuo Ishii [Mon, 19 Jun 2017 07:40:06 +0000 (16:40 +0900)]
Adjust function name change in PostgreSQL 10 dev head.

pg_current_wal_location -> pg_current_wal_lsn
pg_last_wal_replay_location -> pg_last_wal_replay_lsn

8 years agoFix query cache hang when used by node.js.
Tatsuo Ishii [Wed, 31 May 2017 01:45:55 +0000 (10:45 +0900)]
Fix query cache hang when used by node.js.

node.js sends a query in following pattern:

Parse
Bind
Describe
Execute
Flush
Sync

Notice the "Flush" message. This is unnecessary message and Pgpool-II
did not prepare for it. Since Pgpool-I supposed that next message to
Execute is "Sync" in pool_fetch_from_memory_cache(), it actually read
the "Flush" message and forwarded to backend, then discarded
subsequent "Ready for query" message, which was actually a "Sync"
message. That results in no "ready for query" message from backend.

Fix is, do not have any assumption regarding messages after Execute,
instead returns to the message processing loop. This way, whatever
messages coming after Execute should be properly processed.

Following is the test data for pgproto.

'Q' "DROP TABLE IF EXISTS pgproto_test1"
'Y'
'Q' "CREATE TABLE pgproto_test1(i INT)"
'Y'
'Q' "INSERT INTO pgproto_test1 VALUES(1)"
'Y'

'P' "S2" "SELECT 1 FROM pgproto_test1" 0
'B' "" "S2" 0 0 0
'D' 'S' "S2"
'E' "" 0
'H'
'C' 'S' "S2"
'S'
'Y'

'P' "S2" "SELECT 1 FROM pgproto_test1" 0
'B' "" "S2" 0 0 0
'D' 'S' "S2"
'E' "" 0
'H'
'C' 'S' "S2"
'S'
'Y'
'X'

Discussion: http://www.pgpool.net/pipermail/pgpool-general/2017-May/005569.html

8 years agoDeal with PostgreSQL 10 in streaming replication delay checking.
Tatsuo Ishii [Mon, 29 May 2017 08:37:38 +0000 (17:37 +0900)]
Deal with PostgreSQL 10 in streaming replication delay checking.

From PostgreSQL 10 or later, some built in function names which are
used in streaming replication delay checking are changed. To deal with
this, get server_version_num from backend to change the calling
functions and cache them. Using 'S' message to extract the server
version string while connecting backend could be an idea, but
unfortunately connecting function used in streaming replication delay
checking does not handle 'S' parameter. Also converting from the
server version string to the server_version_num can be backend
dependent, so to extract the server_version_num would be safer.

8 years agoFix query cache memory leak.
Tatsuo Ishii [Sat, 27 May 2017 11:28:40 +0000 (20:28 +0900)]
Fix query cache memory leak.

Clearing cache buffers in case of no oid queries (like BEGIN,
CHECKPOINT, VACUUM, etc) should have been done, but it did not.
Patch from Dang Minh Huong.

8 years agoPrepare 3.3.15. V3_3_15 V3_3_15_RPM
pengbo [Thu, 27 Apr 2017 10:03:23 +0000 (19:03 +0900)]
Prepare 3.3.15.

8 years agoFix for 0000299: Errors on the reloading of configuration
Muhammad Usama [Wed, 12 Apr 2017 14:29:55 +0000 (19:29 +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 agoFix coverity reported issues of buffer overrun.
Muhammad Usama [Tue, 4 Apr 2017 11:11:15 +0000 (16:11 +0500)]
Fix coverity reported issues of buffer overrun.

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

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 agoAdd "Wants=network.target" to pgpool.service file. V3_3_14 V3_3_14_RPM
pengbo [Fri, 17 Mar 2017 01:27:57 +0000 (10:27 +0900)]
Add "Wants=network.target" to pgpool.service file.

per bug294.

8 years agoPrepare 3.3.14
pengbo [Thu, 16 Mar 2017 23:51:18 +0000 (08:51 +0900)]
Prepare 3.3.14

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 agoAdd the latest release note link to README file.
pengbo [Tue, 28 Feb 2017 05:45:32 +0000 (14:45 +0900)]
Add the latest release note link to README file.

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 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 agoFixing 0000280: stack smashing detected
Muhammad Usama [Thu, 26 Jan 2017 20:48:38 +0000 (01:48 +0500)]
Fixing 0000280: stack smashing detected

It was a buffer overflow in wd_get_cmd function.

8 years agoRemove pool_log/pool_error calls from signal handlers.
Tatsuo Ishii [Wed, 11 Jan 2017 00:38:16 +0000 (09:38 +0900)]
Remove pool_log/pool_error calls from signal handlers.

pool_log/pool_error 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 pool_log/pool_debug 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 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 09:07:28 +0000 (18:07 +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 agoRemove pgpool_adm from Pgpool-II 3.3.x RPM. V3_3_13 V3_3_13_RPM
pengbo [Mon, 26 Dec 2016 11:08:31 +0000 (20:08 +0900)]
Remove pgpool_adm from Pgpool-II 3.3.x RPM.

8 years agoPrepare 3.3.13
pengbo [Mon, 26 Dec 2016 02:54:01 +0000 (11:54 +0900)]
Prepare 3.3.13

8 years agoTightening up the watchdog security
Muhammad Usama [Fri, 23 Dec 2016 16:00:56 +0000 (21:00 +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:16:36 +0000 (11:16 +0900)]
Add pgpool_adm extension.

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.

9 years agoAdopt the incompatibility with psql of PostgreSQL 9.6.
Tatsuo Ishii [Thu, 27 Oct 2016 08:42:26 +0000 (17:42 +0900)]
Adopt the incompatibility with psql of PostgreSQL 9.6.

Since -c option does not imply -X anymore in 9.6, regression fails if
.psqlrc is set, for example "\pset pager" is set.

9 years agoDo not cancel a query when the query resulted in an error other than in native replic...
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.

9 years agoChange the default value of search_primary_node_timeout from 10 to 300.
Tatsuo Ishii [Sat, 24 Sep 2016 01:42:12 +0000 (10:42 +0900)]
Change the default value of search_primary_node_timeout from 10 to 300.

Prior default value 10 seconds is sometimes too short for a standby to
be promoted.

Per [pgpool-general: 5026].

9 years agoFix the case when all backends are down then 1 node attached.
Tatsuo Ishii [Wed, 21 Sep 2016 00:26:46 +0000 (09:26 +0900)]
Fix the case when all backends are down then 1 node attached.

When all backends are down, no connection is accepted. Then 1
PostgreSQL becomes up, and attach the node using pcp_attach_node. It
successfully finishes. However, when a new connection arrives, still
the connection is refused because pgpool child process looks into the
cached status, in which the recovered node is still in down status if
mode is streaming replication mode (native replication and other modes
are fine). Solution is, if all nodes are down, force to restart all
pgpool child.

Per bug 248.

9 years agoDo not use random() while generating MD5 salt.
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.

9 years agoFix compile error due to previous commit.
Tatsuo Ishii [Mon, 5 Sep 2016 23:19:06 +0000 (08:19 +0900)]
Fix compile error due to previous commit.

9 years agoDon't ignore sync message from frontend when query cache is enabled.
Tatsuo Ishii [Mon, 5 Sep 2016 23:08:32 +0000 (08:08 +0900)]
Don't ignore sync message from frontend when query cache is enabled.

While returning cached query result, sync message sent from frontend
is discarded. This is harmless because "ready for query" messages is
sent to frontend afterward. Problem is, AccessShareLock held by
previous parse message processing is not released until sync message
is received by the backend. Fix is, forwarding the sync message to
backend and discarding "ready for query" message returned from
backend.

Per [pgpool-hackers: 1787].

9 years agoPrepare 3.3.12 V3_3_12 V3_3_12_RPM
pengbo [Tue, 30 Aug 2016 10:22:43 +0000 (19:22 +0900)]
Prepare 3.3.12

9 years agoAdd comment to the document about connection_cache.
Tatsuo Ishii [Sat, 27 Aug 2016 08:22:26 +0000 (17:22 +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.

9 years agoFixing a typo in the log message
Muhammad Usama [Fri, 12 Aug 2016 12:09:34 +0000 (17:09 +0500)]
Fixing a typo in the log message

9 years agoUnbreak version 2 protocol case.
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.

9 years agofix japanese doc typo
Bo Peng [Wed, 3 Aug 2016 02:32:26 +0000 (11:32 +0900)]
fix japanese doc typo

9 years agoFixing a typo in english doc
Muhammad Usama [Mon, 1 Aug 2016 14:22:41 +0000 (19:22 +0500)]
Fixing a typo in english doc

9 years agoReplace "MAJOR" macro to prevent occasional failure.
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).

9 years agoFix for [pgpool-hackers: 1501] kind does not match error
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.

9 years agoFix usage of wait(2) in pgpool main process
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).

9 years agoFix buffer over run problem in "show pool_nodes".
Tatsuo Ishii [Fri, 24 Jun 2016 06:56:01 +0000 (15:56 +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).

9 years agochange docs V3_3_11 V3_3_11_RPM
pengbo [Mon, 20 Jun 2016 10:34:58 +0000 (19:34 +0900)]
change docs

9 years agochange docs
pengbo [Mon, 20 Jun 2016 09:59:32 +0000 (18:59 +0900)]
change docs

9 years agoPrepare 3.3.11
pengbo [Fri, 17 Jun 2016 09:17:06 +0000 (18:17 +0900)]
Prepare 3.3.11

9 years agoFix bug with load balance node id info on shmem
Tatsuo Ishii [Wed, 15 Jun 2016 08:02:07 +0000 (17:02 +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.

9 years agoFix a posible hang during health checking
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

9 years agochange the Makefile under the directory src/sql/, that is proposed
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

9 years agoDeal with the case when the primary is not node 0 in streaming replication mode.
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.

9 years agoIf statement timeout is enabled on backend and do_query() sends a
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.

9 years agoPermit pgpool to support multiple SSL cipher protocols
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.

9 years agoFix confusing comments in pgpool.conf
Tatsuo Ishii [Fri, 20 May 2016 17:48:18 +0000 (02:48 +0900)]
Fix confusing comments in pgpool.conf

9 years agoFix Chinese documetation bug about raw mode
pengbo [Thu, 12 May 2016 02:15:17 +0000 (11:15 +0900)]
Fix Chinese documetation bug about raw mode

Connection pool is avalilable in raw mode.

9 years agoFix documetation bug about 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.

9 years agoFix is_set_transaction_serializable() when
pengbo [Mon, 9 May 2016 05:50:45 +0000 (14:50 +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.

9 years agoAllow to access to pgpool while doing health checking
Tatsuo Ishii [Thu, 5 May 2016 05:09:07 +0000 (14:09 +0900)]
Allow to access to pgpool while doing health checking

Currently any attempt to connect to pgpool fails if pgpool is doing
health check against failed node even if fail_over_on_backend_error is
off because pgpool child first tries to connect to all backend
including the failed one and exits if it fails to connect to a backend
(of course it fails). This is a temporary situation and will be
resolved before pgpool executes failover. However if the health check
is retrying, the temporary situation keeps longer depending on the
setting of health_check_max_retries and health_check_retry_delay. This
is not good. Attached patch tries to mitigate the problem:

- When an attempt to connect to backend fails, give up connecting to
  the failed node and skip to other node, rather than exiting the
  process if operating in streaming replication mode and the node is
  not primary node.

- Mark the local status of the failed node to "down".

- This will let the primary node be selected as a load balance node
  and every queries will be sent to the primary node. If there's other
  healthy standby nodes, one of them will be chosen as the load
  balance node.

- After the session is over, the child process will suicide to not
  retain the local status.

Per [pgpool-hackers: 1531].

9 years agoPrepare 3.3.10 V3_3_10 V3_3_10_RPM
pengbo [Tue, 26 Apr 2016 03:16:31 +0000 (12:16 +0900)]
Prepare 3.3.10

9 years agoPrepare 3.3.10
pengbo [Tue, 26 Apr 2016 01:42:37 +0000 (10:42 +0900)]
Prepare 3.3.10

9 years agoChange the PID length of pcp_proc_count command result to 6 characters long
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.

9 years agoRedirect all user queries to primary server
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.

9 years agoremoving the limit on the maximum number of items in the black_function_list
Muhammad Usama [Thu, 7 Apr 2016 15:25:57 +0000 (20:25 +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.

9 years agoPrepare 3.3.9 V3_3_9 V3_3_9_RPM
Yugo Nagata [Mon, 4 Apr 2016 10:51:43 +0000 (19:51 +0900)]
Prepare 3.3.9

9 years agoPrepare 3.3.9
Yugo Nagata [Mon, 4 Apr 2016 10:21:52 +0000 (19:21 +0900)]
Prepare 3.3.9

9 years agoValidating the PCP packet length
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.

9 years agoFix typo
Tatsuo Ishii [Mon, 28 Mar 2016 05:09:29 +0000 (14:09 +0900)]
Fix typo

9 years agoFix pgpool_setup to not confuse log output
Tatsuo Ishii [Sat, 26 Mar 2016 22:49:53 +0000 (07:49 +0900)]
Fix pgpool_setup to not confuse log output

Before it simply redirects the stdout and stderr of pgpool process to
a log file.  This could cause log contents being garbled or even
missed because of race condition caused by multiple process being
writing concurrently. I and Usama found this while investigating the
regression failure of 004.watchdog.

To fix this, pgpool_setup now generates startall script so that pgpool
now sends stdout/stderr to cat command and cat writes to the log file
(It seems the race condition does not occur when writing to a pipe).

9 years agoFix installation procedure.
Tatsuo Ishii [Sat, 19 Mar 2016 02:05:26 +0000 (11:05 +0900)]
Fix installation procedure.

With PostgreSQL 9.4 or later, installing pgpool_regclass is not
needed.

9 years agoChange description of backend_flag.
Tatsuo Ishii [Wed, 16 Mar 2016 00:28:38 +0000 (09:28 +0900)]
Change description of backend_flag.

It is pointed out that restarting pgpool-II is not
necessary. [pgpool-general-jp: 1394].

9 years agoFix typo in configure
Tatsuo Ishii [Mon, 14 Mar 2016 23:12:17 +0000 (08:12 +0900)]
Fix typo in configure

Patch provided by Thomas Munro.

9 years agoYet another reset query stuck problem fix. [pgpool-general: 4265]
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

9 years agoFix previous bronken commit
Yugo Nagata [Wed, 17 Feb 2016 08:24:54 +0000 (17:24 +0900)]
Fix previous bronken commit

The following commit was broken and regress test 001 failed.
- Fix memorry leak reported by Coverity (CID 1350095)

9 years agoFixing pgpool-recovery module compilation issue with PostgreSQL 9.6
Muhammad Usama [Fri, 12 Feb 2016 12:30:10 +0000 (17:30 +0500)]
Fixing pgpool-recovery module compilation issue with PostgreSQL 9.6

Incorporating the change of function signature for GetConfigOption..()
functions in PostgreSQL 9.6

9 years agoFix memorry leak reported by Coverity (CID 1350095)
Yugo Nagata [Fri, 12 Feb 2016 06:41:39 +0000 (15:41 +0900)]
Fix memorry leak reported by Coverity (CID 1350095)

9 years agoFix test/regression/clean.sh to remove binary files of 010.rewrite_timestamp test
Yugo Nagata [Wed, 10 Feb 2016 08:46:05 +0000 (17:46 +0900)]
Fix test/regression/clean.sh to remove binary files of 010.rewrite_timestamp test

9 years agoPrepare 3.3.8 V3_3_8
Yugo Nagata [Fri, 5 Feb 2016 07:00:09 +0000 (16:00 +0900)]
Prepare 3.3.8

9 years agoPrepare 3.3.8
Yugo Nagata [Fri, 5 Feb 2016 06:26:31 +0000 (15:26 +0900)]
Prepare 3.3.8

9 years agoAllow timeout value to be specified by the command option
Yugo Nagata [Tue, 2 Feb 2016 01:36:06 +0000 (10:36 +0900)]
Allow timeout value to be specified by the command option

9 years agoFix regression test to check timeout of each test
Yugo Nagata [Mon, 1 Feb 2016 08:58:12 +0000 (17:58 +0900)]
Fix regression test to check timeout of each test

9 years agoAdd some warning messages for wd_authkey hash calculation failure
Yugo Nagata [Mon, 1 Feb 2016 06:51:12 +0000 (15:51 +0900)]
Add some warning messages for wd_authkey hash calculation failure

Sometimes wd_authkey calculation fails for some reason other than
authkey mismatch. The additional messages make these distingushable
for each other.

9 years agoAdd test of white/black_memqcache_table_list to regress #006
Yugo Nagata [Thu, 21 Jan 2016 02:16:28 +0000 (11:16 +0900)]
Add test of white/black_memqcache_table_list to regress #006

9 years agoFix bug#156: problem with reloading.
Tatsuo Ishii [Sun, 17 Jan 2016 12:54:20 +0000 (21:54 +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.
/*
 * $Header$
 *
 * pgpool: a language independent connection pool server for PostgreSQL
 * written by Tatsuo Ishii
 *
 * Copyright (c) 2003-2016 PgPool Global Development Group
 *
 * Permission to use, copy, modify, and distribute this software and
 * its documentation for any purpose and without fee is hereby
 * granted, provided that the above copyright notice appear in all
 * copies and that both that copyright notice and this permission
 * notice appear in supporting documentation, and that the name of the
 * author not be used in advertising or publicity pertaining to
 * distribution of the software without specific, written prior
 * permission. The author makes no representations about the
 * suitability of this software for any purpose.  It is provided "as
 * is" without express or implied warranty.
 *
 *
 * libpcpcp_ext.h -
 *   This file contains definitions for structures and
 *   externs for functions used by frontend libpcp applications.
 */

/*
 * startup packet definitions (v2) stolen from PostgreSQL
 */

typedef enum {
CON_UNUSED, /* unused slot */
    CON_CONNECT_WAIT, /* waiting for connection starting */
CON_UP, /* up and running */
CON_DOWN /* down, disconnected */
} BACKEND_STATUS;

/*
 * PostgreSQL backend descriptor. Placed on shared memory area.
 */
typedef struct {
char backend_hostname[MAX_DB_HOST_NAMELEN]; /* backend host name */
int backend_port; /* backend port numbers */
BACKEND_STATUS backend_status; /* backend status */
double backend_weight; /* normalized backend load balance ratio */
double unnormalized_weight; /* descripted parameter */
char backend_data_directory[MAX_PATH_LENGTH];
unsigned short flag; /* various flags */
unsigned long long int standby_delay; /* The replication delay against the primary */
} BackendInfo;

typedef struct {
sig_atomic_t num_backends; /* Number of used PostgreSQL backends.
 * This needs to be a sig_atomic_t type
 * since it is replaced by a local
 * variable while reloading pgpool.conf.
 */

BackendInfo backend_info[MAX_NUM_BACKENDS];
} BackendDesc;
/*
 * Connection pool information. Placed on shared memory area.
 */
typedef struct {
int backend_id; /* backend id */
char database[SM_DATABASE]; /* Database name */
char user[SM_USER]; /* User name */
int major; /* protocol major version */
int minor; /* protocol minor version */
int pid; /* backend process id */
int key; /* cancel key */
int counter; /* used counter */
time_t  create_time; /* connection creation time */
int load_balancing_node; /* load balancing node */
char connected; /* True if frontend connected. Please note
 * that we use "char" instead of "bool".
 * Since 3.1, we need to export this
 * structure so that PostgreSQL C
 * functions can use. Problem is,
 * PostgreSQL defines bool itself, and if
 * we use bool, the size of the structure
 * might be out of control of
 * pgpool-II. So we use "char" here.
 */
} ConnectionInfo;

/*
 * process information
 * This object put on shared memory.
 */
typedef struct {
pid_t pid; /* OS's process id */
time_t start_time; /* fork() time */
ConnectionInfo *connection_info; /* head of the connection info for this process */
char need_to_restart; /* If non 0, exit this child process
 * as soon as current session ends.
 * Typical case this flag being set is
 * failback a node in streaming
 * replication mode.
 */
} ProcessInfo;

/*
 * reporting types
 */
/* some length definitions */

/* config report struct*/
typedef struct {
char name[POOLCONFIG_MAXNAMELEN+1];
char value[POOLCONFIG_MAXVALLEN+1];
char desc[POOLCONFIG_MAXDESCLEN+1];
} POOL_REPORT_CONFIG;

/* nodes report struct */
typedef struct {
char node_id[POOLCONFIG_MAXIDLEN+1];
char hostname[POOLCONFIG_MAXIDENTLEN+1];
char port[POOLCONFIG_MAXPORTLEN+1];
char status[POOLCONFIG_MAXSTATLEN+1];
char lb_weight[POOLCONFIG_MAXWEIGHTLEN+1];
char role[POOLCONFIG_MAXWEIGHTLEN+1];
char select[POOLCONFIG_MAXWEIGHTLEN+1];
} POOL_REPORT_NODES;

/* processes report struct */
typedef struct {
char pool_pid[POOLCONFIG_MAXCOUNTLEN+1];
char start_time[POOLCONFIG_MAXDATELEN+1];
char database[POOLCONFIG_MAXIDENTLEN+1];
char username[POOLCONFIG_MAXIDENTLEN+1];
char create_time[POOLCONFIG_MAXDATELEN+1];
char pool_counter[POOLCONFIG_MAXCOUNTLEN+1];
} POOL_REPORT_PROCESSES;

/* pools reporting struct */
typedef struct {
int pool_pid;
time_t start_time;
int pool_id;
int backend_id;
char database[POOLCONFIG_MAXIDENTLEN+1];
char username[POOLCONFIG_MAXIDENTLEN+1];
time_t create_time;
int pool_majorversion;
int pool_minorversion;
int pool_counter;
int pool_backendpid;
int pool_connected;
} POOL_REPORT_POOLS;

/* version struct */
typedef struct {
char version[POOLCONFIG_MAXVALLEN+1];
} POOL_REPORT_VERSION;

typedef enum {
PCP_CONNECTION_OK,
PCP_CONNECTION_CONNECTED,
PCP_CONNECTION_NOT_CONNECTED,
PCP_CONNECTION_BAD,
PCP_CONNECTION_AUTH_ERROR
}ConnStateType;

typedef enum {
PCP_RES_COMMAND_OK,
PCP_RES_BAD_RESPONSE,
PCP_RES_BACKEND_ERROR,
PCP_RES_INCOMPLETE,
PCP_RES_ERROR
}ResultStateType;

struct PCPConnInfo;

typedef struct {
int isint; /* 1 if data in slot is integer, 0 otherwise */
int datalen; /* Length of binary data*/
union
{
int* ptr;
int integer;
}data;
void (*free_func)(struct PCPConnInfo*,void*); /* custom free function deep free of data */
}PCPResultSlot;

typedef struct {
ResultStateType resultStatus;
int resultSlots; /* Total number of slots contained in this result */
int nextFillSlot; /* internal to keep track of last filled slot */
PCPResultSlot resultSlot[1]; /* variable length slots */
}PCPResultInfo;

typedef struct PCPConnInfo{
void *pcpConn;
char     *errMsg; /* error message, or NULL if no error */
ConnStateType connState;
PCPResultInfo   *pcpResInfo;
FILE *Pfdebug; /* File pointer to output debug infor */
}PCPConnInfo;

struct WdInfo;

extern PCPConnInfo* pcp_connect(char *hostname, int port, char *username, char *password, FILE *Pfdebug);
extern void pcp_disconnect(PCPConnInfo* pcpConn);

extern PCPResultInfo *pcp_terminate_pgpool(PCPConnInfo* pcpCon,char mode);
extern PCPResultInfo *pcp_node_count(PCPConnInfo* pcpCon);
extern PCPResultInfo *pcp_node_info(PCPConnInfo* pcpCon, int nid);

extern PCPResultInfo *pcp_process_count(PCPConnInfo* pcpConn);
extern PCPResultInfo *pcp_process_info(PCPConnInfo* pcpConn, int pid);

extern PCPResultInfo *pcp_detach_node(PCPConnInfo* pcpConn,int nid);
extern PCPResultInfo *pcp_detach_node_gracefully(PCPConnInfo* pcpConn,int nid);
extern PCPResultInfo *pcp_attach_node(PCPConnInfo* pcpConn, int nid);
extern PCPResultInfo *pcp_pool_status(PCPConnInfo *pcpConn);
extern PCPResultInfo *pcp_recovery_node(PCPConnInfo* pcpConn, int nid);
extern PCPResultInfo *pcp_promote_node(PCPConnInfo* pcpConn, int nid);
extern PCPResultInfo *pcp_promote_node_gracefully(PCPConnInfo* pcpConn,int nid);
extern PCPResultInfo *pcp_watchdog_info(PCPConnInfo* pcpConn, int nid);
extern PCPResultInfo *pcp_set_backend_parameter(PCPConnInfo* pcpConn,char* parameter_name, char* value);

extern ResultStateType PCPResultStatus(const PCPResultInfo *res);
extern ConnStateType PCPConnectionStatus(const PCPConnInfo *conn);
extern void* pcp_get_binary_data(const PCPResultInfo *res, unsigned int slotno);
extern int pcp_get_int_data(const PCPResultInfo *res, unsigned int slotno);
extern int pcp_get_data_length(const PCPResultInfo *res, unsigned int slotno);
extern void pcp_free_result(PCPConnInfo* pcpConn);
extern void pcp_free_connection(PCPConnInfo* pcpConn);
extern int pcp_result_slot_count(PCPResultInfo* res);
extern char *pcp_get_last_error(PCPConnInfo* pcpConn);

extern int pcp_result_is_empty(PCPResultInfo* res);
/* ------------------------------
 * pcp_error.c
 * ------------------------------
 */

9 years agoFix white/black_memqcache_table_list not require quotaion
Yugo Nagata [Thu, 14 Jan 2016 04:33:14 +0000 (13:33 +0900)]
Fix white/black_memqcache_table_list not require quotaion

The tables and schemas name specified in *_memqcache_table_list
were needed to be quoted by double quotation since commit
43ff7d3de9db4c8a1143258f4ffff98682dab560. This is fixed
by stripping quote from table name before pattern matching.

Patch contributed by Dang Minh Huong.
Per [pgpool-hackers: 1323]

9 years agoFix port numbers in expected result of show pool_nodes
Yugo Nagata [Wed, 6 Jan 2016 04:26:46 +0000 (13:26 +0900)]
Fix port numbers in expected result of show pool_nodes

9 years agoFix regression test 003.failover for rhel7 postgresql rpm
Yugo Nagata [Wed, 6 Jan 2016 04:13:01 +0000 (13:13 +0900)]
Fix regression test 003.failover for rhel7 postgresql rpm

The expected result of 'show pool_nodes' is fixed to use
PGSOCKET_DIR in hostname column.

9 years agoAdd missing \n in help messages
Yugo Nagata [Tue, 5 Jan 2016 08:42:02 +0000 (17:42 +0900)]
Add missing \n in help messages

9 years agoFix to use timeout command to handle time out of regress test 062
Yugo Nagata [Fri, 25 Dec 2015 05:46:46 +0000 (14:46 +0900)]
Fix to use timeout command to handle time out of regress test 062

9 years agodoc: Add restriction about starting multiple pgpool simultaneously
Yugo Nagata [Mon, 28 Dec 2015 02:18:08 +0000 (11:18 +0900)]
doc: Add restriction about starting multiple pgpool simultaneously

10 years agoFix bug with "SET TRANSACTION READ ONLY".
Tatsuo Ishii [Wed, 2 Dec 2015 10:37:14 +0000 (19:37 +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.

10 years agoFixing [pgpool-II 0000139]: broken arping_cmd
Muhammad Usama [Wed, 18 Nov 2015 13:58:49 +0000 (18:58 +0500)]
Fixing [pgpool-II 0000139]: broken arping_cmd

wd_chk_setuid() function was bailing out with the error message as soon as it
finds the setuid bit is not set on any configured network command and was
ignoring the rest of configurations.

10 years agoFix previous commit for regression test 055
Yugo Nagata [Wed, 11 Nov 2015 07:00:36 +0000 (16:00 +0900)]
Fix previous commit for regression test 055

10 years agoFix previous commit for regression test 055
Yugo Nagata [Wed, 11 Nov 2015 07:00:36 +0000 (16:00 +0900)]
Fix previous commit for regression test 055