MAJOR: servers: propagate server status changes asynchronously.

In order to prepare multi-thread development, code was re-worked
to propagate changes asynchronoulsy.

Servers with pending status changes are registered in a list
and this one is processed and emptied only once 'run poll' loop.

Operational status changes are performed before administrative
status changes.

In a case of multiple operational status change or admin status
change in the same 'run poll' loop iteration, those changes are
merged to reach only the targeted status.
This commit is contained in:
Emeric Brun 2017-10-03 14:46:45 +02:00 committed by Willy Tarreau
parent d716f9bacf
commit 64cc49cf7e
4 changed files with 554 additions and 388 deletions

View File

@ -50,6 +50,9 @@ void srv_compute_all_admin_states(struct proxy *px);
int srv_set_addr_via_libc(struct server *srv, int *err_code);
int srv_init_addr(void);
struct server *cli_find_server(struct appctx *appctx, char *arg);
void servers_update_status(void);
extern struct list updated_servers;
/* functions related to server name resolution */
int snr_update_srv_status(struct server *s, int has_no_ip);

View File

@ -299,6 +299,9 @@ struct server {
int nb_high;
} tmpl_info;
struct dns_srvrq *srvrq; /* Pointer representing the DNS SRV requeest, if any */
struct list update_status; /* to attach to list of servers chnaging status */
char op_st_chg_reason[48]; /* operational status change's reason */
char adm_st_chg_cause[48]; /* adminstrative status change's cause */
};
/* Descriptor for a "server" keyword. The ->parse() function returns 0 in case of

View File

@ -2182,6 +2182,9 @@ static void run_poll_loop()
cur_poller.poll(&cur_poller, next);
fd_process_cached_events();
applet_run_active();
/* Commit server status changes */
servers_update_status();
}
}

File diff suppressed because it is too large Load Diff