I'm getting the error "svn: bdb: call implies an access method which is inconsistent with previous calls". How do I fix this?

Berkeley DB 4.1 has shown itself to be rather unstable - both 4.0 and 4.2 are better. This error message is a symptom of one unique way in which 4.1 will sometimes break.

The problem is that the database format field for one of the tables that make up a Subversion repository using the Berkeley DB backend has become corrupted. For unknown reasons, this is almost always the "copies" table, which switches from the "btree" type to the "recno" type. Simple recovery procedures are outlined below - if they do not succeed, you should contact the Subversion Users mailing list.

  1. Ensure that no other processes will attempt to access your repository.
  2. Back up your repository to a tar or zip file or similar.
  3. Change to the db subdirectory of your repository.
  4. Run rm db.* log.*
  5. Run db_dump -p -r copies > copies.dump
  6. Edit copies.dump. In the section near the top, change "type=recno" to "type=btree", and delete the line beginning "re_len=".
  7. Run rm copies
  8. Run db_load copies < copies.dump
  9. Run svnadmin dump .. >../../my-recovered.svndump
  10. Now create a new repository, reload the dump file just produced, and copy across any custom hooks or configuration. Verify that the highest revision number in the new repository is what you think it should be.