pengbo [Tue, 30 Aug 2016 10:22:43 +0000 (19:22 +0900)]
Prepare 3.3.12
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.
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:32:26 +0000 (11:32 +0900)]
fix japanese doc typo
Muhammad Usama [Mon, 1 Aug 2016 14:22:41 +0000 (19:22 +0500)]
Fixing a typo in english doc
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 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).
pengbo [Mon, 20 Jun 2016 10:34:58 +0000 (19:34 +0900)]
change docs
pengbo [Mon, 20 Jun 2016 09:59:32 +0000 (18:59 +0900)]
change docs
pengbo [Fri, 17 Jun 2016 09:17:06 +0000 (18:17 +0900)]
Prepare 3.3.11
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.
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:15:17 +0000 (11:15 +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: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.
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].
pengbo [Tue, 26 Apr 2016 03:16:31 +0000 (12:16 +0900)]
Prepare 3.3.10
pengbo [Tue, 26 Apr 2016 01:42:37 +0000 (10:42 +0900)]
Prepare 3.3.10
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 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.
Yugo Nagata [Mon, 4 Apr 2016 10:51:43 +0000 (19:51 +0900)]
Prepare 3.3.9
Yugo Nagata [Mon, 4 Apr 2016 10:21:52 +0000 (19:21 +0900)]
Prepare 3.3.9
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:09:29 +0000 (14:09 +0900)]
Fix typo
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).
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.
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].
Tatsuo Ishii [Mon, 14 Mar 2016 23:12:17 +0000 (08:12 +0900)]
Fix typo in configure
Patch provided by Thomas Munro.
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 [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)
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
Yugo Nagata [Fri, 12 Feb 2016 06:41:39 +0000 (15:41 +0900)]
Fix memorry leak reported by Coverity (CID
1350095)
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
Yugo Nagata [Fri, 5 Feb 2016 07:00:09 +0000 (16:00 +0900)]
Prepare 3.3.8
Yugo Nagata [Fri, 5 Feb 2016 06:26:31 +0000 (15:26 +0900)]
Prepare 3.3.8
Yugo Nagata [Tue, 2 Feb 2016 01:36:06 +0000 (10:36 +0900)]
Allow timeout value to be specified by the command option
Yugo Nagata [Mon, 1 Feb 2016 08:58:12 +0000 (17:58 +0900)]
Fix regression test to check timeout of each test
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.
Yugo Nagata [Thu, 21 Jan 2016 02:16:28 +0000 (11:16 +0900)]
Add test of white/black_memqcache_table_list to regress #006
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
* ------------------------------
*/
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]
Yugo Nagata [Wed, 6 Jan 2016 04:26:46 +0000 (13:26 +0900)]
Fix port numbers in expected result of show pool_nodes
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.
Yugo Nagata [Tue, 5 Jan 2016 08:42:02 +0000 (17:42 +0900)]
Add missing \n in help messages
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
Yugo Nagata [Mon, 28 Dec 2015 02:18:08 +0000 (11:18 +0900)]
doc: Add restriction about starting multiple pgpool simultaneously
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.
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.
Yugo Nagata [Wed, 11 Nov 2015 07:00:36 +0000 (16:00 +0900)]
Fix 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
Yugo Nagata [Tue, 10 Nov 2015 12:32:14 +0000 (21:32 +0900)]
Fix regression test 055 for rhel7 rpm
Yugo Nagata [Mon, 9 Nov 2015 10:32:40 +0000 (19:32 +0900)]
Fix a bug of regress.sh option handling
Yugo Nagata [Mon, 9 Nov 2015 05:20:50 +0000 (14:20 +0900)]
Add missing descriptions about default values to documents
Yugo Nagata [Thu, 5 Nov 2015 17:29:28 +0000 (02:29 +0900)]
Fix the previous commit's echo missing redirect to conf file
Yugo Nagata [Wed, 4 Nov 2015 09:30:20 +0000 (18:30 +0900)]
Add option to regress.sh and pgpool_setup for unix domain socket directory
The new option of regress.sh is -s to specivy unix domain socket
directory. Default is /tmp. And environment variable PGSOCKET_DIR
is added for pgpool_setup
Yugo Nagata [Wed, 4 Nov 2015 07:28:23 +0000 (16:28 +0900)]
Fix pgpool_setup to use DEFAULT_PGSOCKET_DIR in pg_config_manual.h
Some Postgresql rpms define DEFAULT_PGSOCKET_DIR as /tmp, others as
/var/run/postgresql. This affects not only PostgreSQL server but
also libpq and psql.
This is a workaround for regression test. We might have to fix
pgpool-II code to control default value of backend_hostname*.
Yugo Nagata [Wed, 4 Nov 2015 04:56:27 +0000 (13:56 +0900)]
Force pgpool_setup to set unix_socket_directories to '/tmp'
This is a workaround for PostgreSQL RHEL7 RPM, which sets
it to '/var/run/postgresql'.
Tatsuo Ishii [Sat, 31 Oct 2015 00:35:30 +0000 (09:35 +0900)]
Unbreak "make dist".
While removing some directories under src/test, Makefile.am was left
unchaged and "make dist" has been broken since then.
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 [Thu, 29 Oct 2015 04:26:44 +0000 (13:26 +0900)]
Fix regression test 065.
The path to JDBC driver was explicitly defined. This is wrong. This
should be inherited from JDBC_DRIVER environment variable.
Tatsuo Ishii [Mon, 19 Oct 2015 04:20:05 +0000 (13:20 +0900)]
Fix in memory query cache bug reported in bug#152.
If extended query protocol is used and a bind/execute message arrives
which uses a statement created by prior parse message, the temp_cache
is not initialized by a parse messages. Thus messages are added to pre
existing temp cache buffer which causes the trouble (when the cached
result returns, Data Row message and Command Complete message appeared
*twice*).
Also new regression test is added to check the bug.
t-ishii@localhost:
Tatsuo Ishii [Fri, 16 Oct 2015 05:32:24 +0000 (14:32 +0900)]
Update copyright year.
Tatsuo Ishii [Wed, 14 Oct 2015 03:09:42 +0000 (12:09 +0900)]
Fix bugs with data modifying WITH clause reported in bug#153.
pgpool-II does not recognize the data modifying WITH clause despite
pgpool-II 3.3 or after has SQL parser which recognizes it. The bug has
been fixed in pgpool-II 3.5 (having PostgreSQL 9.5 parser).
Data modifying WITH clause was introduced in PostgreSQL 9.1. Since
pgpool-II 3.3 has 9.2 parser and pgpool-II 3.4 has 9.4 parser, the fix
is back ported to pgpool-II 3.3 and 3.4.
Yugo Nagata [Fri, 4 Sep 2015 05:10:39 +0000 (14:10 +0900)]
Fix wrong description in documents about log_standby_delay
Tatsuo Ishii [Thu, 3 Sep 2015 01:28:29 +0000 (10:28 +0900)]
Fix ancient bug of pool_push() and friends.
It allocates buffer using realloc and uses the pointer
returned. However it does the pointer calculation *before* realloc
gets called. So the calculation uses the old pointer value, which
causes various problems including segfault later. It is surprising
that this bug was not found earlier because the bug was there since
the function was added. This is probably due to the fact that actual
pointer moving does not happen until certain amount of memory.
Also there were other problems with it. The buffer pointer and buffer
size variable is not initialized. The buffer is not freed by
pool_close. Typo in debugging message (3.4 or later only). They are
fixed as well.
Tatsuo Ishii [Thu, 27 Aug 2015 04:07:35 +0000 (13:07 +0900)]
Fix regression test driver.
In pgpool-II 3.5, libpcp.a is not compatible with previous ones. This
results in segfault when pcp_recovery_node gets executed if the
command links to older version of the library. Solution is, set
${PGPOOL_INSTALL_DIR}/lib to LD_LIBRARY_PATH so that the command links
proper version of library.
Tatsuo Ishii [Mon, 24 Aug 2015 02:54:17 +0000 (11:54 +0900)]
Fix compiler warning.
Since memqcache_total_size is 64bit integer, the format string should
be %ld, rather than %d.
Yugo Nagata [Fri, 21 Aug 2015 06:38:09 +0000 (15:38 +0900)]
Remove rpm_installer directory
Codes of RPM building and installer are maintained by GitHub.
Yugo Nagata [Fri, 21 Aug 2015 06:34:03 +0000 (15:34 +0900)]
Move 006 memory leak test to test/regression from src/test/regression
It seem to be git-cherry-pick mistake.
Yugo Nagata [Fri, 21 Aug 2015 06:33:17 +0000 (15:33 +0900)]
Remove tests directory which are incorporated into regression test
Yugo Nagata [Thu, 20 Aug 2015 04:06:25 +0000 (13:06 +0900)]
Add timestamp-rewrite unit test to regression test suite
Yugo Nagata [Fri, 21 Aug 2015 04:35:35 +0000 (13:35 +0900)]
Fix typo in Document
Yugo Nagata [Wed, 19 Aug 2015 09:53:59 +0000 (18:53 +0900)]
Fix complication error and segfault of timestamp rewrite test
Yugo Nagata [Wed, 19 Aug 2015 08:07:15 +0000 (17:07 +0900)]
Fix inconsistency of sequence values in replication mode
Due to the following commit, table names were always quoted
in queries to check needs for insert lock, whether this is
view, wheter this has default value of timestamp etc. However,
when schema name was provided, table name was quoted wrongly as
like "public.tbl" instead of "public"."tbl". So, pool_regclass
and to_regclass couldn't find right talbe oid and insert lock
was never executed. This caused inconsistency between DB nodes.
In previous codes, quotation marks "" are once remove from
table name returnd by nodeToString, and re-quoted in issued
query. Instead, fixed codes don't remove and use directy in
pgpool_regclass or to_regclass. make_table_from_rangevar()
are also fixed to return table name including quotation marks.
However, when neither pgool_regclass or to_regclass is available,
quotation marks and schema name are removed from table name,
because pg_class.relname is used in this case.
In addition, fix to use to_regclass in insert lock functions
if available.
Yugo Nagata [Wed, 19 Aug 2015 07:49:24 +0000 (16:49 +0900)]
Fix regress test to sleep after pgpool_reload
Some regression tests test behaviors after pgpool-II configuration
is modified and reloaded. However, sometimes these modification
were not applied to pgpool just after reloading.
It was observed after the following commit.
commit
ba24a708ed61d6a5fa296451b194c4b448ed5966
Author: Tatsuo Ishii <ishii@postgresql.org>
Date: Thu Aug 6 13:02:42 2015 +0900
Issue fsync() when writing pgpool_status.
This ensures that pgpool_status is saved to permanent storage and
allow to survive after system crash.
It seem to be because fsync() takes a time before SIGHUP is sent
to child processes in reload_config().
Fix is to add sleep to wait for applying modification after
pgpool_reload.
In addition, some messages are added to test for debugging.
Yugo Nagata [Tue, 18 Aug 2015 10:31:03 +0000 (19:31 +0900)]
Fix broken regression test for native replication
Test for insert lock didn't work.
Yugo Nagata [Tue, 18 Aug 2015 10:25:30 +0000 (19:25 +0900)]
Fix false alert of regression tset 062
Sleep before timedout was too short.
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:19:44 +0000 (15:19 +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:33:41 +0000 (14:33 +0900)]
Prepare 3.3.7
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.
Tatsuo Ishii [Sat, 20 Jun 2015 10:03:22 +0000 (19:03 +0900)]
Allow to use in memory query cache size > 4GB
This should have been allowed since in memory query cache was born.
Tatsuo Ishii [Fri, 19 Jun 2015 17:14:41 +0000 (02:14 +0900)]
Add a test case for previous commit.
Tatsuo Ishii [Fri, 19 Jun 2015 16:39:44 +0000 (01:39 +0900)]
Fix the case when user table includes spaces.
For example if table names including space are used (of course using
delimited identifier), pgpool-II cannot be handled correctly by the
internal functions which access system catalogs and it results in SQL
errors. Solution is, to always use delimited identifier. Per bug#136.
Also see [pgpool-general: 3818].
Tatsuo Ishii [Fri, 29 May 2015 00:27:41 +0000 (09:27 +0900)]
Fix "select() system call interrupted" error.
The health check process complains above then
ERROR: failed to make persistent db connection
DETAIL: connection to host:"x.x.x.x:5432 failed
But the healthchek does not trigger fail over nor retrying (if the
retry parameter is configured). So except the annoying message above
everything goes well.
I guess this is caused by SIGCHLD interrupt while select(2) waiting
for completion of connect(2) call. It is likely that pgpool child dies
because of child_life_time. The directive is triggered if child is
idle for specified period. Since this happens independently among each
child process, if num_init_children is big (in the reported case, it
is 2000). So the case could occur more easily if 1) num_init_children
is big and 2) pgpool children go into idle state (no query arrived
from client for child_life_time seconds).
We suppose a system call interruption could occur by SIGALRM which is
set by pgpool to detect time of the connect(2) call if
health_check_timeout is non 0. However we did not think about the case
above.
The fix is, if select(2) is interrupted by a system call, check
health_check_timeout variable and it is not set, we can assume that
the interruption is caused by other than SIGALRM and retries the
select(2).
Original bug report is [pgpool-general: 3756] Connection Interrupted.
Patch created by me. Enhancement from Usama.
Also I got similar report (but on 3.3) from another user. So I will
make similar commit to 3.3 stable tree as well.
Tatsuo Ishii [Wed, 13 May 2015 01:29:14 +0000 (10:29 +0900)]
Fix outdated limitation description about load balancing using JDBC driver.
Even if autocommit is false, load balancing is possible in certain conditions.
Tatsuo Ishii [Mon, 11 May 2015 06:48:26 +0000 (15:48 +0900)]
Clarify description of pcp_promote_node.
It does not actually promote PostgreSQL standby.
Tatsuo Ishii [Mon, 11 May 2015 06:33:15 +0000 (15:33 +0900)]
Clarify load balancing condition.
Muhammad Usama [Wed, 29 Apr 2015 14:13:58 +0000 (19:13 +0500)]
Passing empty string parameters in failover command when pgpool-II does not have a value for any particular parameter
Instead of omitting the values for the parameters when pgpool-II does not have
any value for a particular parameter, It now passes an empty string instead to
the failover command, This makes sure that failover script will always receive
the exact number of expected parameters.
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:27:46 +0000 (16:27 +0900)]
Prepare 3.3.6