Store.pm: clear_fsck_log()

Guillaume Blairon g at skyrock.com
Mon Mar 10 15:51:21 UTC 2008


Hi,


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.

Here's the patch :

--- mogilefs-server-2.17/lib/MogileFS/Store.pm    2007-08-06 15:41:57.000000000 +0200
+++ mogilefs-server-sky/lib/MogileFS/Store.pm  2008-03-10 16:47:00.000000000 +0100
@@ -1322,7 +1322,7 @@
 # return 1 on success.  die otherwise.
 sub clear_fsck_log {
     my $self = shift;
-    $self->dbh->do("DELETE FROM fsck_log");
+    $self->dbh->do("TRUNCATE TABLE fsck_log");
     return 1;
 }



--
Guillaume


More information about the mogilefs mailing list