From b84fd8bbeffdbb46a302d6e1d4eda3f4e2cd44ee Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 8 Oct 2004 23:07:59 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=4308 --- checkin_notes | 21 ++++----- db/boinc_db.C | 113 ++++++++++++++-------------------------------- db/boinc_db.h | 32 +------------ sched/validator.C | 8 ++-- 4 files changed, 50 insertions(+), 124 deletions(-) diff --git a/checkin_notes b/checkin_notes index 55ee163eca..59e97b1794 100755 --- a/checkin_notes +++ b/checkin_notes @@ -18197,16 +18197,13 @@ David 8 Oct 2004 prefs.C Lana 8 Oct 2004 - - changed API check_set to take input WORKUNIT instead of - DB_WORKUNIT - - added VALIDATOR_ITEM and DB_VALIDATOR_ITEM_SET - - optimized validator to work with the DB_VALIDATOR_ITEM_SET - instead of going to the database - - db/ - boinc_db.C, .h - sched/ - validator.C - sample_bitwise_validator.C - sample_trivial_validator.C + - changed check_set() to take input WORKUNIT instead of DB_WORKUNIT + - added VALIDATOR_ITEM and DB_VALIDATOR_ITEM_SET + - optimized validator to use DB_VALIDATOR_ITEM_SET + db/ + boinc_db.C, .h + sched/ + validator.C + sample_bitwise_validator.C + sample_trivial_validator.C diff --git a/db/boinc_db.C b/db/boinc_db.C index e38acda400..95d159d83c 100644 --- a/db/boinc_db.C +++ b/db/boinc_db.C @@ -791,34 +791,32 @@ int DB_TRANSITIONER_ITEM_SET::update_workunit(TRANSITIONER_ITEM& ti) { void VALIDATOR_ITEM::parse(MYSQL_ROW& r) { int i=0; clear(); - id = atoi(r[i++]); - appid = atoi(r[i++]); - strcpy2(name, r[i++]); - need_validate= atoi(r[i++]); - canonical_resultid = atoi(r[i++]); - canonical_credit = atof(r[i++]); - min_quorum = atoi(r[i++]); - assimilate_state = atoi(r[i++]); - transition_time = atoi(r[i++]); - opaque = atof(r[i++]); - batch = atoi(r[i++]); - max_success_results = atoi(r[i++]); - error_mask = atoi(r[i++]); + wu.id = atoi(r[i++]); + strcpy2(wu.name, r[i++]); + wu.canonical_resultid = atoi(r[i++]); + wu.canonical_credit = atof(r[i++]); + wu.min_quorum = atoi(r[i++]); + wu.assimilate_state = atoi(r[i++]); + wu.transition_time = atoi(r[i++]); + wu.opaque = atof(r[i++]); + wu.batch = atoi(r[i++]); + wu.max_success_results = atoi(r[i++]); + wu.error_mask = atoi(r[i++]); - res_id = atoi(r[i++]); - strcpy2(res_name, r[i++]); - res_validate_state = atoi(r[i++]); - res_server_state = atoi(r[i++]); - res_outcome = atoi(r[i++]); - res_claimed_credit = atof(r[i++]); - res_granted_credit = atof(r[i++]); - strcpy2(res_xml_doc_out, r[i++]); - res_cpu_time = atof(r[i++]); - res_batch = atoi(r[i++]); - res_opaque = atof(r[i++]); - res_exit_status = atoi(r[i++]); - res_hostid = atoi(r[i++]); - res_sent_time = atoi(r[i++]); + res.id = atoi(r[i++]); + strcpy2(res.name, r[i++]); + res.validate_state = atoi(r[i++]); + res.server_state = atoi(r[i++]); + res.outcome = atoi(r[i++]); + res.claimed_credit = atof(r[i++]); + res.granted_credit = atof(r[i++]); + strcpy2(res.xml_doc_out, r[i++]); + res.cpu_time = atof(r[i++]); + res.batch = atoi(r[i++]); + res.opaque = atof(r[i++]); + res.exit_status = atoi(r[i++]); + res.hostid = atoi(r[i++]); + res.sent_time = atoi(r[i++]); } int DB_VALIDATOR_ITEM_SET::enumerate( @@ -838,9 +836,7 @@ int DB_VALIDATOR_ITEM_SET::enumerate( sprintf(query, "SELECT %s " " wu.id, " - " wu.appid, " " wu.name, " - " wu.need_validate, " " wu.canonical_resultid, " " wu.canonical_credit, " " wu.min_quorum, " @@ -864,14 +860,15 @@ int DB_VALIDATOR_ITEM_SET::enumerate( " res.exit_status, " " res.hostid, " " res.sent_time " - "FROM " - " workunit AS wu " - " LEFT JOIN result AS res ON wu.id = res.workunitid " - "WHERE " - " wu.appid = %d and wu.need_validate > 0 " - "LIMIT " - " %d ", - priority, appid, nresult_limit); + "FROM " + " workunit AS wu " + " LEFT JOIN result AS res ON wu.id = res.workunitid " + "WHERE " + " wu.appid = %d and wu.need_validate > 0 " + "LIMIT " + " %d ", + priority, appid, nresult_limit + ); x = db->do_query(query); if (x) return mysql_errno(db->mysql); @@ -955,48 +952,6 @@ int DB_VALIDATOR_ITEM_SET::update_workunit(WORKUNIT& wu) { return db->do_query(query); } -RESULT DB_VALIDATOR_ITEM_SET::create_result(VALIDATOR_ITEM& vi) { - RESULT result; - - result.workunitid = vi.id; - result.id = vi.res_id; - result.name = vi.res_name; - result.validate_state = vi.res_validate_state; - result.server_state = vi.res_server_state; - result.outcome = vi.res_outcome; - result.claimed_credit = vi.res_claimed_credit; - result.granted_credit = vi.res_granted_credit; - strcpy2(result.xml_doc_out, vi.res_xml_doc_out); - result.cpu_time = vi.res_cpu_time; - result.batch = vi.res_batch; - result.opaque = vi.res_opaque; - result.exit_status = vi.res_exit_status; - result.hostid = vi.res_hostid; - result.sent_time = vi.res_sent_time; - - return result; -} - -WORKUNIT DB_VALIDATOR_ITEM_SET::create_workunit(VALIDATOR_ITEM& vi) { - WORKUNIT wu; - - wu.id = vi.id; - wu.appid = vi.appid; - strcpy2(wu.name, vi.name); - wu.need_validate = vi.need_validate; - wu.canonical_resultid = vi.canonical_resultid; - wu.canonical_credit = vi.canonical_credit; - wu.min_quorum = vi.min_quorum; - wu.assimilate_state = vi.assimilate_state; - wu.transition_time = vi.transition_time; - wu.opaque = vi.opaque; - wu.batch = vi.batch; - wu.max_success_results = vi.max_success_results; - wu.error_mask = vi.error_mask; - - return wu; -} - void WORK_ITEM::parse(MYSQL_ROW& r) { int i=0; memset(this, 0, sizeof(WORK_ITEM)); diff --git a/db/boinc_db.h b/db/boinc_db.h index 3d8b7d8b9a..9497b70322 100755 --- a/db/boinc_db.h +++ b/db/boinc_db.h @@ -465,34 +465,8 @@ struct TRANSITIONER_ITEM { }; struct VALIDATOR_ITEM { - int id; - int appid; - char name[256]; - bool need_validate; - int canonical_resultid; - double canonical_credit; - int min_quorum; - int assimilate_state; - int transition_time; - double opaque; - int batch; - int max_success_results; - int error_mask; - - int res_id; - char res_name[256]; - int res_validate_state; - int res_server_state; - int res_outcome; - double res_claimed_credit; - double res_granted_credit; - char res_xml_doc_out[LARGE_BLOB_SIZE]; - double res_cpu_time; - int res_batch; - double res_opaque; - int res_exit_status; - int res_hostid; - int res_sent_time; + WORKUNIT wu; + RESULT res; void clear(); void parse(MYSQL_ROW&); @@ -626,8 +600,6 @@ public: ); int update_result(RESULT&); int update_workunit(WORKUNIT&); - RESULT create_result(VALIDATOR_ITEM&); - WORKUNIT create_workunit(VALIDATOR_ITEM&); }; // used by the feeder and scheduler for outgoing work diff --git a/sched/validator.C b/sched/validator.C index 60118a22eb..e1a4cc6bdf 100644 --- a/sched/validator.C +++ b/sched/validator.C @@ -149,8 +149,9 @@ int grant_credit(RESULT& result, double credit) { return 0; } -void handle_wu(DB_VALIDATOR_ITEM_SET& validator, - std::vector& items) { +void handle_wu( + DB_VALIDATOR_ITEM_SET& validator, std::vector& items +) { int canonical_result_index = -1; bool update_result, retry; bool need_immediate_transition = false, need_delayed_transition = false; @@ -158,9 +159,10 @@ void handle_wu(DB_VALIDATOR_ITEM_SET& validator, double credit = 0; unsigned int i; RESULT result, canonical_result; - WORKUNIT wu; VALIDATOR_ITEM& wu_vi = items[0]; + WORKUNIT& wu=wu_vi.wu; + if (wu_vi.canonical_resultid) { log_messages.printf(