According to Greg Fenton:
> --- Gilles Detillieux <[EMAIL PROTECTED]> wrote:
> > > It sure would help make some of the support scripts (rundig, etc.)
> > > easier to write if that file ended ".work".
> > 
> > True, although one extra move or copy in the script isn't that hard.
> 
> Actually, it is kind'a hard.
> 
> The problem (for my scenario) is that I need to update the DB without
> interfering with the "live" db.  To accomplish this, I run htfuzzy on
> the .work database(s).  But, htfuzzy doesn't support the "-a" flag, so
> I have to (somehow) move the words and words.db_weakcmpr to a
> non-".work" location, run htfuzzy on those, and move them back to
> ".work" so that the rest of my script can move the final results into
> place (thus minimizing downtime of the live search).
> 
> It's kind'a ugly, but I have it working by using two different config
> files, separate directories for build and search, etc.  It would just
> be "nicer" (and easier for people to follow) if htfuzzy supported "-a".

I know you said to disregard this message, but I did think of a simpler
workaround.  As long as you're dealing with separate directories and
config files, you can take it a step further and do away with the -a
option entirely.  Just do all the index updating (htdig, htpurge, htfuzzy)
with one config file and database_dir, and use another one for searching
the "live" database.  Then, when the update is complete, just move the
directories around so the updated one becomes the live one.  That would
keep your database downtime to a small fraction of a second between to
"mv" commands, which is even quicker that moving each database file into
place (and much quicker than copying).  Your script would be something
like this:

DIGD=/var/lib/htdig/digd
LIVE=/var/lib/htdig/live
mkdir -p $DIGD
cp -p $LIVE/* $DIGD/    # only if you're doing an update dig
htdig ...
htpurge ...
htfuzzy ...
htnotify ...
mv $LIVE $LIVE.old && mv $DIGD $LIVE    # quick swap of directories
rm -rf $LIVE.old                        # slower removal of old DBs

There may be a bit of an inefficiency in having to copy ALL of the live
database files to the dig directory, but as the code stands right now in
3.2.0b4, it seems that all programs need all the database files.  Even if
you could move db.docs.index from $LIVE to $DIGD, instead of copying, it
wouldn't save you much as this is about the smallest file of the lot.

A simple enhancement to all the ht://Dig programs that would simplify
scripts like this a bit would be to add a -D option, or something like
it, to set config attributes from the command line.  This would let you
do away with extra config files when all you need to do is override one
or a few config attributes.  E.g.:

  htdig -c /etc/htdig/htdig.conf -Ddatabase_dir=$DIGD

I've often thought about adding something like this, but never got around
to it.

-- 
Gilles R. Detillieux              E-mail: <[EMAIL PROTECTED]>
Spinal Cord Research Centre       WWW:    http://www.scrc.umanitoba.ca/
Dept. Physiology, U. of Manitoba  Winnipeg, MB  R3E 3J7  (Canada)


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
htdig-dev mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/htdig-dev

Reply via email to