[Tickets #4797] Re: A large horde_vfs table can cause large memory usage during GC

bugs@bugs.horde.org bugs at bugs.horde.org
Wed Dec 20 15:09:28 PST 2006


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: https://dev.horde.org/horde/whups/ticket/?id=4797
-----------------------------------------------------------------------
 Ticket             | 4797
 Updated By         | Chuck Hagenbuch <chuck at horde.org>
 Summary            | A large horde_vfs table can cause large memory usage during GC
 Queue              | Horde Framework Packages
 Version            | HEAD
 Type               | Bug
 State              | Feedback
 Priority           | 2. Medium
 Owners             | 
-----------------------------------------------------------------------


Chuck Hagenbuch <chuck at horde.org> (2006-12-20 15:09) wrote:

Okay, can you give this implementation a shot? Drop this into VFS_sql:

    /**
     * Garbage collect files in the VFS storage system.
     *
     * @param string $path   The VFS path to clean.
     * @param integer $secs  The minimum amount of time (in seconds)
required
     *                       before a file is removed.
     */
    function gc($path, $secs = 345600)
    {
        $sql = 'DELETE FROM ' . $this->_params['table']
            . ' WHERE vfs_type = ? AND vfs_modified < ? AND (vfs_path = ?
OR vfs_path LIKE ?)';
        $this->log($sql, PEAR_LOG_DEBUG);

        $values = array(VFS_FILE,
                        time() - $secs,
                        $this->_convertPath($path),
                        $this->_convertPath($path) . '/%');

        return $this->_write_db->query($sql, $values);
    }

... and use it with the latest version of GC.php
(http://cvs.horde.org/framework/VFS/VFS/GC.php - it'll call a gc() method
if it exists in the passed-in $vfs object).




More information about the bugs mailing list