Temporary file cleanup problem in CREATE_CLOSE command

Chaos Wang chaoslawful at gmail.com
Mon Mar 31 03:54:49 UTC 2008

The CREATE_CLOSE command without a key parameter means to delete a
previously created temporary file, but it didn't behave like this. The
handler of CREATE_CLOSE command did move temporary file entry into
file_to_delete table, but forgot to add the storage location into
file_on table first, so at present it just cleaned all records of the
tmpfile up without touching tmpfile data.

Make the following tiny modification to MogileFS/Worker/Query.pm should
be enough to solve this problem:

--- Query.pm.old        2008-03-31 11:43:34.000000000 +0800
+++ Query.pm    2008-03-31 11:45:35.000000000 +0800
@@ -351,6 +351,9 @@
     # if a temp file is closed without a provided-key, that means to
     # delete it.
     unless (defined $key && length($key)) {
+        # XXX: modified by chaoslawful, add file data location first
+        $dfid->add_to_db;
+        # XXX: ends here
         return $self->ok_line;

More information about the mogilefs mailing list