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