[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Filesystem-local databases in mlocate



On Fri, Mar 16, 2007 at 05:16:26AM +0100, Miloslav Trmac wrote:
> Hi,
> I'm planning to add filesystem-local database support to mlocate.  This
> allows:

First of all thanks for attacking this!

> - running updatedb on a file server and making the database
>   automatically available to clients without any client-side
>   configuration
> - using locate on GFS volumes without running updatedb on each host that
>   has the volume mounted (which slows the volumes down due to lock
>   contention)
> 
> The plan:
> * the mlocate.db format is extended to support databases without a fixed
>   path prefix, such that all entries in a database in
>   /foo/bar/.mlocate/mlocate.db are implicitly prefixed by /foo/bar.
>   (this allows using /srv/home on the file server, mounting it as /home,
>   and using a single database on both the server and the client).
> * locate(1)'s default database is not just /var/lib/mlocate/mlocate.db;
>   mlocate also checks each mounted filesystem for a .mlocate/mlocate.db
>   file, owned by root or the invoking user, and not writable by anyone
>   but the owner.  Such files are automatically added to the database
>   path.

locate should also include .mlocate/mlocate.db a previous updatedb has
found and skipped. E.g. if updatedb detects a .mlocate/mlocate.db in a
folder in its path it skips it and registers it for locate to use.

Perhaps that way you can even save the explicit mentioning of
--single-fs paths in /etc/sysconfig/mlocate. If a paths is to be
handled as such the admin just creates an .mlocate folder and updatedb
and locate automatically pick it up.

> * To allow overriding this check, the LOCATE_PATH variable is changed
>   to override the default database path instead of appending to the
>   database path.
>   *note*: this is an incompatible change
> * updatedb(8) gets a new option, --single-fs PATH.
>   This option generates a database in PATH/.mlocate/mlocate.db that
>   spans only the subtree of PATH. filesystems mounted in subdirectories
>   of PATH are automatically excluded, PRUNEFS is ignored.  PRUNEPATHS is
>   honored, except for PATH itself.
> * /etc/cron.daily/mlocate reads /etc/sysconfig/mlocate to get a list
>   of single-fs PATHs.  For each PATH it checks PATH/.mlocate/mlocate.db
>   is older than 12 hours, creates a lock to prevent a concurrent
>   updatedb, and runs updatedb --single-fs PATH.
> 
>   The standard daily run is performed as well, with all entries of
>   /etc/sysconfig/mlocate added to PRUNEPATHS automatically.
> 
> Usage for /home on NFS:
> - NFS is automatically excluded by clients, so updatedb on clients
>   does not walk the filesystem.
> - On the server:
>   Add /srv/home to /etc/sysconfig/mlocate.  If /srv/home is not a
>   separate mount point, add LOCATE_PATH=:/srv/home/.mlocate/mlocate.db
>   to the global environment.
> 
> Usage for /home on GFS:
> - GFS is automatically excluded, so no host walks the filesystem by
>   default.
> - On all hosts: add /home to /etc/sysconfig/mlocate
> 
> 
> Can anyone see a problem with the plan, or an important feature that the
> above fails to address?
> 
> Thanks,
> 	Mirek
> 

-- 
Axel.Thimm at ATrpms.net

Attachment: pgpYjXxOT3XAt.pgp
Description: PGP signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]