From 5bb86f79b8643a754f16ca15d305a9c9ea094613 Mon Sep 17 00:00:00 2001 From: Bernd Machenschalk Date: Mon, 27 Feb 2012 12:08:25 +0000 Subject: [PATCH] scheduler: allow to configure userids for which the scheduler should not scan the host table. This was previously hardcoded for Einstein@home to prevent some users with many (identical) hosts from flooding the DB with slow queries. Now add userid to the project config (in config.xml) for each such userid. svn path=/trunk/boinc/; revision=25346 --- checkin_notes | 13 +++++++++++++ sched/handle_request.cpp | 10 +++++----- sched/sched_config.cpp | 4 ++++ sched/sched_config.h | 1 + 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/checkin_notes b/checkin_notes index bf39124790..06ff452eaa 100644 --- a/checkin_notes +++ b/checkin_notes @@ -2226,3 +2226,16 @@ Bernd 27 feb 2012 sched/ validator.cpp + +Bernd 27 feb 2012 + - scheduler: allow to configure userids for which the scheduler should + not scan the host table. This was previously hardcoded for + Einstein@home to prevent some users with many (identical) hosts + from flooding the DB with slow queries. Now add + userid + to the project config (in config.xml) for each such userid. + + sched/ + sched_config.h + sched_config.cpp + handle_request.cpp diff --git a/sched/handle_request.cpp b/sched/handle_request.cpp index 972d1ba420..8dc60b9345 100644 --- a/sched/handle_request.cpp +++ b/sched/handle_request.cpp @@ -68,11 +68,11 @@ static bool find_host_by_other(DB_USER& user, HOST req_host, DB_HOST& host) { char buf[2048]; char dn[512], ip[512], os[512], pm[512]; -#ifdef EINSTEIN_AT_HOME - // This is to prevent GRID hosts that manipulate their hostids from flooding E@H's DB with slow queries - if ((user.id == 282952) || (user.id == 243543)) - return false; -#endif + // don't dig through hosts of these users + // prevents flooding the DB with slow queries from users with many hosts + for(unsigned int i=0; i < config.dont_search_host_for_userid.size(); i++) + if (user.id == config.dont_search_host_for_userid[i]) + return false; // Only check if the fields are populated if (strlen(req_host.domain_name) && strlen(req_host.last_ip_addr) && strlen(req_host.os_name) && strlen(req_host.p_model)) { diff --git a/sched/sched_config.cpp b/sched/sched_config.cpp index 486ae5f203..e72ffb96fd 100644 --- a/sched/sched_config.cpp +++ b/sched/sched_config.cpp @@ -199,6 +199,10 @@ int SCHED_CONFIG::parse(FILE* f) { } continue; } + if (xp.parse_int(tag, "dont_search_host_for_user", retval)) { + dont_search_host_for_userid.push_back(retval); + continue; + } if (xp.parse_int("daily_result_quota", daily_result_quota)) continue; if (xp.parse_double("default_disk_max_used_gb", default_disk_max_used_gb)) continue; if (xp.parse_double("default_disk_max_used_pct", default_disk_max_used_pct)) continue; diff --git a/sched/sched_config.h b/sched/sched_config.h index dcc8bd53b9..378b5fd41f 100644 --- a/sched/sched_config.h +++ b/sched/sched_config.h @@ -104,6 +104,7 @@ struct SCHED_CONFIG { vector *ban_cpu; vector *ban_os; + vector dont_search_host_for_userid; int daily_result_quota; // max results per day is this * mult double default_disk_max_used_gb; double default_disk_max_used_pct;