flush_requestlist feature for unbound-control.

git-svn-id: file:///svn/unbound/trunk@1479 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2009-02-12 13:21:19 +00:00
parent ca09b7014b
commit 8148211e53
6 changed files with 49 additions and 2 deletions

View File

@ -1056,6 +1056,14 @@ do_flush_stats(SSL* ssl, struct worker* worker)
send_ok(ssl);
}
/** flush requestlist */
static void
do_flush_requestlist(SSL* ssl, struct worker* worker)
{
mesh_delete_all(worker->env.mesh);
send_ok(ssl);
}
/**
* Local info for deletion functions
*/
@ -1404,10 +1412,14 @@ execute_cmd(struct daemon_remote* rc, SSL* ssl, char* cmd,
return;
} else if(strncmp(p, "flush_stats", 11) == 0) {
/* must always distribute this cmd */
if(rc)
distribute_cmd(rc, ssl, cmd);
if(rc) distribute_cmd(rc, ssl, cmd);
do_flush_stats(ssl, worker);
return;
} else if(strncmp(p, "flush_requestlist", 17) == 0) {
/* must always distribute this cmd */
if(rc) distribute_cmd(rc, ssl, cmd);
do_flush_requestlist(ssl, worker);
return;
} else if(strncmp(p, "lookup", 6) == 0) {
do_lookup(ssl, worker, skipwhite(p+6));
return;

View File

@ -3,6 +3,7 @@
- small refactor of stats clearing.
- #227: flush_stats feature for unbound-control.
- stats_noreset feature for unbound-control.
- flush_requestlist feature for unbound-control.
10 February 2009: Wouter
- keys with rfc5011 REVOKE flag are skipped and not considered when

View File

@ -123,6 +123,13 @@ This needs to walk and inspect the entire cache, and is a slow operation.
.B flush_stats
Reset statistics to zero.
.TP
.B flush_requestlist
Drop the queries that are worked on. Stops working on the queries that the
server is working on now. The cache is unaffected. No reply is sent for
those queries, probably making those users request again later.
Useful to make the server restart working on queries with new settings,
such as a higher verbosity level.
.TP
.B dump_requestlist
Show what is worked on. Prints all queries that the server is currently
working on. Prints the time that users have been waiting. For internal

View File

@ -205,6 +205,25 @@ mesh_delete(struct mesh_area* mesh)
free(mesh);
}
void
mesh_delete_all(struct mesh_area* mesh)
{
/* free all query states */
traverse_postorder(&mesh->all, &mesh_delete_helper, NULL);
mesh->stats_dropped += mesh->num_reply_addrs;
/* clear mesh area references */
rbtree_init(&mesh->run, &mesh_state_compare);
rbtree_init(&mesh->all, &mesh_state_compare);
mesh->num_reply_addrs = 0;
mesh->num_reply_states = 0;
mesh->num_detached_states = 0;
mesh->num_forever_states = 0;
mesh->forever_first = NULL;
mesh->forever_last = NULL;
mesh->jostle_first = NULL;
mesh->jostle_last = NULL;
}
int mesh_make_new_space(struct mesh_area* mesh)
{
struct mesh_state* m = mesh->jostle_last;

View File

@ -391,6 +391,12 @@ struct mesh_state* mesh_state_create(struct module_env* env,
*/
void mesh_state_cleanup(struct mesh_state* mstate);
/**
* Delete all mesh states from the mesh.
* @param mesh: the mesh area to clear
*/
void mesh_delete_all(struct mesh_area* mesh);
/**
* Find a mesh state in the mesh area. Pass relevant flags.
*

View File

@ -61,6 +61,7 @@ usage()
printf(" start start server; runs unbound(8)\n");
printf(" stop stops the server\n");
printf(" reload reloads the server\n");
printf(" (this flushes data, stats, requestlist)\n");
printf(" stats print statistics\n");
printf(" stats_noreset peek at statistics\n");
printf(" status display status of server\n");
@ -80,6 +81,7 @@ usage()
printf(" flush_zone [name] flush everything at or under name\n");
printf(" from rr and dnssec caches\n");
printf(" flush_stats flush statistics, make zero\n");
printf(" flush_requestlist drop queries that are worked on\n");
printf(" dump_requestlist show what is worked on\n");
printf("Version %s\n", PACKAGE_VERSION);
printf("BSD licensed, see LICENSE in source package for details.\n");