summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Březina <pbrezina@redhat.com>2012-12-17 12:04:54 +0100
committerJakub Hrozek <jhrozek@redhat.com>2012-12-18 16:40:51 +0100
commite148ba6dbb26a0eac162ac9a2ff550da2c883808 (patch)
tree3759902a64db4b95a0a42d110d4936d451b77546
parent4f945b6b3646fb982cc8e3c41c38059052f2240f (diff)
downloadsssd-e148ba6dbb26a0eac162ac9a2ff550da2c883808.tar.gz
sssd-e148ba6dbb26a0eac162ac9a2ff550da2c883808.tar.bz2
sssd-e148ba6dbb26a0eac162ac9a2ff550da2c883808.zip
try primary server after retry_timeout + 1 seconds when switching to backup
https://fedorahosted.org/sssd/ticket/1679 The problem is when we are about to reset the server status, we don't get through the timeout (30 seconds) because the "switch to primary server" task is scheduled 30 seconds after fall back to a backup server. Thus the server status remains "not working" and is resetted after another 30 seconds. We need to make sure that the server status is tried after the timeout period. retry_timeout is currently hardcoded to 30, thus the change in man page.
-rw-r--r--src/man/include/failover.xml2
-rw-r--r--src/providers/data_provider_fo.c3
-rw-r--r--src/providers/fail_over.c9
-rw-r--r--src/providers/fail_over.h2
4 files changed, 14 insertions, 2 deletions
diff --git a/src/man/include/failover.xml b/src/man/include/failover.xml
index dbf9d546..4865ce2b 100644
--- a/src/man/include/failover.xml
+++ b/src/man/include/failover.xml
@@ -17,7 +17,7 @@
<emphasis>primary</emphasis> and <emphasis>backup</emphasis>.
The idea is that servers in the primary list are preferred and
backup servers are only searched if no primary servers can be
- reached. If a backup server is selected, a timeout of 30 seconds
+ reached. If a backup server is selected, a timeout of 31 seconds
is set. After this timeout SSSD will periodically try to reconnect
to one of the primary servers. If it succeeds, it will replace
the current active (backup) server.
diff --git a/src/providers/data_provider_fo.c b/src/providers/data_provider_fo.c
index a1b96be3..69ade47b 100644
--- a/src/providers/data_provider_fo.c
+++ b/src/providers/data_provider_fo.c
@@ -531,6 +531,7 @@ static void be_resolve_server_done(struct tevent_req *subreq)
struct tevent_req);
struct be_resolve_server_state *state = tevent_req_data(req,
struct be_resolve_server_state);
+ time_t timeout = fo_get_service_retry_timeout(state->svc->fo_service) + 1;
int ret;
ret = be_resolve_server_process(subreq, state, &new_subreq);
@@ -546,7 +547,7 @@ static void be_resolve_server_done(struct tevent_req *subreq)
/* FIXME: make the timeout configurable */
ret = be_primary_server_timeout_activate(state->ctx, state->ev,
state->ctx, state->svc,
- 30);
+ timeout);
if (ret != EOK) {
goto fail;
}
diff --git a/src/providers/fail_over.c b/src/providers/fail_over.c
index f3bba37f..e7c44174 100644
--- a/src/providers/fail_over.c
+++ b/src/providers/fail_over.c
@@ -1555,6 +1555,15 @@ fo_get_server_hostname_last_change(struct fo_server *server)
return server->common->last_status_change.tv_sec;
}
+time_t fo_get_service_retry_timeout(struct fo_service *svc)
+{
+ if (svc == NULL || svc->ctx == NULL || svc->ctx->opts == NULL) {
+ return 0;
+ }
+
+ return svc->ctx->opts->retry_timeout;
+}
+
void fo_reset_services(struct fo_ctx *fo_ctx)
{
struct fo_service *service;
diff --git a/src/providers/fail_over.h b/src/providers/fail_over.h
index 0eb21258..1ad081e7 100644
--- a/src/providers/fail_over.h
+++ b/src/providers/fail_over.h
@@ -192,6 +192,8 @@ time_t fo_get_server_hostname_last_change(struct fo_server *server);
int fo_is_srv_lookup(struct fo_server *s);
+time_t fo_get_service_retry_timeout(struct fo_service *svc);
+
void fo_reset_services(struct fo_ctx *fo_ctx);
bool fo_svc_has_server(struct fo_service *service, struct fo_server *server);