After upgrading to Berkeley DB 4.3 or later, I’m seeing repository errors.

From : http://subversion.tigris.org/faq.html#bdb43-upgrade

Prior to Berkeley DB 4.3, svnadmin recover worked to upgrade a Berkeley DB repository in-place. However, due to a change in the behaviour of Berkeley DB in version 4.3, this now fails.

Use this procedure to upgrade your repository in-place to Berkeley DB 4.3 or later:

  • Make sure no process is accessing the repository (stop Apache, svnserve, restrict access via file://, svnlook, svnadmin, etc.)
  • Using an older svnadmin binary (that is, linked to an older Berkeley DB):
    1. Recover the repository: ‘svnadmin recover /path/to/repository
    2. Make a backup of the repository.
    3. Delete all unused log files. You can see them by running ‘svnadmin list-unused-dblogs /path/to/repeository
    4. Delete the shared-memory files. These are files in the repository’s db/ directory, of the form __db.00*

The repository is now usable by Berkeley DB 4.3.

之前再 SL4 上面架設 svn + trac. 後來升級為 SL5 後發現, svn 不能用了. 心裡真是覺得有點按陰陽. 瀏覽 trac 的時候發現 berkeley db 版本不一致. .

bdb: Program version 4.3 doesn’t match environment version

用svnadmin verify /xxx/xxx/repo也是出現下列問題

svnadmin verify DB_VERSION_MISMATCH: Database environment version mismatch

於是到SL4 & SL5分別查他們的 bdb 版本. SL4 -> db4-4.2, SL5 -> db4-4.3. 更是明確知道了要查 bdb 4.2 -> 4.3 升級升級的問題.

還好有找到解決的方法 http://subversion.tigris.org/faq.html#bdb43-upgrade

大致上有下列幾個步驟:

  1. 在 bdb 4.3 版本上用 ‘svnadmin recover /path/to/repository‘ 修復db
  2. 備份/path/to/repository
  3. 清除沒有使用的logs. 用 ‘svnadmin list-unused-dblogs /path/to/repeository‘ 指令查出哪些是沒有用的logs
  4. 刪除 shared-memory 檔案. 那些檔案在 db/ 目錄下的所有 __db.00*

這樣就完成升級的動作. 在做這些步驟.最好把網頁伺服器關掉.