[Dev] about copying repositories

Andi Vajda vajda at osafoundation.org
Mon Jul 18 14:39:00 PDT 2005


For the longest time I've been under the mistaken impression that it was OK to 
copy entire __repository__ directories from machine to machine and expect all 
to be fine. Not so !

The Berkeley DB documentation is pretty clear about it:

   - Environment files are very specific to the machine, architecture and even
     OS version they're created on. These are the db.* files in __repository__.
   - Log files are byte order specific. These are the log.* files.
   - Database file, only, are actually portable. These are the *.db files.

In order to copy a repository around machines of different OSs, or different 
byte order:

  - if the repository wasn't closed properly, running db_checkpoint first
     would ensure that the latest transaction(s) are committed to the actual
     database files (on clean close(), checkpoint() is run):
     . on Windows:
       - make sure $CHANDLERBIN/release/bin is on the PATH (watch out, cygwin
         has really old db_* utilities that don't work with our stuff)
       - $CHANDLERBIN/release/bin/db/db_checkpoint -1 -h __repository__
     . on Unix
       - make sure $CHANDLERBIN/release/lib is on the LD_LIBRARY_PATH or
         DYLD_LIBRARY_PATH
       - $CHANDLERBIN/release/db/bin/db_checkpoint -1 -h __repository__

     yes, in one case it's bin/db, in the other db/bin, don't ask...

  - copy the db.* files only

To restore a copy:

  - create an environment by creating an empty repository or use an existing
    environment by deleting the log.* files first
  - copy the db.* files into the environment

I expect to write a script soon to simplify this mess...

Andi..


More information about the Dev mailing list