ereport(DEBUG1,
(errmsg("primary node on master watchdog node \"%s\" is %d",backendStatus->nodeName,backendStatus->primary_node_id)));
- if (Req_info->primary_node_id != backendStatus->primary_node_id)
- {
- /* Do not produce this log message if we are starting up the Pgpool-II*/
- if (processState != INITIALIZING)
- ereport(LOG,
- (errmsg("primary node:%d on master watchdog node \"%s\" is different from local primary node:%d",
- backendStatus->primary_node_id,backendStatus->nodeName,Req_info->primary_node_id)));
-
- Req_info->primary_node_id = backendStatus->primary_node_id;
- primary_changed = true;
- }
- /* update the local backend status
- * Also remove quarantine flags
+ /*
+ * update the local backend status Also remove quarantine flags
*/
for (i = 0; i < backendStatus->node_count; i++)
{
}
}
}
+
+ if (Req_info->primary_node_id != backendStatus->primary_node_id)
+ {
+ /* Do not produce this log message if we are starting up the Pgpool-II */
+ if (processState != INITIALIZING)
+ ereport(LOG,
+ (errmsg("primary node:%d on master watchdog node \"%s\" is different from local primary node:%d",
+ backendStatus->primary_node_id, backendStatus->nodeName, Req_info->primary_node_id)));
+ /*
+ * master node returns primary_node_id = -1 when the node primary
+ * node is in quarantine state on the master.
+ * So we will not update our primary node id when the status of current primary node
+ * is not CON_DOWN while primary_node_id sent by master watchdong node is -1
+ */
+ if (backendStatus->primary_node_id == -1 && BACKEND_INFO(Req_info->primary_node_id).backend_status != CON_DOWN)
+ {
+ ereport(LOG,
+ (errmsg("primary node:%d on master watchdog node \"%s\" seems to be quarantined",
+ Req_info->primary_node_id, backendStatus->nodeName),
+ errdetail("keeping the current primary")));
+ }
+ else
+ {
+ Req_info->primary_node_id = backendStatus->primary_node_id;
+ primary_changed = true;
+ }
+ }
+
pfree(backendStatus);
if (reload_maste_node_id)
jw_start_array(jNode, "BackendNodeStatusList");
- for (i=0;i< pool_config->backend_desc->num_backends;i++)
+ for (i = 0; i < pool_config->backend_desc->num_backends; i++)
{
BACKEND_STATUS backend_status = pool_config->backend_desc->backend_info[i].backend_status;
if (backend_status == CON_DOWN && pool_config->backend_desc->backend_info[i].quarantine)
{
- /* since quarantine nodes are not cluster wide
- * so send CON_WATI status for quarantine nodes
+ /*
+ * since quarantine nodes are not cluster wide so send CON_WAIT
+ * status for quarantine nodes
*/
backend_status = CON_CONNECT_WAIT;
}