Too many rows in file_on
Brad Fitzpatrick
brad at danga.com
Thu Dec 7 09:10:10 UTC 2006
Interesting. This needs to get fixed. Not urgent, but annoying.
If you know why/how this happens, let me know, otherwise I'll look around
and try to find it.
Thanks for the info!
Brad
On Thu, 7 Dec 2006, Andreas J. Koenig wrote:
> 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 (){
> $sth3->execute;
> my($cnt) = $sth3->fetchrow_array or last;
> $sth->execute;
> my($mfid);
> while (my($fid) = $sth->fetchrow_array){
> $sth2->execute($fid);
> $mfid = $fid;
> }
> last unless $mfid;
> print "$mfid ($cnt)\n";
> sleep 1;
> }
>
> Are there other cleanup tasks I should go after?
>
> Thanks,
> --
> andreas
>
>
More information about the mogilefs
mailing list