summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/protocol/child.c5
-rw-r--r--src/watchdog/watchdog.c10
-rw-r--r--src/watchdog/wd_lifecheck.c11
3 files changed, 22 insertions, 4 deletions
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/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;
}