diff --git a/checkin_notes b/checkin_notes index e72bb8d1db..8de2402d11 100755 --- a/checkin_notes +++ b/checkin_notes @@ -7335,3 +7335,17 @@ David 1 June 2005 sched/ handle_request.C + +David 2 June 2005 + - add a new value FILE_DELETE_ERROR for file delete state + (for when the unlink failed, e.g. because of permissions). + - add a new cmdline flag -retry_errors to file deleter + + (from Kevin Reed) + + db/ + boinc_db.h + html/inc/ + db_ops.inc + sched/ + file_deleter.C diff --git a/db/boinc_db.h b/db/boinc_db.h index c6b5afa1ae..258ee8aa57 100755 --- a/db/boinc_db.h +++ b/db/boinc_db.h @@ -266,8 +266,9 @@ struct HOST { #define FILE_DELETE_READY 1 // set to this value only when we believe all files are uploaded #define FILE_DELETE_DONE 2 - // means the file uploader ATTEMPTED to delete files. - // May have failed. TODO: retry delete later + // means the files were successfully deleted +#define FILE_DELETE_ERROR 3 + // Any error was returned while attempting to delete the file // values for assimilate_state #define ASSIMILATE_INIT 0 diff --git a/html/inc/db_ops.inc b/html/inc/db_ops.inc index 739ac1889e..ee7fe127fb 100644 --- a/html/inc/db_ops.inc +++ b/html/inc/db_ops.inc @@ -472,7 +472,7 @@ function show_result_summary() { for ($cs=1; $cs<6; $cs++) { $client_state[$cs] = 0; } - for ($fds=0; $fds<3; $fds++) { + for ($fds=0; $fds<4; $fds++) { $delete_state[$fds] = 0; } for ($vs=0; $vsfiledeletestate_init; $file_delete[1] = $res->filedeletestate_ready; $file_delete[2] = $res->filedeletestate_done; + $file_delete[3] = $res->filedeletestate_error; - $nfile_deleted = $res->filedeletestate_ready + $res->filedeletestate_done; + $nfile_deleted = $res->filedeletestate_ready + $res->filedeletestate_done + $res->filedeletestate_error; mysql_free_result($result); } @@ -627,12 +629,12 @@ FROM result WHERE echo "\n"; - for ($fds=0; $fds<3; $fds++) { + for ($fds=0; $fds<4; $fds++) { row2(file_delete_state_str($fds), link_results("$file_delete[$fds]", $urlquery, "outcome=1", "file_delete_state=$fds")); } row2("Total files deleted", - link_results("$nfile_deleted", $urlquery, "outcome=1", "(file_delete_state=1 or file_delete_state=2)")); + link_results("$nfile_deleted", $urlquery, "outcome=1", "(file_delete_state=1 or file_delete_state=2 or file_delete_state=3)")); echo "
File Delete state# results
"; echo "THIS IS AN INTERNAL BUG IN BOINC: PLEASE CONTACT BOINC DEVELOPERS
"; return "Unknown"; diff --git a/sched/file_deleter.C b/sched/file_deleter.C index 6722b346dc..03280976fc 100644 --- a/sched/file_deleter.C +++ b/sched/file_deleter.C @@ -178,16 +178,20 @@ static bool preserve_result_files=false; // return nonzero if did anything // -bool do_pass() { +bool do_pass(bool retry_error) { DB_WORKUNIT wu; DB_RESULT result; - bool did_something = false, got_error = false; + bool did_something = false; char buf[256]; int retval; check_stop_daemons(); - sprintf(buf, "where file_delete_state=%d limit 1000", FILE_DELETE_READY); + if (retry_error) { + sprintf(buf, "where file_delete_state=%d or file_delete_state=%d limit 1000", FILE_DELETE_READY, FILE_DELETE_ERROR); + } else { + sprintf(buf, "where file_delete_state=%d limit 1000", FILE_DELETE_READY); + } while (!wu.enumerate(buf)) { did_something = true; @@ -196,20 +200,20 @@ bool do_pass() { retval = wu_delete_files(wu); } if (retval) { - got_error = true; + wu.file_delete_state = FILE_DELETE_ERROR; + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "[WU#%d] update failed: %d\n", wu.id, retval); } else { wu.file_delete_state = FILE_DELETE_DONE; - sprintf(buf, "file_delete_state=%d", wu.file_delete_state); - retval= wu.update_field(buf); - if (retval) { - log_messages.printf(SCHED_MSG_LOG::CRITICAL, - "[WU#%d] update failed: %d\n", wu.id, retval - ); - } } + sprintf(buf, "file_delete_state=%d", wu.file_delete_state); + retval= wu.update_field(buf); } - sprintf(buf, "where file_delete_state=%d limit 1000", FILE_DELETE_READY); + if ( retry_error ) { + sprintf(buf, "where file_delete_state=%d or file_delete_state=%d limit 1000", FILE_DELETE_READY, FILE_DELETE_ERROR); + } else { + sprintf(buf, "where file_delete_state=%d limit 1000", FILE_DELETE_READY); + } while (!result.enumerate(buf)) { did_something = true; retval = 0; @@ -217,27 +221,20 @@ bool do_pass() { retval = result_delete_files(result); } if (retval) { - got_error = true; + result.file_delete_state = FILE_DELETE_ERROR; + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "[RESULT#%d] update failed: %d\n", result.id, retval); } else { result.file_delete_state = FILE_DELETE_DONE; - sprintf(buf, "file_delete_state=%d", result.file_delete_state); - retval= result.update_field(buf); - if (retval) { - log_messages.printf(SCHED_MSG_LOG::CRITICAL, - "[RESULT#%d] update failed: %d\n", result.id, retval - ); - } } - } - if (got_error) { - sleep(SLEEP_INTERVAL); + sprintf(buf, "file_delete_state=%d", result.file_delete_state); + retval= result.update_field(buf); } return did_something; } int main(int argc, char** argv) { int retval; - bool asynch = false, one_pass = false; + bool asynch = false, one_pass = false, retry_error = false; int i; check_stop_daemons(); @@ -246,6 +243,8 @@ int main(int argc, char** argv) { asynch = true; } else if (!strcmp(argv[i], "-one_pass")) { one_pass = true; + } else if (!strcmp(argv[i], "-retry_error")) { + retry_error=true; } else if (!strcmp(argv[i], "-preserve_wu_files")) { // This option is primarily for testing. // If enabled, the file_deleter will function 'normally' @@ -298,10 +297,10 @@ int main(int argc, char** argv) { } install_stop_signal_handler(); if (one_pass) { - do_pass(); + do_pass(retry_error); } else { while (1) { - if (!do_pass()) sleep(SLEEP_INTERVAL); + if (!do_pass(retry_error)) sleep(SLEEP_INTERVAL); } } }