#ifndef THREADS_DISABLED
/** parse fast reload command options. */
static int
-fr_parse_options(RES* ssl, char* arg, int* fr_verb, int* fr_nopause)
+fr_parse_options(RES* ssl, char* arg, int* fr_verb, int* fr_nopause,
+ int* fr_drop_mesh)
{
char* argp = arg;
while(*argp=='+') {
(*fr_verb)++;
} else if(*argp == 'p') {
(*fr_nopause) = 1;
+ } else if(*argp == 'd') {
+ (*fr_drop_mesh) = 1;
} else {
if(!ssl_printf(ssl,
"error: unknown option '+%c'\n",
(void)s;
(void)arg;
#else
- int fr_verb = 0, fr_nopause = 0;
- if(!fr_parse_options(ssl, arg, &fr_verb, &fr_nopause))
+ int fr_verb = 0, fr_nopause = 0, fr_drop_mesh = 0;
+ if(!fr_parse_options(ssl, arg, &fr_verb, &fr_nopause, &fr_drop_mesh))
return;
if(fr_verb >= 1) {
if(!ssl_printf(ssl, "start fast_reload\n"))
return;
}
- fast_reload_thread_start(ssl, worker, s, fr_verb, fr_nopause);
+ fast_reload_thread_start(ssl, worker, s, fr_verb, fr_nopause,
+ fr_drop_mesh);
#endif
}
/** fast reload thread. setup the thread info */
static int
-fast_reload_thread_setup(struct worker* worker, int fr_verb, int fr_nopause)
+fast_reload_thread_setup(struct worker* worker, int fr_verb, int fr_nopause,
+ int fr_drop_mesh)
{
struct fast_reload_thread* fr;
int numworkers = worker->daemon->num;
fr = worker->daemon->fast_reload_thread;
fr->fr_verb = fr_verb;
fr->fr_nopause = fr_nopause;
+ fr->fr_drop_mesh = fr_drop_mesh;
+ worker->daemon->fast_reload_drop_mesh = fr->fr_drop_mesh;
/* The thread id printed in logs, numworker+1 is the dnstap thread.
* This is numworkers+2. */
fr->threadnum = numworkers+2;
continue; /* Do not send to ourselves. */
worker_send_cmd(daemon->workers[i], worker_cmd_reload_start);
}
+
+ if(fr->worker->daemon->fast_reload_drop_mesh) {
+ verbose(VERB_ALGO, "worker: drop mesh queries after reload");
+ mesh_delete_all(fr->worker->env.mesh);
+ }
verbose(VERB_ALGO, "worker resume after reload");
}
void
fast_reload_thread_start(RES* ssl, struct worker* worker, struct rc_state* s,
- int fr_verb, int fr_nopause)
+ int fr_verb, int fr_nopause, int fr_drop_mesh)
{
if(worker->daemon->fast_reload_thread) {
log_err("fast reload thread already running");
return;
}
- if(!fast_reload_thread_setup(worker, fr_verb, fr_nopause)) {
+ if(!fast_reload_thread_setup(worker, fr_verb, fr_nopause,
+ fr_drop_mesh)) {
if(!ssl_printf(ssl, "error could not setup thread\n"))
return;
return;
int fr_verb;
/** option to not pause threads during reload */
int fr_nopause;
+ /** option to drop mesh queries */
+ int fr_drop_mesh;
/** the event that listens on the remote service worker to the
* commpair, it receives content from the fast reload thread. */
* @param fr_verb: verbosity to print output at. 0 is nothing, 1 is some
* and 2 is more detail.
* @param fr_nopause: option to not pause threads during reload.
+ * @param fr_drop_mesh: option to drop mesh queries.
*/
void fast_reload_thread_start(RES* ssl, struct worker* worker,
- struct rc_state* s, int fr_verb, int fr_nopause);
+ struct rc_state* s, int fr_verb, int fr_nopause, int fr_drop_mesh);
/**
* Stop fast reload thread
That means the caches sizes and the number of threads must not change between
reloads.
.TP
-.B fast_reload \fR[\fI+vp\fR]
+.B fast_reload \fR[\fI+dpv\fR]
Reload the server, but keep downtime to a minimum, so that user queries
keep seeing service. This needs the code compiled with threads. The config
is loaded in a thread, and prepared, then it briefly pauses the existing
microseconds instead of 0.3 milliseconds during which the worker threads are
interrupted. So, the interruption is much shorter, at the expense of some
inconsistency.
+.IP
+The '+d' option makes the reload drop queries that the worker threads are
+working on. This is like flush_requestlist. Without it the queries are kept
+so that users keep getting answers for those queries that are currently
+processed. The drop makes it so that queries during the life time of the
+query processing see only old, or only new config options.
.TP
.B verbosity \fInumber
Change verbosity value for logging. Same values as \fBverbosity\fR keyword in