- scheduler: do "careful update" of workunit.hr_class

in case someone else changed since we read it.
    Hopefully this will fix a race condition
    where WU results get sent to different HR classes.
    (Alternatively we could use transactions,
    or acquire the semaphore during read/update,
    but this could impact performance).

svn path=/trunk/boinc/; revision=14710
This commit is contained in:
David Anderson 2008-02-08 17:20:09 +00:00
parent 7fbef78a30
commit f77420c2c0
7 changed files with 44 additions and 8 deletions

View File

@ -122,3 +122,11 @@ David Feb 7 2008
bolt_xset.inc
user/
bolt_sched.php
David Feb 8 2008
- removed "bolt_" from API functions.
I don't think this prefix is useful;
Bolt isn't going to be used within large existing PHP code
html/inc
bolt_ex.inc

View File

@ -1274,3 +1274,17 @@ Charlie Feb 7 2008
clientgui/
MainDocument.cpp,h
AdvancedFrame.cpp
David Feb 8 2008
- scheduler: do "careful update" of workunit.hr_class
in case someone else changed since we read it.
Hopefully this will fix a race condition
where WU results get sent to different HR classes.
(Alternatively we could use transactions,
or acquire the semaphore during read/update,
but this could impact performance).
db/
db_base.C,h
sched/
sched_hr.C

View File

@ -157,9 +157,13 @@ int DB_BASE::update() {
// update one or more fields
// "clause" is something like "foo=5, blah='xxx'" or "foo=foo+5"
//
int DB_BASE::update_field(const char* clause) {
int DB_BASE::update_field(const char* clause, const char* where_clause) {
char query[MAX_QUERY_LEN];
sprintf(query, "update %s set %s where id=%d", table_name, clause, get_id());
if (where_clause) {
sprintf(query, "update %s set %s where id=%d and %s", table_name, clause, get_id(), where_clause);
} else {
sprintf(query, "update %s set %s where id=%d", table_name, clause, get_id());
}
return db->do_query(query);
}

View File

@ -93,7 +93,7 @@ public:
int insert();
int insert_batch(std::string&);
int update();
int update_field(const char*);
int update_field(const char*, const char* where_clause=NULL);
int delete_from_db();
int get_field_int(const char*, int&);
int get_field_str(const char*, char*, int);

View File

@ -1,6 +1,12 @@
<?
$project_news = array(
array("Feb 7, 2008",
"<a href=http://biology.polytechnique.fr/proteinsathome>Proteins@Home</a>
has resumed operations.
Check out their <a href=http://www3.interscience.wiley.com/cgi-bin/abstract/117860966/ABSTRACT?CRETRY=1&SRETRY=0>paper on computational protein design</a>
in the Journal of Computational Chemistry."
),
array("Jan 31, 2008",
"The <a href=http://bob.myisland.as/tsp/>TSP project</a>
is featured in International Science Grid This Week: <a href=http://www.isgtw.org/?pid=1000844>Traveling salesman meets distributed computing</a>."

View File

@ -8,7 +8,7 @@ $bolt_ex_state = 0;
$bolt_ex_score = 0;
$bolt_ex_query_string = "";
function bolt_exclusive_choice($choices) {
function exclusive_choice($choices) {
global $bolt_ex_mode; // input
global $bolt_ex_index; // input
global $bolt_ex_score; // incremental output if SCORE
@ -71,7 +71,7 @@ function bolt_exclusive_choice($choices) {
$bolt_ex_index++;
}
function bolt_inclusive_choice($choices) {
function inclusive_choice($choices) {
global $bolt_ex_mode; // input
global $bolt_ex_index; // input
global $bolt_ex_score; // incremental output if SCORE
@ -130,7 +130,7 @@ function bolt_inclusive_choice($choices) {
$bolt_ex_index++;
}
function bolt_image_rect($img, $rect) {
function image_rect($img, $rect) {
global $bolt_ex_mode; // input
global $bolt_ex_index; // input
global $bolt_ex_state; // output if SHOW, else input

View File

@ -96,8 +96,12 @@ bool already_sent_to_different_platform_careful(
wreq.hr_reject_temp = true;
}
} else {
sprintf(buf, "hr_class=%d", host_hr_class);
db_wu.update_field(buf);
// do a "careful update" to make sure the WU's hr_class hasn't
// changed since we read it earlier
//
sprintf(buf, "hr_class=%d", "hr_class=%d", host_hr_class, wu_hr_class);
retval = db_wu.update_field(buf);
if (retval) return true;
}
return wreq.hr_reject_temp;
}