Skip to content

Commit

Permalink
pbackup: Remove fix_stat command
Browse files Browse the repository at this point in the history
  • Loading branch information
donald committed Apr 7, 2025
1 parent b187678 commit 33720b8
Showing 1 changed file with 0 additions and 45 deletions.
45 changes: 0 additions & 45 deletions bin/pbackup
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ usage: $0 command [args]
move JOB_NAME Cnnn : move all runs of jobs with name to volume
bfix JOB_NAME : show some help to fix status after aborted balancer moves
fix_stat : fill in 'du' satt for all runs where we dont have the data yet
test : DO NOT USE: do something
disable JOB_NAME : disable job temporarlily until next amd_scan
parse-jobs : parse automount data into jobs to stdout
Expand Down Expand Up @@ -1365,48 +1364,6 @@ ORDER BY due
$dbh->commit;
}
sub cmd_fix_stat {
upid_register_self();
my $sth = $dbh->prepare('SELECT stat.rowid, stat_started, job_name, volume_path, path_path FROM stat, job, volume, path WHERE stat_du_bytes IS NULL AND stat_volume_id = volume_id AND stat_job_id = job_id AND job_path_id = path_id ORDER BY stat.rowid DESC');
SCAN: while (1) {
upid_doing("du scan");
$dbh->begin_work();
$sth->execute();
my $retry = 0;
while (my $row = $sth->fetchrow_arrayref) {
my ($stat_rowid, $stat_started, $job_name, $volume_path, $path_path) = @$row;
my $dir = sprintf '%s/%s/%s:%s:%s', $volume_path, $job_name, $job_name,timetag($stat_started), fstag($path_path);
printf "%5d %s %-30s %s %s\n", $stat_rowid, shortDate($stat_started), $job_name, $volume_path, $dir;
unless (lck_can_lock("JOB.$job_name", LCK_EX)) {
print " *** LOCKED ***\n";
$retry++;
next;
}
unless (-d $dir) {
print " *** missing : $dir\n";
next;
}
lck_lock("JOB.$job_name", LCK_EX);
upid_doing("du $dir");
$sth->finish();
$dbh->commit();
my ($stat_du_bytes) = du_bytes("$dir");
$dbh->do('UPDATE stat SET stat_du_bytes = ? WHERE rowid = ?', undef, $stat_du_bytes, $stat_rowid);
print " ... ", human($stat_du_bytes), "\n";
lck_unlock("JOB.$job_name", LCK_EX);
redo SCAN;
}
$dbh->commit();
last unless $retry;
}
upid_deregister_self();
}
sub expire_one {
my ($want_job_name) = @_;
$dbh->begin_work();
Expand Down Expand Up @@ -1784,8 +1741,6 @@ if ($cmd eq 'status') {
cmd_migrate();
} elsif ($cmd eq 'monitor') {
system "$ROOT/bin/iview 1 $ROOT/bin/pbackup status"
} elsif ($cmd eq 'fix_stat') {
cmd_fix_stat();
} elsif ($cmd eq 'sql') {
my $db_filename = get_db_filename();
system('sqlite3', '-header', $db_filename, @ARGV);
Expand Down

0 comments on commit 33720b8

Please sign in to comment.