diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/pcp_con/recovery.c | 2 | ||||
-rw-r--r-- | src/protocol/child.c | 5 | ||||
-rw-r--r-- | src/protocol/pool_process_query.c | 3 | ||||
-rw-r--r-- | src/protocol/pool_proto_modules.c | 8 | ||||
-rw-r--r-- | src/watchdog/watchdog.c | 10 | ||||
-rw-r--r-- | src/watchdog/wd_lifecheck.c | 11 |
6 files changed, 30 insertions, 9 deletions
diff --git a/src/pcp_con/recovery.c b/src/pcp_con/recovery.c index 8ad4a2fd5..84e4ddc17 100644 --- a/src/pcp_con/recovery.c +++ b/src/pcp_con/recovery.c @@ -482,7 +482,7 @@ connect_backend_libpq(BackendInfo *backend) port_str, NULL, NULL, - pool_config->recovery_database, + dbname, pool_config->recovery_user, password ? password : ""); diff --git a/src/protocol/child.c b/src/protocol/child.c index cf2161806..87de2caac 100644 --- a/src/protocol/child.c +++ b/src/protocol/child.c @@ -772,8 +772,11 @@ read_startup_packet(POOL_CONNECTION *cp) } /* The database defaults to their user name. */ - if (sp->database == NULL || sp->database[0] == '\0') + if (sp->database == NULL) + sp->database = pstrdup(sp->user); + else if (sp->database[0] == '\0') { + pfree(sp->database); sp->database = pstrdup(sp->user); } diff --git a/src/protocol/pool_process_query.c b/src/protocol/pool_process_query.c index b69cb3d52..9a23f86f0 100644 --- a/src/protocol/pool_process_query.c +++ b/src/protocol/pool_process_query.c @@ -5296,6 +5296,7 @@ pool_push_pending_data(POOL_CONNECTION *backend) { pool_push(backend, buf, len); pfree(buf); + buf = NULL; } data_pushed = true; if (kind == 'E') @@ -5304,6 +5305,8 @@ pool_push_pending_data(POOL_CONNECTION *backend) ereport(DEBUG1, (errmsg("pool_push_pending_data: ERROR response found"))); pool_set_ignore_till_sync(); + if (buf) + pfree(buf); break; } num_pushed_messages++; diff --git a/src/protocol/pool_proto_modules.c b/src/protocol/pool_proto_modules.c index 6fad3353c..11befe979 100644 --- a/src/protocol/pool_proto_modules.c +++ b/src/protocol/pool_proto_modules.c @@ -3829,9 +3829,9 @@ pi_set(int node_id) ProcessInfo *pi = pool_get_my_process_info(); if (node_id < BITS_PER_TYPE(uint64)) - pi->node_ids[0] |= (1 << node_id); + pi->node_ids[0] |= ((uint64) 1 << node_id); else - pi->node_ids[1] |= (1 << (node_id - BITS_PER_TYPE(uint64))); + pi->node_ids[1] |= ((uint64) 1 << (node_id - BITS_PER_TYPE(uint64))); } /* @@ -3843,9 +3843,9 @@ is_pi_set(uint64 *node_ids, int node_id) int set; if (node_id < BITS_PER_TYPE(uint64)) - set = node_ids[0] & (1 << node_id); + set = node_ids[0] & ((uint64) 1 << node_id); else - set = node_ids[1] & (1 << (node_id - BITS_PER_TYPE(uint64))); + set = node_ids[1] & ((uint64) 1 << (node_id - BITS_PER_TYPE(uint64))); return set != 0; } diff --git a/src/watchdog/watchdog.c b/src/watchdog/watchdog.c index d57d83526..31aec1735 100644 --- a/src/watchdog/watchdog.c +++ b/src/watchdog/watchdog.c @@ -1983,6 +1983,10 @@ read_sockets(fd_set *rmask, int pending_fds_count) return count; } +/* + * write watchdog IP command along with result data + * returns true on success + */ static bool write_ipc_command_with_result_data(WDCommandData *ipcCommand, char type, char *data, int len) { @@ -2133,7 +2137,7 @@ read_ipc_socket_and_process(int sock, bool *remove_socket) data_len = strlen(data) + 1; } - if (write_ipc_command_with_result_data(ipcCommand, res_type, data, data_len)) + if (!write_ipc_command_with_result_data(ipcCommand, res_type, data, data_len)) { ereport(NOTICE, (errmsg("error writing to IPC socket"))); @@ -3691,6 +3695,10 @@ update_successful_outgoing_cons(fd_set *wmask, int pending_fds_count) return count; } +/* + * write packet to watchdog communication socket + * returns true on success. + */ static bool write_packet_to_socket(int sock, WDPacketData *pkt, bool ipcPacket) { diff --git a/src/watchdog/wd_lifecheck.c b/src/watchdog/wd_lifecheck.c index b62a9b493..5830d82af 100644 --- a/src/watchdog/wd_lifecheck.c +++ b/src/watchdog/wd_lifecheck.c @@ -642,7 +642,14 @@ load_watchdog_nodes_from_json(char *json_data, int len) json_value_free(root); } - +/*---------- + * is_wd_lifecheck_ready + * + * Check all registered watchdog nodes and returns WD_OK if: + * query mode: wd_ping_pgpool returns WD_OK + * hearbeat mode: has received from and + * sent to all node the heartbeat message + */ static int is_wd_lifecheck_ready(void) { @@ -680,7 +687,7 @@ is_wd_lifecheck_ready(void) { ereport(DEBUG1, (errmsg("watchdog checking life check is ready"), - errdetail("pgpool:%d at \"%s:%d\" has not send the heartbeat signal yet", + errdetail("pgpool:%d at \"%s:%d\" has not received from or sent to the heartbeat signal yet", i, node->hostName, node->pgpoolPort))); rtn = WD_NG; } |