- admin: add script for deleting results with no workunit.

There were ~1,400 of these on SETI@home,
    presumably because of a bug at some point in the past.

svn path=/trunk/boinc/; revision=22197
This commit is contained in:
David Anderson 2010-08-11 18:52:11 +00:00
parent f2221702bf
commit b2064d0cd0
5 changed files with 52 additions and 4 deletions

View File

@ -5917,3 +5917,17 @@ Rom 11 Aug 2010
win_build/ win_build/
libboinc_staticcrt.vcproj libboinc_staticcrt.vcproj
David 11 Aug 2010
- admin: add script for deleting results with no workunit.
There were ~1,400 of these on SETI@home,
presumably because of a bug at some point in the past.
html/
ops/
delete_orphan_results.php
profile_screen_form.php
inc/
boinc_db.inc
sched/
db_purge.cpp

View File

@ -223,6 +223,10 @@ class BoincResult {
$db = BoincDb::get(); $db = BoincDb::get();
return $db->lookup_id($id, 'result', 'BoincResult'); return $db->lookup_id($id, 'result', 'BoincResult');
} }
function delete() {
$db = BoincDb::get();
return $db->delete($this, 'result');
}
} }
class BoincWorkunit { class BoincWorkunit {

View File

@ -0,0 +1,32 @@
<?php
// delete results without a corresponding workunit.
// (in principle these shouldn't exist)
error_reporting(E_ALL);
ini_set('display_errors', true);
ini_set('display_startup_errors', true);
require_once("../inc/boinc_db.inc");
$ndel = 0;
while (1) {
$rs = BoincResult::enum("true order by id limit 100");
$found = false;
foreach ($rs as $r) {
$wu = BoincWorkunit::lookup_id($r->workunitid);
if ($wu) {
echo "$r->id has a WU\n";
$found = true;
break;
} else {
echo "$r->id has no WU - deleting\n";
$ndel++;
$r->delete();
}
}
if ($found) break;
}
echo "Done - deleted $ndel results\n";
?>

View File

@ -71,7 +71,7 @@ while ($profile = mysql_fetch_object($result)) {
<br> <br>
"; ";
echo "</td><td><table border=2> "; echo "</td><td><table border=2> ";
show_profile($profile, $logged_in_user, true); show_profile($profile, $g_logged_in_user, true);
echo "</table></td></tr>\n"; echo "</table></td></tr>\n";
echo "<input type=\"hidden\" name=\"userid$n\" value=\"$profile->userid\">\n"; echo "<input type=\"hidden\" name=\"userid$n\" value=\"$profile->userid\">\n";
$n++; $n++;

View File

@ -18,9 +18,7 @@
// db_purge options // db_purge options
// //
// purge workunit and result records that are no longer needed. // purge workunit and result records that are no longer needed.
// Specifically, purges WUs for which file_delete_state=DONE; // Specifically, purges WUs for which file_delete_state=DONE.
// this occurs only when it has been assimilated
// and all results have server_state=OVER.
// Purging a WU means writing it and all its results // Purging a WU means writing it and all its results
// to XML-format archive files, then deleting it and its results from the DB. // to XML-format archive files, then deleting it and its results from the DB.
// //