{
if (pool_config->parallel_mode || pool_config->enable_query_cache)
{
- system_db_connect();
- if (PQstatus(system_db_info->pgconn) != CONNECTION_OK)
+ int nRet;
+ nRet = system_db_connect();
+ if (nRet || PQstatus(system_db_info->pgconn) != CONNECTION_OK)
{
pool_error("Could not make persistent libpq system DB connection");
}
BackendInfo *bkinfo;
POOL_CONNECTION_POOL_SLOT *s;
POOL_CONNECTION *con;
- POOL_STATUS status;
POOL_SELECT_RESULT *res;
bool is_standby;
int i;
return -1;
}
#endif
- status = do_query(con, "SELECT pg_is_in_recovery()",
- &res, PROTO_MAJOR_V3);
- if (res->numrows <= 0)
- {
- pool_log("find_primary_node: do_query returns no rows");
- }
- if (res->data[0] == NULL)
+ if(do_query(con, "SELECT pg_is_in_recovery()", &res, PROTO_MAJOR_V3) == POOL_CONTINUE)
{
- pool_log("find_primary_node: do_query returns no data");
+ if (res->numrows <= 0)
+ {
+ pool_log("find_primary_node: do_query returns no rows");
+ }
+ if (res->data[0] == NULL)
+ {
+ pool_log("find_primary_node: do_query returns no data");
+ }
+ if (res->nullflags[0] == -1)
+ {
+ pool_log("find_primary_node: do_query returns NULL");
+ }
+ if (res->data[0] && !strcmp(res->data[0], "t"))
+ {
+ is_standby = true;
+ }
}
- if (res->nullflags[0] == -1)
+ else
{
- pool_log("find_primary_node: do_query returns NULL");
+ pool_log("find_primary_node: do_query failed");
}
- if (res->data[0] && !strcmp(res->data[0], "t"))
- {
- is_standby = true;
- }
- free_select_result(res);
+ if(res)
+ free_select_result(res);
discard_persistent_db_connection(s);
/*
*/
if (protoMajor == PROTO_MAJOR_V3)
{
- if (kind != 'K')
- {
- pool_error("pool_do_auth: expect \"K\" got %c", kind);
- return -1;
- }
-
if ((length = pool_read_message_length(cp)) != 12)
{
pool_error("pool_do_auth: invalid messages length(%d) for BackendKeyData", length);
/* No cached data is available. Ask backend. */
status = do_query(MASTER(session_context->backend),
"SELECT current_setting('transaction_isolation')", &res, MAJOR(session_context->backend));
+ if(status != POOL_CONTINUE)
+ {
+ pool_error("pool_get_transaction_isolation: do_query returns no rows");
+ if(res)
+ free_select_result(res);
+ return POOL_UNKNOWN;
+ }
if (res->numrows <= 0)
{
ret = POOL_UNKNOWN;
}
- free_select_result(res);
+ if(res)
+ free_select_result(res);
if (ret != POOL_UNKNOWN)
session_context->transaction_isolation = ret;