If master_response_timeout hasn't been set in repmgr.conf it defaults

to zero, which was causing to a false positive in the failure detection
logic in wait_connection_availability(). So, change that to defaults to 60s
and add a check to avoid it being set to zero or negative.

Problem reported and analyzed by Andrew Newman
This commit is contained in:
Jaime Casanova
2012-07-21 09:49:05 -05:00
parent a6c94b29de
commit 2d24518d9d

View File

@@ -41,7 +41,9 @@ parse_config(const char *config_file, t_configuration_options *options)
memset(options->promote_command, 0, sizeof(options->promote_command));
memset(options->follow_command, 0, sizeof(options->follow_command));
memset(options->rsync_options, 0, sizeof(options->rsync_options));
options->master_response_timeout = 0;
/* if nothing has been provided defaults to 60 */
options->master_response_timeout = 60;
/*
* Since some commands don't require a config file at all, not
@@ -120,6 +122,13 @@ parse_config(const char *config_file, t_configuration_options *options)
log_err(_("Node information is missing. Check the configuration file.\n"));
exit(ERR_BAD_CONFIG);
}
if (options->master_response_timeout <= 0)
{
log_err(_("Master response timeout must be greater than zero. Check the configuration file.\n"));
exit(ERR_BAD_CONFIG);
}
}
}