Too many rows in file_on

Andreas J. Koenig andreas.koenig.gmwojprw at
Thu Dec 7 03:37:10 UTC 2006

I'm running with rev. 518 now and I encounter no apparent
misbehaviour, that's very nice. But I have the impression we need to
clean up a bit.

>From 'show table status' I get these figures:

| file                 | 61672   |
| file_on              | 1197622 |

Given that all my classes have a mindevcount of 2, this seems like the
result of a bug that hit us some day, correct?

Needless to say that plenty of records exist for which there is a
file_on record but no file record.

Is this perl script suited for cleaning up or are there nicer ways?

  my $sth = $dbh->prepare("select fo.fid from file_on fo left join file fi using (fid) where dkey is NULL limit 1024");
  my $sth2 = $dbh->prepare("delete from file_on where fid = ?");
  my $sth3 = $dbh->prepare("select count(*) from file_on");
  while (){
    my($cnt) = $sth3->fetchrow_array or last;
    while (my($fid) = $sth->fetchrow_array){
      $mfid = $fid;
    last unless $mfid;
    print "$mfid ($cnt)\n";
    sleep 1;

Are there other cleanup tasks I should go after?


More information about the mogilefs mailing list