Tatsuo Ishii [Thu, 12 Sep 2019 04:39:41 +0000 (13:39 +0900)]
Fix memory leak per Coverity.
Tatsuo Ishii [Fri, 6 Sep 2019 06:24:09 +0000 (15:24 +0900)]
Fix uninitialized variable.
Probably harmless but bug is bug...
Per Coverity.
Tatsuo Ishii [Sun, 1 Sep 2019 02:38:35 +0000 (11:38 +0900)]
Fix pgpool_setup to reflect the -p (baseport) to ORIGBASEPORT variable.
Otherwise, shutdown generated script by pgpool_setup does not use
proper port number for netstat command.
Bo Peng [Thu, 15 Aug 2019 04:42:05 +0000 (13:42 +0900)]
Prepare 3.4.25.
Tatsuo Ishii [Wed, 14 Aug 2019 00:14:36 +0000 (09:14 +0900)]
Fix memory leak.
Pointed out by Coverity.
Tatsuo Ishii [Thu, 8 Aug 2019 02:38:02 +0000 (11:38 +0900)]
Make waiting for TIME_WAIT in pgpool_setup optional.
Since commit
3b32bc4e583da700cc8df7c5777e90341655ad3b the shutdownall
script generated by pgpool_setup waits for Pgpool-II socket in
TIME_WAIT state disappeared. However in most cases this takes long
time and it makes uncomfortable for developer's testing works.
This commit makes the wait to be optional: unless environment variable
"CHECK_TIME_WAIT" is set to other than "false", it never waits for the
TIME_WAIT state.
Tatsuo Ishii [Thu, 8 Aug 2019 02:02:50 +0000 (11:02 +0900)]
Import some of memory manager debug facilities from PostgreSQL.
Now we can use CLOBBER_FREED_MEMORY, which is useful to detect
accesses to already pfreed memory.
Tatsuo Ishii [Sun, 28 Jul 2019 02:11:07 +0000 (11:11 +0900)]
Fix pgpool_setup to produce correct follow master command.
The produced script incorrectly checked whether PostgreSQL is running
or not, which resulted in that it mistakenly thought PostgreSQL is
always running.
Bo Peng [Thu, 25 Jul 2019 00:19:53 +0000 (09:19 +0900)]
Fix regression test errors.
Bo Peng [Wed, 24 Jul 2019 12:19:26 +0000 (21:19 +0900)]
Use pg_get_expr() instead of pg_attrdef.adsrc to support for PostgreSQL 12.
Since PostgreSQL 12 removed pg_attrdef.adsrc, use pg_get_expr() instead of pg_attrdef.adsrc if the backend version is 7.3 or later.
Thanks to Takuma Hoshiai for creating the patch.
Tatsuo Ishii [Wed, 17 Jul 2019 07:51:31 +0000 (16:51 +0900)]
Fix the failover() so that it does not access out of array.
Per Coverity.
Tatsuo Ishii [Wed, 17 Jul 2019 07:48:37 +0000 (16:48 +0900)]
Enhance shutdown script of pgpool_setup.
I observe occasional regression test failure caused by bind error to
the TCP/IP port. This fix tries to confirm usage of the TCP/IP port
while executing shutdown script using netstat command.
Tatsuo Ishii [Tue, 16 Jul 2019 06:21:10 +0000 (15:21 +0900)]
Backport Pgversion().
Tatsuo Ishii [Sun, 7 Jul 2019 13:58:35 +0000 (22:58 +0900)]
Fix possible out of array index access.
It was pointed out by Coverity that node_id could be -1.
Tatsuo Ishii [Sun, 7 Jul 2019 01:09:25 +0000 (10:09 +0900)]
Fix query cache module so that it checks oid array's bound.
Tatsuo Ishii [Sat, 6 Jul 2019 23:08:25 +0000 (08:08 +0900)]
Fix off-by-one error in query cache module.
When debug print is enabled, it might had tried to access out of bound
of oid array.
Tatsuo Ishii [Tue, 2 Jul 2019 09:40:11 +0000 (18:40 +0900)]
Make shutdownall to wait for completion of shutdown of Pgpool-II.
It was observed that regression test occasionally failed because
previous does not completely finished before next test started. To fix
the problem, make shutdownall script generated by pgpool_setup to wait
for completion of shutdown of Pgpool-II.
Tatsuo Ishii [Mon, 24 Jun 2019 13:13:18 +0000 (22:13 +0900)]
Fix mistake introduced in the previous commit.
Tatsuo Ishii [Mon, 24 Jun 2019 01:57:34 +0000 (10:57 +0900)]
Fix segfault when "samenet" is specified in pool_hba.conf.
When "samenet" is specified, SockAddr_cidr_mask(struct
sockaddr_storage *mask, char *numbits, int family) gets called with
numbits == NULL. However the function was not prepared for
it. Originally the function was imported from PostgreSQL. When the bug
was fixed in PostgreSQL, unfortunately the fix was not applied to
Pgpool-II. This commit applies the same fix as PostgreSQL.
Discussion: [pgpool-general: 6601] Pgpool-II + hba + samenet = segfault in libc-2.24.so
Bo Peng [Fri, 7 Jun 2019 08:19:37 +0000 (17:19 +0900)]
Fix to deal with backslashes according to the config of standard_conforming_strings
in native replication mode.
per bug467.
Tatsuo Ishii [Wed, 22 May 2019 08:01:47 +0000 (17:01 +0900)]
Fix memory leak in outfuncs.c pointed out by Coverity.
Tatsuo Ishii [Wed, 22 May 2019 07:20:51 +0000 (16:20 +0900)]
Fix NULL pointer dereference pointed out by Coverity.
Tatsuo Ishii [Wed, 22 May 2019 07:40:53 +0000 (16:40 +0900)]
Revert "Fix memory leak pointed out by coverity."
This reverts commit
9ce592cd05b8ea53fef581d2f0373efa39fe8722.
Tatsuo Ishii [Wed, 22 May 2019 06:15:37 +0000 (15:15 +0900)]
Fix memory leak pointed out by coverity.
Tatsuo Ishii [Tue, 21 May 2019 22:39:37 +0000 (07:39 +0900)]
Deal pgpool_adm extension with PostgreSQL 12.
Now that oid is gone, the signature of CreateTemplateTupleDesc() has
been changed.
Bo Peng [Wed, 15 May 2019 07:01:13 +0000 (16:01 +0900)]
Prepare 3.4.24.
Bo Peng [Thu, 9 May 2019 08:22:29 +0000 (17:22 +0900)]
Fix the wrong error message "ERROR: connection cache is full", when all backend nodes are down.
When all backend nodes are down, Pgpool-II throws an uncorrect
error message "ERROR: connection cache is full". Change the error
message to "all backend nodes are down, pgpool requires at least one valid node".
per bug487.
https://www.pgpool.net/mantisbt/view.php?id=487
Tatsuo Ishii [Fri, 3 May 2019 00:02:29 +0000 (09:02 +0900)]
Speed up failover when all of backends are down.
Pgpool-II tries to find primary node till search_primary_node_timeout
expires even if all of the backend are in down status. This is not
only a waste of time but makes Pgpool-II looked like hanged because
while searching primary node failover process is suspended and all of
the Pgpool-II child process are in defunct state, thus there's no
process which accepts connection requests from clients. Since the
default value of searching primary is 300 seconds, typically this
keeps on for 300 seconds. This is not comfortable for users.
So immediately give up finding primary node regardless
search_primary_node_timeout and promptly finish the failover process
if all of the backend are in down status.
Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2019-May/003321.html
Tatsuo Ishii [Mon, 29 Apr 2019 23:46:06 +0000 (08:46 +0900)]
Deal with PostgreSQL 12.
HeapTupleGetOid() is not available any more in PostgreSQL 12. Use
GETSTRUCT() and refer to oid column of Form_pg_proc.
Tatsuo Ishii [Mon, 29 Apr 2019 23:49:48 +0000 (08:49 +0900)]
Deal with PostgreSQL 12.
recovery.conf cannot be used anymore. Standby's recovery configuration
is now in postgresql.conf. Also "standby.signal" file is needed in
PostgreSQL database cluster directory to start postmaster as a standby
server.
Tatsuo Ishii [Sun, 21 Apr 2019 06:57:22 +0000 (15:57 +0900)]
Avoid exit/fork storm of pool_worker_child process.
pool_worker_child issues query to get WAL position using do_query(),
which could throws FATAL error. In this case pool_worker_child process
exits and Pgpool-II parent immediately forks new process. This cycle
indefinitely repeats and gives high load to the system.
This could easily happen. For example if ALWAYS_MASTER flag is
mistakenly set to standby node, it will cause an error:
ERROR: recovery is in progress
HINT: WAL control functions cannot be executed during recovery.
STATEMENT: SELECT pg_current_wal_lsn()
To avoid the exit/fork storm, sleep sr_check_period.
Tatsuo Ishii [Wed, 17 Apr 2019 22:52:56 +0000 (07:52 +0900)]
Fix black_function_list's broken default value.
I accidentally broke the entry of pgpool.conf.sample when
database_redirect_preference_list and
app_name_redirect_preference_list were introduced.
Also fix mistake of the entry of pgpool.conf.sample-replication as
well.
Issue reported by Sebastiaan Alexander Mannem.
Tatsuo Ishii [Wed, 17 Apr 2019 13:11:00 +0000 (22:11 +0900)]
Fix "not enough space in buffer" error.
The error occurred while processing error message returned from
backend and the cause is that the query string in question is too
big. Problem is, the buffer is in fixed size (8192 bytes). From the
programming point of view there's absolutely no need to use fixed size
buffer. So eliminate the fixed size buffer and use palloced buffer
instead. This also saves some memory copy work.
Per bug 499.
Tatsuo Ishii [Tue, 16 Apr 2019 06:48:44 +0000 (15:48 +0900)]
Fix DROP DATABASE failure.
When DROP DATABASE gets executed, SIGUSR1 is sent to the Pgpool-II
child process being issuing the command. In its SIGUSR1 handler,
MASTER macro is called while closing all idle connections. The MACRO
checks whether we are in failover process surely we are. As a result,
the process exits and DROP DATABASE command never been issued.
Per bug 486. However the reason of segfault in the report is not
clear. After commit:
https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commit;h=
66b5aacfcc045ec1485921a5884b637fcfb6fd73
Things could be different. Let the user test the latest version in the
git repo and see if the problem is solved...
Takuma Hoshiai [Wed, 10 Apr 2019 02:53:46 +0000 (11:53 +0900)]
Fix to compare wrong variable, when old pgpool_status file read.
Pgpool-II 3.4 or later, pgpool_status format changed, and format both old and new is supported.
Pgpool might read status in file incorrectly, when old format is reading by Pgpool.
This is rare case, and noproblem if it is happend.
Bo Peng [Tue, 2 Apr 2019 00:33:49 +0000 (09:33 +0900)]
Update Makefile.
Bo Peng [Tue, 2 Apr 2019 00:21:44 +0000 (09:21 +0900)]
Generate Makefile.in by automake 1.13.4.
Tatsuo Ishii [Sat, 30 Mar 2019 12:56:03 +0000 (21:56 +0900)]
Suppress useless truncation warnings from gcc 8+.
For this purpose update c-compiler.m4 (borrowed from PostgreSQL's
config/c-compiler.m4) and add PGAC_PROG_CC_VAR_OPT(NOT_THE_CFLAGS,
[-Wformat-truncation]) to configure.ac to generate -Wformat-truncation
compiler option.
Tatsuo Ishii [Sat, 30 Mar 2019 13:34:45 +0000 (22:34 +0900)]
Suppress "ar: `u' modifier ignored since `D' is the default (see `U')".
This is actually a bug with libtools. To deal with this, add ARFLAGS
to parser's Makefile.am.
Tatsuo Ishii [Sat, 30 Mar 2019 01:33:58 +0000 (10:33 +0900)]
Fix wrong usage of volatile declaration.
From a PostgreSQL commit message:
Variables used after a longjmp() need to be declared volatile. In
case of a pointer, it's the pointer itself that needs to be declared
volatile, not the pointed-to value.
Same thing can be said to:
volatile StartupPacket *sp;
This should have been:
StartupPacket *volatile sp;
This also suppresses a compiler warning.
Bo Peng [Thu, 28 Mar 2019 09:35:04 +0000 (18:35 +0900)]
Prepare 3.4.23.
Muhammad Usama [Wed, 27 Mar 2019 07:51:20 +0000 (12:51 +0500)]
Add new configuration option ssl_prefer_server_ciphers
Add the new setting "ssl_prefer_server_ciphers" to let users configure if they
want client's or server's cipher order to take preference.
Tatsuo Ishii [Sat, 23 Mar 2019 04:04:21 +0000 (13:04 +0900)]
Allow to set a client cipher list.
For this purpose new parameter "ssl_ciphers" is added. This is already
implemented in PostgreSQL and useful to enhance security when SSL is
enabled.
Tatsuo Ishii [Mon, 18 Mar 2019 00:45:51 +0000 (09:45 +0900)]
Fix unnecessary fsync to pgpool_status file.
Whenever new connections are created to PostgreSQL backend, fsync()
was issued to pgpool_status file, which could generate excessive I/O
in certain conditions, for example num_init_children is large and
connections to backend have certain life time limit.
So reduce the chance of issuing fsync() so that it is issued only when
backend status is changed from CON_CONNECT_WAIT or others to CON_UP.
If the status is already CON_UP, we don't need to write to
pgpool_status.
Discussion: [pgpool-general: 6436] High I/O Usage on PGPool nodes
Bo Peng [Thu, 14 Mar 2019 05:21:59 +0000 (14:21 +0900)]
Add "tags" to gitignore file.
Bo Peng [Thu, 7 Mar 2019 02:26:17 +0000 (11:26 +0900)]
Fix some mistakes from previous commit.
Bo Peng [Thu, 7 Mar 2019 01:27:31 +0000 (10:27 +0900)]
Fix indent of pgpool.conf sample files.
Tatsuo Ishii [Wed, 27 Feb 2019 00:38:15 +0000 (09:38 +0900)]
Fix write_status_file()'s signature.
It was mistakenly declared as write_status_file(). Of course this
should be: write_status_file(void).
Bo Peng [Thu, 21 Feb 2019 01:09:04 +0000 (10:09 +0900)]
Prepare 3.4.22.
Tatsuo Ishii [Fri, 15 Feb 2019 05:26:55 +0000 (14:26 +0900)]
Fix configuration change timing regarding memory_cache_enabled.
This parameter must not be changed after Pgpool-II start but it was
possible to change by reloading.
Tatsuo Ishii [Tue, 12 Feb 2019 07:59:35 +0000 (16:59 +0900)]
Fix unwanted recovery timeout in certain cases.
In the second stage of online recovery in replication mode, it is
possible it fails with timeout (message: "wait_connection_closed:
existing connections did not close in %d sec.") if connection counter
is malformed by a child process aborts with SIGKILL, SEGFAULT or etc.
This could be detected by checking if client_idle_limit_in_recovery is
enabled and it has less value than recovery_timeout because all
clients must be kicked out by the time when
client_idle_limit_in_recovery is expired. If so, we should reset
conn_counter to 0 also.
Per bug 431.
Tatsuo Ishii [Tue, 29 Jan 2019 08:20:41 +0000 (17:20 +0900)]
Fix corner case bug with strip_quote().
strip_quote(), which is called by pattern_compare() did not properly
handle empty query string case. In the worst case it could wipe out
memory after a pointer returned from malloc(), which could cause a
segmentation fault in free() called in pattern_compare().
Per bug 458.
Tatsuo Ishii [Thu, 10 Jan 2019 03:20:07 +0000 (12:20 +0900)]
Fix Pgpool child segfault in a race condition.
1) frontend tries to connect to Pgpool-II
2) there's no existing connection cache
3) try to create new backend connections by calling connect_backend()
4) inside connect_backend(), pool_create_cp() gets called
5) pool_create_cp() calls new_connection()
6) failover occurs and the global backend status is set to down, but
the pgpool main does not send kill signal to the child process yet
7) inside new_connection() after checking VALID_BACKEND, it checks the
global backend status and finds it is set to down status, so that
it returns without creating new connection slot
8) connect_backend() continues and accesses the down connection slot
because local status says it's alive, which results in a segfault.
Since there's already checking for the global status in
new_connection(), a fix could be syncing the local status with the
global status there.
See [pgpool-hackers: 3214] for discussion.
Tatsuo Ishii [Thu, 6 Dec 2018 08:20:32 +0000 (17:20 +0900)]
Deal with "terminating connection due to idle-in-transaction timeout" error.
If idle_in_transaction_session_timeout parameter is set to reasonably
short in postgresql.conf, the fatal error easily occurs and the
connection from Pgpool-II to backend is terminated. This leads to
Pgpool-II either hang (if only one of PostgreSQL equips equips the
parameter) or unwanted failover (if all PostgreSQL equips with the
parameter), and both are not good. So intercept the message and send
the same message to frontend then exit to terminate the connection to
frontend. This is similar treatment as the error "connection was
terminated due to conflict with recovery, User was holding a relation
lock for too long."
Per bug 448.
Bo Peng [Wed, 21 Nov 2018 08:48:36 +0000 (17:48 +0900)]
Prepare 3.4.21.
Takuma Hoshiai [Wed, 21 Nov 2018 07:48:35 +0000 (16:48 +0900)]
Change sort algorism buble sort to quick sort.
This is used to sort startup packet's parameters.
Takuma Hoshiai [Wed, 21 Nov 2018 02:35:58 +0000 (11:35 +0900)]
Fix to sort startup packet's parameters sent by client.
If order of startup packet's parameters differ between cached connection pools and connection request, did't use connection pool ,and created new connection pool.
Per bug 444.
Tatsuo Ishii [Thu, 15 Nov 2018 00:21:30 +0000 (09:21 +0900)]
Fix memory leak found by Coverity,
This is actually harmless since in the situation pgpool child process
exits and the leaked memory is gone anyway. I just want to shut off
Coverity's complain.
Bo Peng [Tue, 13 Nov 2018 01:54:05 +0000 (10:54 +0900)]
Fix segmentation fault occurs when a certain Bind message is sent in native replication mode.
If the number of parameter format codes is specified to one, but the number of the original query's
parameter is zero, bind_rewrite_timestamp() will call memcpy with a negative value for size_t.
This causes segmentation fault.
Patch is provided by Yugo Nagata.
Per bug 443.
Tatsuo Ishii [Thu, 8 Nov 2018 05:37:18 +0000 (14:37 +0900)]
Fix a query passed to relcache so that it uses schema qualified table name.
This should have been done for all similar queries to follow PostgreSQL's schema usage pattern.
However there was one missed at that time.
Tatsuo Ishii [Mon, 5 Nov 2018 12:43:01 +0000 (21:43 +0900)]
Fix query cache invalidation bug.
When a DML is executed in an explicit transaction, the table oid
buffer is wiped out by pool_reset_memqcache_buffer() and query cache
is not invalidated at the commit time because there's no DML oid
exists to invalidate query cache any more. To fix this, add new bool
parameter to pool_reset_memqcache_buffer() to specify whether to reset
table oid buffer or not. When a DML is executed in an explicit
transaction, call pool_reset_memqcache_buffer(false) to preserve the
table oid buffer.
Issue reported at https://github.com/pgpool/pgpool2/issues/19.
Tatsuo Ishii [Thu, 1 Nov 2018 00:22:46 +0000 (09:22 +0900)]
Fix memory leak in extended query + query cache enabled.
If a bind message is sent again to an existing prepared statement, it
is possible that the previously allocated bind parameter string
remains and newly allocated bind parameter string's pointer is set to
there, which leads to a memory leak.
Note that if a statement is parsed again in usual way, the parameter
string will be freed along with the old query context. So the leak
does not happen.
I suspect the use case for the memory leak (bind, execute is repeated
against a same prepared statement) is actually rare in the
field. Probably that's why the problem has not been reported until
today although the leak had existed since day 0.
The leak case can be easily reproduced by "pgbench -M prepared" by the
way.
Bo Peng [Wed, 31 Oct 2018 04:40:41 +0000 (13:40 +0900)]
Change pgpool.spec.
Bo Peng [Wed, 31 Oct 2018 03:39:34 +0000 (12:39 +0900)]
Change spec file to include pgpool_recovery--1.0.sql and pgpool_recovery--1.0--1.1.sql.
Bo Peng [Wed, 31 Oct 2018 03:11:40 +0000 (12:11 +0900)]
Add pgpool_recovery--1.0.sql and pgpool_recovery--1.0--1.1.sql to tar ball.
Bo Peng [Wed, 31 Oct 2018 02:17:00 +0000 (11:17 +0900)]
Prepare 3.4.20.
Tatsuo Ishii [Thu, 25 Oct 2018 10:58:34 +0000 (19:58 +0900)]
Fix typo in child_max_connections description.
Patch provided by Phil Ramirez.
Takuma Hoshiai [Mon, 22 Oct 2018 08:18:35 +0000 (17:18 +0900)]
Fix segmentation fault, when client send sync message in native replication mode.
When the query to be executed does not exist, if client sent 'Sync' messages to Pgpool-II which in native replication mode, occurred segmentation fault.
See:
https://www.pgpool.net/mantisbt/view.php?id=434
for more details.
Bo Peng [Thu, 18 Oct 2018 09:12:24 +0000 (18:12 +0900)]
Fix syntax error in native replication, when queries including now() etc. and "IN (SELECT ...)" in WHERE clause.
In native replication, queries including now() etc. are rewritten to a timestamp constant value.
However, Pgpool-II didn't support queries including now() etc. and "IN (SELECT ...)" in WHERE clause.
Per bug433.
Bo Peng [Thu, 18 Oct 2018 08:51:13 +0000 (17:51 +0900)]
Change pgpool.spec file to install extension to server which supports LLVM JIT.
Tatsuo Ishii [Tue, 9 Oct 2018 04:49:49 +0000 (13:49 +0900)]
Fix memory leak in trigger_failover_command.
Pointed out by Coverity.
Bo Peng [Tue, 9 Oct 2018 00:22:31 +0000 (09:22 +0900)]
Fix memory leak when memory_cache_enabled = on and write SQLs are sent.
In a explicit transaction, we the SELECT results are cached in temporary buffer.
If a write SQL is sent which modifies the table, the temporary buffe should be reset.
Tatsuo Ishii [Mon, 8 Oct 2018 22:50:03 +0000 (07:50 +0900)]
Fix occasional failure in regression 065.bug152.
In the test first create a table with some data, then query
it. However sometimes it seems replication delay causes the table
still not ready in standby. Since there's no reason we need to a
standby or slave for this particular test, let the test have only
primary/master.
Bo Peng [Wed, 19 Sep 2018 00:25:31 +0000 (09:25 +0900)]
Add missing pgpool_recovery--1.0--1.1.sql file to update pgpool_recovery() function version to 1.1.
Tatsuo Ishii [Wed, 29 Aug 2018 02:58:36 +0000 (11:58 +0900)]
Add regression test for SSL connection.
This tests SSL connection between frontend <--> Pgpool-II and
Pgpool-II <--> backend.
Tatsuo Ishii [Mon, 27 Aug 2018 06:16:17 +0000 (15:16 +0900)]
Do not update pgpool_passwd if the password length is incorrect.
For Pgpool-II 3.7 or before, the password stored in pool_passwd is MD5
password only. So check the correctness of pool_passwd by scanning
entire file.
Patch created by Takuma Hoshiai. Minor error message tweak by me.
See bug425 for more details.
Bo Peng [Sat, 11 Aug 2018 00:25:34 +0000 (09:25 +0900)]
Remove some .gitignore files which doesn't belong this branch.
Bo Peng [Fri, 10 Aug 2018 04:16:02 +0000 (13:16 +0900)]
Add definition of PGLIB in regress.sh.
Patch provided by Jesper Pedersen.
Bo Peng [Fri, 10 Aug 2018 03:40:10 +0000 (12:40 +0900)]
Update clean.sh which clean up regression test results.
Patch provided by Jesper Pedersen.
Bo Peng [Fri, 10 Aug 2018 03:34:32 +0000 (12:34 +0900)]
Add .gitignore files.
Patch provided by Jesper Pedersen.
Tatsuo Ishii [Sun, 5 Aug 2018 01:54:18 +0000 (10:54 +0900)]
Fix segfault when node 0 is in down status.
MASTER_CONNECTION refers to the connection to "master"
node. "Master" means the first live backend appearing in
pgpool.conf. The master node is determined at the time of fail over.
Unfortunately with both health check and fail_over_on_backend_error
are disabled, there's no chance of failover, which means the master
node id is remained the default value 0. So the MASTER_CONNECTION
refers to the node 0, and the connection is NULL.
Fix is as follows.
If attempt to connection to backend fails, check the master node id in
the shared memory. If the master node id is the failed node, then
look for new master node using get_next_master_node (this was a static
function, but now it's made to public) and set the node id to the
master node id in the shared memory area.
Problem reported by Muhammad Usama in [pgpool-hackers: 2905].
Bo Peng [Tue, 31 Jul 2018 00:14:36 +0000 (09:14 +0900)]
Prepare 3.4.19.
Tatsuo Ishii [Wed, 11 Jul 2018 01:16:07 +0000 (10:16 +0900)]
Try to reduce the chance of regression 006.memcache failure.
It seems the occasional failure of the test is caused by replication
lag. The script tries to read tables from standby but it returns a
table not existing error. So insert pg_sleep() after creation of
tables.
Tatsuo Ishii [Wed, 4 Jul 2018 06:25:35 +0000 (15:25 +0900)]
Fix "write on backend 0 failed with error :"Success"" error.
While writing to a socket, sometimes write() returns 0. Before we
treated this as an error, but it seems this could happen in the field
and is better to be treated as normal. So if write() returns 0, then
retry write() instead of raise an error.
Per bug #403.
Tatsuo Ishii [Fri, 22 Jun 2018 05:37:25 +0000 (14:37 +0900)]
Add nap time after failover.
This should make the test failure less frequent.
Tatsuo Ishii [Wed, 20 Jun 2018 04:57:40 +0000 (13:57 +0900)]
Fix comments and coding style.
Tatsuo Ishii [Wed, 20 Jun 2018 02:49:45 +0000 (11:49 +0900)]
Fix 006.memqcache test.
It forgot to execute shutdownall if some of tests failed. This lead to
hang up of subsequent tests.
Tatsuo Ishii [Wed, 20 Jun 2018 01:25:23 +0000 (10:25 +0900)]
Fix memory leaks related to pool_extract_error_message().
After 3.4, the function starts to return palloc'ed memory, and the
caller should had been modified so that they pfree the memory returned
by it but actually they had not.
Tatsuo Ishii [Tue, 19 Jun 2018 02:31:29 +0000 (11:31 +0900)]
Fix oversight in pool_extract_error_message().
A variable used for storing the return value was mistakenly declared
as bool, rather than int. This led to a segfault issue mentioned in
75b27e7 on certain platform.
Tatsuo Ishii [Tue, 19 Jun 2018 01:10:33 +0000 (10:10 +0900)]
Fix segfault in per_node_error_log() on armhf architecture.
pool_extract_error_message() incorrectly returns 255 (in decimal) on
the architecture when previous message was not an error or a notice
message. In this case per_node_error_log() happily calls ereport since
the return value from pool_extract_error_message() is greater than
0. Unfortunately the message string returned by
pool_extract_error_message() points to garbage memory in this case, a
segfault occurs.
The fix gives per_node_error_log() a guard against the bug of
pool_extract_error_message(). Moreover, the change is more consistent
with other places where pool_extract_error_message() is called.
Fix for pool_extract_error_message() will come later on.
See:
https://github.com/pgpool/pgpool2/issues/14
for more detailed discussion.
Problem reported and patch by Christian Ehrhardt.
Tatsuo Ishii [Tue, 12 Jun 2018 06:53:39 +0000 (15:53 +0900)]
Revert "Fix 055.backend_all_down test failure."
This reverts commit
ca492a65bbf57c2dc78826690ea259ddc9d6e78b.
Tatsuo Ishii [Tue, 12 Jun 2018 06:21:52 +0000 (15:21 +0900)]
Fix 055.backend_all_down test failure.
The test fails because pgpool zombie child process remains. Actually
the failover process is properly performed but when the shutdown
script is executed in background, output to stdout/stderr was blocked,
and this could cause the zombie process syndrome. Soltution is,
redirecting stdout/stderr to /dev/null when sponing the shutdown
script in background.
Bo Peng [Mon, 11 Jun 2018 14:10:22 +0000 (23:10 +0900)]
Prepare 3.4.18.
Bo Peng [Wed, 25 Apr 2018 14:31:12 +0000 (23:31 +0900)]
Fix compile error.
Tatsuo Ishii [Wed, 18 Apr 2018 01:03:37 +0000 (10:03 +0900)]
Prevent pcp_recovery_node from recovering "unused" status node.
This allowed to try to recover a node without configuration data,
which leads to variety of problems. See discussion:
https://www.pgpool.net/pipermail/pgpool-general/2018-March/006021.html
for more details.
Also I fixed pgpool_recovery function so that it quotes an empty
string argument with double quotes. Without this, the argument is
treated as if it does not exist, which was the source of the complain
from the user.
Bo Peng [Tue, 17 Apr 2018 08:51:17 +0000 (17:51 +0900)]
Prepare 3.4.17.
Tatsuo Ishii [Mon, 9 Apr 2018 05:45:37 +0000 (14:45 +0900)]
Add new regression test for node 0 is down.
test case 1: node 0 is already down before pgpool starts.
test case 2: node 0 goes down after pgpool starts.
test case 3: node 0 goes down and DISALLOW_TO_FAILOVER flag is set after pgpool starts.
Tatsuo Ishii [Sun, 8 Apr 2018 10:18:36 +0000 (19:18 +0900)]
Make calls to to_regclass fully schema qualified.
This is always recommended way.
Bo Peng [Fri, 23 Mar 2018 09:21:34 +0000 (18:21 +0900)]
Change test script to allow test failure.
Bo Peng [Tue, 20 Mar 2018 08:42:46 +0000 (17:42 +0900)]
Add wait_for_failover_done function for test.