Store.pm: clear_fsck_log()

Mark Smith smitty at gmail.com
Mon Mar 10 22:43:37 UTC 2008


>  Is there any reason not to use "TRUNCATE TABLE fsck_log" instead of
>  "DELETE FROM fsck_log" in clear_fsck_log() ?
>
>  I'm hosting ~95 millions files on my MogileFS cluster, and launching a
>  fsck operation on it takes days. So I'm running fsck once per month.
>  As a result, I often have tens of thousands entries in my fsck log.
>
>  MySQL would lose hours to analyse it unnecessarily before deleting it,
>  but it only takes a few ms to truncate the table. So I think it would be
>  a simple but nice improvement.

AFAIK this trick doesn't work on InnoDB, since they use a flat
tablespace TRUNCATE just maps to DELETE FROM anyway.

I'm not sure on the ramifications of this change on Postgres as well.
The particular code you're proposing change is used cross-db.  Some
quick web searches seem to indicate that TRUNCATE is a-ok on Postgres,
but it'd be good to know if this is actually advisable in that
environment or not.

It would seem to me to be useful to break this down per-db, then you
can make it safe on MySQL using the 'create new table, rename tables,
drop old table' trick which is fast in InnoDB and MyISAM, and just
have Postgres do a TRUNCATE.

Food for thought, anyway.


-- 
Mark Smith / xb95
smitty at gmail.com


More information about the mogilefs mailing list