Re: [htdig] Replacing db files?


Subject: Re: [htdig] Replacing db files?
From: Gilles Detillieux (grdetil@scrc.umanitoba.ca)
Date: Wed May 24 2000 - 07:34:53 PDT


According to David Sklar:
> I will definitely transfer the database files to the search machines using
> different filenames (but on the same partition, so moving them will be quick),
> I was just wondering if I should do anything special to htsearch to tell it
> not to do searches for the few seconds when the files themselves are actually
> being moved or if I need to tell it to not cache anything that it might be
> caching because the files have changed, etc..
>
> The context I'm coming from is doing similar things with MySQL where I lock a
> table, flush MySQL's buffers, copy new files over existing table files, and
> unlock the table.

You can shave the time for switching the files from a few seconds to under
a second, by using a few directory renames. E.g., if your old databases are
in the "db" directory, and the new databases are in "newdb", using the same
filenames, then you can use:

        mv db olddb && mv newdb db

to swap the databases very quickly, and then do the "rm -r olddb" which will
be the slower part of the operation (but not time-critical). I don't think
you'll need to worry about race conditions at all, as it's highly unlikely
that htsearch will try to open its databases between the two mv commands.
Once htsearch has the database files open, it should continue to use them,
even if the directory name is changed between the opens and the closes.
Even if you remove the database files, Linux or Unix will keep the files
around until they're closed, before ripping them apart.

-- 
Gilles R. Detillieux              E-mail: <grdetil@scrc.umanitoba.ca>
Spinal Cord Research Centre       WWW:    http://www.scrc.umanitoba.ca/~grdetil
Dept. Physiology, U. of Manitoba  Phone:  (204)789-3766
Winnipeg, MB  R3E 3J7  (Canada)   Fax:    (204)789-3930

------------------------------------ To unsubscribe from the htdig mailing list, send a message to htdig-unsubscribe@htdig.org You will receive a message to confirm this.



This archive was generated by hypermail 2b28 : Wed May 24 2000 - 05:23:33 PDT