From 6b3ea3d339d4d376e6c1007ed8940492d73b3a72 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sat, 23 Jan 2010 00:36:12 +0000 Subject: [PATCH] - user web: don't show "database error" if result refers to deleted app version svn path=/trunk/boinc/; revision=20251 --- checkin_notes | 11 +++++++++++ client/app_start.cpp | 6 ++++-- html/inc/result.inc | 3 +++ sched/transitioner.cpp | 31 +++++++++++++++++-------------- 4 files changed, 35 insertions(+), 16 deletions(-) diff --git a/checkin_notes b/checkin_notes index 12a0bf6832..c612a212ac 100644 --- a/checkin_notes +++ b/checkin_notes @@ -637,3 +637,14 @@ David 22 Jan 2010 sched/ db_purge.cpp transitioner.cpp + +David 22 Jan 2010 + - user web: don't show "database error" if result refers + to deleted app version + + client/ + app_start.cpp + html/inc/ + result.inc + sched/ + transitioner.cpp diff --git a/client/app_start.cpp b/client/app_start.cpp index 6f73b6108b..dd7fe906c4 100644 --- a/client/app_start.cpp +++ b/client/app_start.cpp @@ -167,8 +167,10 @@ int ACTIVE_TASK::get_shmem_seg_name() { // ftok() only works if there's a file at the given location // - FILE* f = boinc_fopen(init_data_path, "w"); - if (f) fclose(f); + if (!boinc_file_exists(init_data_path)) { + FILE* f = boinc_fopen(init_data_path, "w"); + if (f) fclose(f); + } shmem_seg_name = ftok(init_data_path, 1); if (shmem_seg_name == -1) return ERR_SHMEM_NAME; #endif diff --git a/html/inc/result.inc b/html/inc/result.inc index f189ef518d..aac163a50c 100644 --- a/html/inc/result.inc +++ b/html/inc/result.inc @@ -28,6 +28,9 @@ function app_version_string($id) { $app = $apps[$av->appid]; } else { $av = BoincAppVersion::lookup("id=$id"); + if (!$av) { + return "Not in DB"; + } $app_versions[$id] = $av; $app = BoincApp::lookup_id($av->appid); $apps[$av->appid] = $app; diff --git a/sched/transitioner.cpp b/sched/transitioner.cpp index 5a2129cd84..d652b0f5bb 100644 --- a/sched/transitioner.cpp +++ b/sched/transitioner.cpp @@ -434,8 +434,8 @@ int handle_wu( // all_over_and_validated = true; bool all_over_and_ready_to_assimilate = true; - // used for the defer assmilation - int most_recently_returned = 0; + // used for the defer assimilation + double most_recently_returned = 0; for (i=0; i now) { + if ((res_item.res_report_deadline + config.grace_period_hours*3600) > now) { all_over_and_validated = false; } } @@ -459,7 +459,7 @@ int handle_wu( } } - // If we are defering assimilation until all results are over + // If we are deferring assimilation until all results are over // and validated then when that happens we need to make sure // that it gets advanced to assimilate ready // the items.size is a kludge @@ -478,7 +478,7 @@ int handle_wu( // if WU is assimilated, trigger file deletion // if (wu_item.assimilate_state == ASSIMILATE_DONE - && ((most_recently_returned + config.delete_delay_hours*60*60) < now) + && ((most_recently_returned + config.delete_delay_hours*3600) < now) ) { // can delete input files if all results OVER // @@ -531,10 +531,10 @@ int handle_wu( } } else if (wu_item.assimilate_state == ASSIMILATE_DONE) { log_messages.printf(MSG_DEBUG, - "[WU#%d %s] not checking for items to be ready for delete because the deferred delete time has not expired. That will occur in %d seconds\n", + "[WU#%d %s] not checking for results ready for delete because deferred delete time has not expired. That will occur in %d seconds\n", wu_item.id, wu_item.name, - most_recently_returned + config.delete_delay_hours*60*60-(int)now + most_recently_returned + config.delete_delay_hours*3600-now ); } @@ -573,8 +573,8 @@ int handle_wu( if (res_item.res_outcome == RESULT_OUTCOME_NO_REPLY) { // Transition again after the grace period has expired // - if ((res_item.res_report_deadline + config.grace_period_hours*60*60) > now) { - x = res_item.res_report_deadline + config.grace_period_hours*60*60; + x = res_item.res_report_deadline + config.grace_period_hours*3600; + if (x > now) { if (x > max_grace_or_delay_time) { max_grace_or_delay_time = x; } @@ -583,10 +583,10 @@ int handle_wu( || res_item.res_outcome == RESULT_OUTCOME_CLIENT_ERROR || res_item.res_outcome == RESULT_OUTCOME_VALIDATE_ERROR ) { - // Transition again after deferred delete period has experied + // Transition again after deferred delete period has expired // - if ((res_item.res_received_time + config.delete_delay_hours*60*60) > now) { - x = res_item.res_received_time + config.delete_delay_hours*60*60; + x = res_item.res_received_time + config.delete_delay_hours*3600; + if (x > now) { if (x > max_grace_or_delay_time && res_item.res_received_time > 0) { max_grace_or_delay_time = x; } @@ -598,10 +598,13 @@ int handle_wu( // If either of the grace period or delete delay is less than // the next transition time then use that value // - if (max_grace_or_delay_time < wu_item.transition_time && max_grace_or_delay_time > now && ninprogress == 0) { + if (max_grace_or_delay_time < wu_item.transition_time + && max_grace_or_delay_time > now + && ninprogress == 0 + ) { wu_item.transition_time = max_grace_or_delay_time; log_messages.printf(MSG_NORMAL, - "[WU#%d %s] Delaying transition due to grace period or delete day. New transition time = %d sec\n", + "[WU#%d %s] Delaying transition due to grace period or delete delay. New transition time: %d\n", wu_item.id, wu_item.name, wu_item.transition_time ); }