[ZODB-Dev] maintenance of a BerkeleyDB

Barry A. Warsaw barry@zope.com
Thu, 1 Nov 2001 01:44:04 -0500


>>>>> "AS" == Andrew Sydelko <sydelko@ecn.purdue.edu> writes:

    AS> I'm ready to move to BerkeleyDB except for one
    AS> small detail: maintenance and backups (ok, maybe two).

    AS> Are there any documents on how to maintain a BerkeleyDB?

Here's where Sleepycat talks about backing up your database:

http://www.sleepycat.com/docs/ref/transapp/archival.html

Berkeley storage doesn't add any additional requirements here,
although two things to note:

- Because of semantic differences in locking b/w BDB and ZODB, we
  actually use a temporary commit log file which gets appended to
  during store() operations, and replayed into the Berkeley database
  during tpc_finish().  You /should/ never see these files since
  they're unlinked as soon as the Berkeley transaction commits (or
  aborts).  If you do see them, they'll have long hex-digit names, and
  should probably be written to your archival media along with
  Berkeley's own log files.  They live in the same directory, so that
  should be easy.

- One thing I've observed recently: it's important that your
  application close the Berkeley storage when you're done with it,
  otherwise it will be left in a needs-recovery state.  Berkeley
  storage opens the databases with the DB_RECOVER flag, so recover
  will happen automatically, but it can be very time consuming.  If
  you're using Berkeley storage with Zope or ZEO, you /should/ be okay
  for most situation, but if you're writing your own ZODB application
  you need to be aware of this (I'm working on updated docs).

-Barry