database copying and compacting
Pavel Kankovsky
peak at argo.troja.mff.cuni.cz
Mon Nov 15 11:26:34 CET 2004
On Sun, 7 Nov 2004, David Relson wrote:
> Now, with 0.93.0 it's necessary to save log files and use dd (with
> proper block size) when copying the database. Thus copying becomes:
>
> SIZE=`db_stat -h $ORIG -d wordlist.db | grep "page size" | cut -f 1`
> cp $SRC/log* $SRC/__db.* $DST
> for FILE in $SRC/*.db ; do
> dd bs=$SIZE if=$FILE of=$DST/`basename $FILE`
> done
According to Berkeley DB's "Database and log file archival"
(http://www.sleepycat.com/docs/ref/transapp/archival.html)
hot database backup (*) should copy db files BEFORE log files and the
order is important. The requirement makes sense to me: if you copy log
files first and db files next, you might end with db files containing
data from updates missing in log files and the result will be
unrecoverable. On the other hand, if you copy db files first and log
files next, all data in db files can be either commited or rolled back
using the information in log files (at least unless you drop some log
files in the middle of backup).
Moreover, it might be a good idea to add something like
db_recover -c -h $DST in order to put the destination db into a
consistent state.
(*) I assume this is what you intend to do because dd is necessary to
guarantee page-level read consistency wrt concurrent writes.
--Pavel Kankovsky aka Peak [ Boycott Microsoft--http://www.vcnet.com/bms ]
"Resistance is futile. Open your source code and prepare for assimilation."
More information about the Bogofilter
mailing list